prism2.device: Compiler delint
[AROS.git] / arch / x86_64-pc / exec / userstate.s
blob0904f622c21b6ab97291804a06d7b667603ca09b
1 #include <aros/x86_64/asm.h>
3 .text
4 .align 16
6 .globl cpu_SuperState
7 .type cpu_SuperState, @function
9 // This is a SuperState() helper. It's called via Supervisor().
10 // Its job is to restore a stack pointer and return to user's code.
11 cpu_SuperState:
12 movq %rsp, %rax // return int handler stack
13 movq 24(%rax),%rsp // use user stack
14 pushq (%rax) // push return address
15 cpu_UserState:
16 ret // return from SuperState() call
18 .size cpu_SuperState, .-cpu_SuperState
20 .globl AROS_SLIB_ENTRY(UserState, Exec, 26)
21 .type AROS_SLIB_ENTRY(UserState, Exec, 26), @function
23 AROS_SLIB_ENTRY(UserState, Exec, 26):
24 // Supervisor return stack is already in rdi
25 movq %rsp, 24(%rdi) // put USP onto exception stack frame
26 movq %rdi, %rsp // SSP = SP
27 leaq cpu_UserState(%rip), %rax
28 movq %rax, (%rsp) // return at this address
29 iretq
31 .size AROS_SLIB_ENTRY(UserState, Exec, 26), .-AROS_SLIB_ENTRY(UserState, Exec, 26)