/* void arm64_context_switch(vaddr_t *old_sp, vaddr_t new_sp); */
FUNCTION(arm64_context_switch)
/* save old frame */
push x28, x29
push x26, x27
push x24, x25
push x22, x23
push x20, x21
push x18, x19
mrs x18, tpidr_el0 // move tpidr_el0 into x18
mrs x19, tpidrro_el0
push x18, x19 // save x18 into stack
push x30, xzr
//--switch stack frame
/* save old sp */
mov x15, sp
str x15, [x0] // [x0] :first param ,that is oldthread->arch.sp
/* load new sp */
mov sp, x1 // x1 :second param , move newthread->arch.sp into sp
/* restore new frame */
pop x30, xzr
pop x18, x19
msr tpidr_el0, x18
msr tpidrro_el0, x19
pop x18, x19