1 #include <aros/x86_64/asm.h>
2 #include <aros/config.h>
6 .globl AROS_SLIB_ENTRY(StackSwap, Exec)
7 .type AROS_SLIB_ENTRY(StackSwap, Exec), @function
9 AROS_SLIB_ENTRY(StackSwap, Exec):
10 /* struct StackSwap is %rdi */
15 /* StackSwap -> %rbx */
18 /* Disable interrupts */
23 movq ThisTask(%rsi), %rax
25 /* Exchange tc_SPLower */
26 movq tc_SPLower(%rax), %rcx
27 xchgq %rcx, stk_Lower(%rbx)
28 movq %rcx, tc_SPLower(%rax)
30 /* Exchange tc_SPUpper */
31 movq tc_SPUpper(%rax), %rcx
32 xchgq %rcx, stk_Upper(%rbx)
33 movq %rcx, tc_SPUpper(%rax)
35 /* StackSwap -> %rdi */
39 /* Get the return address */
42 /* Restore *NEW* stack pointer */
43 xchgq %rsp, stk_Pointer(%rdi)