2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
5 Desc: Supervisor() - Execute some code in a privileged environment.
9 /*****************************************************************************
13 AROS_LH1(void, Supervisor,
16 AROS_LHA(ULONG_FUNC, userFunction, A5),
19 struct ExecBase *, SysBase, 5, Exec)
22 Supervisor will allow a short privileged instruction sequence to
23 be called from user mode. This has very few uses, and it is probably
24 better to use any system supplied method to do anything.
26 The function supplied will be called as if it was a system interrupt,
27 notably this means that you must *NOT* make any system calls or
28 use any system data structures, and on certain systems you must
29 use special methods to leave the code.
31 The code will not be passed any parameters.
34 userFunc - The address of the code you want called in supervisor
38 The code will be called.
41 This function has completely different effects on different
42 processors and architectures.
44 Currently defined effects are:
47 -------------------------------------------------------------------
48 i386 (under emulation) Runs the function in supervisor mode.
49 The function MUST end with an IRET
50 instruction. Just like on m68k.
51 Nothing is passed via stack.
52 m68k (native) Runs the process in supervisor mode.
53 The process must end with an RTE
54 instruction. It should save any
55 registers which is uses.
56 m68k (under emulation)
57 ppc (native) Runs the function in supervisor mode.
58 There is no supervisor stack. The
59 function must return with RFS
64 You can very easily make the system unusable with this function.
65 In fact it is recommended that you do not use it at all.
68 SuperState(), UserState()
71 You can do what you want with this function, even ignoring it if
72 you don't think it makes any sense. But it could be quite useful
73 to make it run something under different protection levels.
75 You should trust that the programmer know what they are doing :-)
79 ******************************************************************************/
80 /* try to cause a trap */
81 .global _Supervisor_trp:
83 /* no exception? we are in supervisor mode so continue */