graphics.library: MakeVPort() RastInfo based double-buffering fixes
[AROS.git] / rom / exec / superstate.c
blob07cb165f9ec47ddd008f6f0404d2e3c5c3b32e59
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: SuperState() - Switch the processor into a higher plane.
6 Lang: english
7 */
9 #include <aros/config.h>
10 #include <aros/debug.h>
11 #include <proto/kernel.h>
13 #include "exec_intern.h"
15 /*****************************************************************************
17 NAME */
18 #include <proto/exec.h>
20 AROS_LH0(APTR, SuperState,
22 /* LOCATION */
23 struct ExecBase *, SysBase, 25, Exec)
25 /* FUNCTION
26 Enter supervisor mode (like Supervisor()), but return on the user
27 stack. This will mean that the user stack variables are still there.
28 A call to UserState() will end this mode.
30 INPUTS
31 None.
33 RESULT
34 The old supervisor stack. This must be passed to UserState(). If the
35 processor was already in supervisor mode, then this function will
36 return NULL. In that case do NOT call UserState().
38 NOTES
39 This is not a good function to use, it has limited scope, and will
40 probably be even less useful in the future.
42 EXAMPLE
44 BUGS
45 You can easily cause your system to cease operating normally.
47 SEE ALSO
48 Supervisor(), UserState()
50 INTERNALS
51 For extra details see Supervisor().
53 ******************************************************************************/
55 AROS_LIBFUNC_INIT
57 #if (AROS_FLAVOUR & AROS_FLAVOUR_STANDALONE)
59 * This part works only on native AROS.
60 * Hosted ports are running in a virtual machine with only single privilege
61 * level available, so this function will simply return NULL.
62 * cpu_SuperState() is an architecture-specific helper code written in asm.
65 int super = KrnIsSuper();
67 D(bug("[SuperState] Current supervisor mode: %d\n", super));
69 if (!super)
71 APTR ssp = (APTR)Supervisor(cpu_SuperState);
73 D(bug("[SuperState] Saved SP 0x%p\n", ssp));
74 return ssp;
76 #endif
78 return NULL;
80 AROS_LIBFUNC_EXIT
81 } /* SuperState() */