35 lines
490 B
ArmAsm
35 lines
490 B
ArmAsm
/*
|
|
* Trap Handlers
|
|
*/
|
|
|
|
#include <machine/asm.h>
|
|
|
|
.text
|
|
|
|
# switch(uint64_t *oldsp, uint64_t newsp)
|
|
# %rdi: oldsp
|
|
# %rsi: newsp
|
|
FUNC_BEGIN(switchstack)
|
|
pushq %rbp
|
|
pushq %rdi
|
|
pushq %rbx
|
|
pushq %r12
|
|
pushq %r13
|
|
pushq %r14
|
|
pushq %r15
|
|
|
|
# Switch stack
|
|
movq %rsp, (%rdi)
|
|
movq %rsi, %rsp
|
|
|
|
popq %r15
|
|
popq %r14
|
|
popq %r13
|
|
popq %r12
|
|
popq %rbx
|
|
popq %rdi
|
|
popq %rbp
|
|
ret
|
|
FUNC_END(switchstack)
|
|
|