2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: SuperState() - Switch the processor into a higher plane.
9 #include <aros/config.h>
10 #include <aros/debug.h>
11 #include <proto/kernel.h>
13 #include "exec_intern.h"
15 /*****************************************************************************
18 #include <proto/exec.h>
20 AROS_LH0(APTR
, SuperState
,
23 struct ExecBase
*, SysBase
, 25, Exec
)
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.
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().
39 This is not a good function to use, it has limited scope, and will
40 probably be even less useful in the future.
45 You can easily cause your system to cease operating normally.
48 Supervisor(), UserState()
51 For extra details see Supervisor().
53 ******************************************************************************/
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
));
71 APTR ssp
= (APTR
)Supervisor(cpu_SuperState
);
73 D(bug("[SuperState] Saved SP 0x%p\n", ssp
));