Kernel/switch.s

18 lines
No EOL
312 B
ArmAsm

.global context_switch
.type context_switch, %function
context_switch:
// r0 = current task context
// r1 = next task context
// Save r4-r12
STMIA r0!, {r4-r12}
STR sp, [r0]
STR lr, [r0, #4]
// Restore r4-r12
LDMIA r1!, {r4-r12}
LDR sp, [r1]
LDR lr, [r1, #4]
BX lr