Assembly 38 lines
#include "asm_defs.inc"
.globl core_switch_to
core_switch_to:
mov x10, #CORE_CONTEXT_OFFSET
add x8, x0, x10
mov x9, sp
/* save context into prev->core_context */
stp x19, x20, [x8], #16
stp x21, x22, [x8], #16
stp x23, x24, [x8], #16
stp x25, x26, [x8], #16
stp x27, x28, [x8], #16
stp x29, x9, [x8], #16
str x30, [x8]
/* restore context from next->core_context */
add x8, x1, x10
ldp x19, x20, [x8], #16
ldp x21, x22, [x8], #16
ldp x23, x24, [x8], #16
ldp x25, x26, [x8], #16
ldp x27, x28, [x8], #16
ldp x29, x9, [x8], #16
ldr x30, [x8]
mov sp, x9
ret
.globl set_pgd
set_pgd:
msr ttbr0_el1, x0
/* tlb invalidate, vm all el1 inner sharable */
tlbi vmalle1is
/* data sync inner sharable */
dsb ish
/* instruction sync barrier, flushes pipeline */
isb
ret