|
发表于 2006-8-31 11:12:55
|
显示全部楼层
我看了在start.S中的一些代码,有些疑问
_interrupt_thread_switch:
mov r1, #0 @ clear rt_thread_switch_interrput_flag
str r1, [r0]
ldmfd sp!, {r0-r12,lr}@ reload saved registers
stmfd sp!, {r0-r3} @ save r0-r3
mov r1, sp
add sp, sp, #16 @ restore sp
sub r2, lr, #4 @ save old task's pc to r2
mrs r3, spsr @ disable interrupt
orr r0, r3, #NOINT @在这里禁止了中断
msr spsr_c, r0
ldr r0, =.+8 @ switch to interrupted task's stack
movs pc, r0
stmfd sp!, {r2} @ push old task's pc
stmfd sp!, {r4-r12,lr}@ push old task's lr,r12-r4
mov r4, r1 @ Special optimised code below
mov r5, r3
ldmfd r4!, {r0-r3}
stmfd sp!, {r0-r3} @ push old task's r3-r0
stmfd sp!, {r5} @ push old task's psr
mrs r4, spsr @这里把禁止掉中断的SPSR寄存器压入了栈中
stmfd sp!, {r4} @ push old task's spsr
ldr r4, =rt_interrupt_from_thread
ldr r5, [r4]
str sp, [r5] @ store sp in preempted tasks's TCB
ldr r6, =rt_interrupt_to_thread
ldr r6, [r6]
ldr sp, [r6] @ get new task's stack pointer
ldmfd sp!, {r4} @ pop new task's spsr
msr SPSR_cxsf, r4 @把禁止中断的SPSR从栈中取出赋给新的SPSR,这样的话那岂不是禁止了中断吗?因为之前的SPSR是禁止掉中断的
ldmfd sp!, {r4} @ pop new task's psr
msr CPSR_cxsf, r4
ldmfd sp!, {r0-r12,lr,pc} @ pop new task's r0-r12,lr & pc
我把这一段隐掉了,你看合不合适:
mrs r3, spsr @ disable interrupt
orr r0, r3, #NOINT @在这里禁止了中断
msr spsr_c, r0
会造成什么不良的影响吗? |
|