revert between 56095 -> 55830 in arch
[AROS.git] / arch / m68k-mac / exec / userstate.S
blobe6d1626e11da8ca17c23ca95662dbf7f759a2ce5
1 /*
2     Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3     $Id$
4 */
6 /*****************************************************************************
7  
8     NAME
9  
10         AROS_LH1(ULONG, UserState,
12     SYNOPSIS
13         AROS_LHA(APTR, sysStack, D0)
15     LOCATION
16         struct ExecBase *, SysBase, 26, Exec)
18     FUNCTION
19         Return to user mode after a call to SuperState().
21     INPUTS
22         sysStack    -   The return value from SuperState()
24     RESULT
25         The system will be back to normal.
27     NOTES
29     EXAMPLE
31     BUGS
33     SEE ALSO
34         SuperState(), Supervisor()
36     INTERNALS
37         Undo SuperState()
39     HISTORY
41 ******************************************************************************/
43         #include "aros/m68k/asm.h"
45         .text
46         .balign 4
47         .globl  AROS_SLIB_ENTRY(UserState,Exec,26)
49 AROS_SLIB_ENTRY(UserState,Exec,26):
50 #ifndef DoRegisterCalls
51         move.l  0x4.w,%a6      // Get SysBase
52         move.l  4(%ssp),%d0    // get sysStack
53 #endif
54         /*
55          * This is how the supervisor stack looks like (later usp)
56          *  0(%ssp)  (LONG) - return PC
57          *  4(%ssp)  (LONG) - sysStack - only there if not using register passing
58          */
59         movem.l %a1-%a2,-4(%ssp)
61         move.l  %ssp,%a2         // remember for later
63         move.l  %d0,%ssp         // load ssp with old ssp
65         lea.l   return_part,%a1
66         move.l  %a1,2(%ssp)      // store the return PC on ssp exception
67                                  // frame, keep SR untouched
68         move.l  %a2,%usp
70         movem.l -4(%a2),%a1-%a2  // restor a1/a2
72         rte  // -> should now call return_part below
74 return_part:
75         rts  // -> should lead me back to where I left off in the
76              //    program flow