/*
* Register switch for ARMv3 and ARMv4 processors
* r0 = previous task_struct, r1 = previous thread_info, r2 = next thread_info
* previous and next are guaranteed not to be the same.
*/
ENTRY(__switch_to)
#将要被替换进程的上下文环境的存放地址prev->thread_info->cpu_context-传给r12(ip)
add ip, r1, #TI_CPU_SAVE
#将即将被调度运行进程的存储域设置值(对应CP15协处理器的C3寄存器的值)传给R3寄存器
ldr r3, [r2, #TI_CPU_DOMAIN]!
#保存要被替换的上下文环境到IP寄存器所值的值
stmia ip!, {r4 - sl, fp, sp, lr} @ Store most regs on stack
#if defined(CONFIG_CPU_XSCALE) && !defined(CONFIG_IWMMXT)
mra r4, r5, acc0
stmia ip, {r4, r5}
#endif
#将要被调度的程序的存储域设置值写入C15
mcr p15, 0, r3, c3, c0, 0 @ Set domain register
#ifdef CONFIG_VFP
@ Always disable VFP so we can lazily save/restore the old
@ state. This occurs in the context of the previous thread.
VFPFMRX r4, FPEXC
bic r4, r4, #FPEXC_ENABLE
VFPFMXR FPEXC, r4
#endif
#if defined(CONFIG_IWMMXT)
bl iwmmxt_task_switch
#elif defined(CONFIG_CPU_XSCALE)
add r4, r2, #40 @ cpu_context_save->extra
ldmib r4, {r4, r5}
mar acc0, r4, r5
#endif
#从即将被调度运行进程的上下文环境中取出R4-SL,FP,SP.LR等寄存器的值到R4-SL....LR中,这样就凯斯执行上次该进程被中断指令的下一条指令
ldmib r2, {r4 - sl, fp, sp, pc} @ Load all regs saved previously
__INIT
阅读(1596) | 评论(1) | 转发(0) |