revert between 56095 -> 55830 in arch
[AROS.git] / arch / .unmaintained / ppc-native / exec / superstate.s
blob949e077e88352b25fefccc6a6d8533f4d812ebc9
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 /*****************************************************************************
8 NAME
10 AROS_LH0(APTR, SuperState,
12 SYNOPSIS
14 LOCATION
15 struct ExecBase *, SysBase, 25, Exec)
17 FUNCTION
18 Enter supervisor mode (like Supervisor()), but return on the normal
19 user stack, so that user stack variables are still there. A call
20 to Userstate() will end this mode.
22 INPUTS
24 RESULT
25 Old supervisor stack. NULL if called from supervisor mode.
27 NOTES
28 The user stack must be big enough to hold all possible nestings
29 of interrupts.
31 EXAMPLE
33 BUGS
35 SEE ALSO
36 UserState(), Supervisor()
38 INTERNALS
40 HISTORY
42 ******************************************************************************/
44 #include "machine.i"
46 .text
47 .balign 4
48 .globl AROS_SLIB_ENTRY(SuperState,Exec)
49 .type AROS_SLIB_ENTRY(SuperState,Exec),@function
50 AROS_SLIB_ENTRY(SuperState,Exec):
51 push scr
52 mflr scr
53 push scr
54 /* cause a trap */
55 .global _Superstate_trp:
56 mfmsr r0
57 /* no trap? We are in usermode, so restore lr */
58 pop scr
59 mtlr scr
60 pop scr
61 /* return 0, because we are in supervisor mode */
62 li ret,0
63 /* return from this subroutine */
64 blr