Kernel/src/switch.S

26 lines
553 B
ArmAsm

.global context_switch
.type context_switch, %function
context_switch:
// Save callee-saved registers
stp x19, x20, [x0]
stp x21, x22, [x0, #16]
stp x23, x24, [x0, #32]
stp x25, x26, [x0, #48]
stp x27, x28, [x0, #64]
str x29, [x0, #80]
str x30, [x0, #88]
str sp, [x0, #96]
// Load new task context
ldp x19, x20, [x1]
ldp x21, x22, [x1, #16]
ldp x23, x24, [x1, #32]
ldp x25, x26, [x1, #48]
ldp x27, x28, [x1, #64]
ldr x29, [x1, #80]
ldr x30, [x1, #88]
ldr sp, [x1, #96]
ret