prism2.device: Compiler delint
[AROS.git] / arch / .unmaintained / dummy / superstate.c
blobaaaaded0cfeea2515852e875a42210208150e9eb
1 |*****************************************************************************
3 | NAME
5 | __AROS_LH0(APTR, SuperState,
7 | SYNOPSIS
9 | LOCATION
10 | struct ExecBase *, SysBase, 25, Exec)
12 | FUNCTION
13 | Enter supervisor mode (like Supervisor()), but return on the normal
14 | user stack, so that user stack variables are still there. A call
15 | to Userstate() will end this mode.
17 | INPUTS
19 | RESULT
20 | Old supervisor stack. NULL if called from supervisor mode.
22 | NOTES
23 | The user stack must be big enough to hold all possible nestings
24 | of interrupts.
26 | EXAMPLE
28 | BUGS
30 | SEE ALSO
31 | UserState(), Supervisor()
33 | INTERNALS
35 | HISTORY
37 |******************************************************************************
39 Supervisor = -0x1e
41 .globl _Exec_SuperState
42 _Exec_SuperState:
43 | Goto supervisor mode. Preserve a5 in d0 (faster than stack space)
44 movel a5,d0
45 leal super,a5
47 | Do not change user stack - use jmp
48 jmp a6@(Supervisor)
49 super:
50 | Restore a5
51 movel d0,a5
53 | Check if called from supervisor mode
54 btst #5,sp@
55 jeq fromuser
57 | Called from supervisor mode. Just return NULL.
58 moveql #0,d0
59 rte
61 fromuser:
62 | Called from user mode. Restore sp and return supervisor sp.
63 movel sp,d0
64 movel usp,sp
66 | usp already points to the returnaddress for the SuperState() call.
67 rts