config/make.tmpl(%build_module): Support use of _rel libs in uselibs=
[AROS.git] / arch / ppc-chrp / exec / supervisor.c
blobfb5340bc643217fa77eb3dce98fe3b6db454586b
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Supervisor() - Execute some code in a priviledged environment.
6 Lang: english
7 */
9 /*****************************************************************************
11 NAME */
12 #include <proto/exec.h>
14 AROS_LH1(ULONG, Supervisor,
16 /* SYNOPSIS */
17 AROS_LHA(ULONG_FUNC, userFunction, A5),
19 /* LOCATION */
20 struct ExecBase *, SysBase, 5, Exec)
22 /* FUNCTION
23 Supervisor will allow a short priviledged instruction sequence to
24 be called from user mode. This has very few uses, and it is probably
25 better to use any system supplied method to do anything.
27 The function supplied will be called as if it was a system interrupt,
28 notably this means that you must *NOT* make any system calls or
29 use any system data structures, and on certain systems you must
30 use special methods to leave the code.
32 The code will not be passed any parameters.
34 INPUTS
35 userFunc - The address of the code you want called in supervisor
36 mode.
38 RESULT
39 The code will be called.
41 NOTES
42 This function has completely different effects on different
43 processors and architectures.
45 Currently defined effects are:
47 Kernel Effect
48 -------------------------------------------------------------------
49 i386 (under emulation) None
50 m68k (native) Runs the process in supervisor mode.
51 The process must end with an RTE
52 instruction. It should save any
53 registers which is uses.
54 m68k (under emulation)
56 EXAMPLE
58 BUGS
59 You can very easily make the system unusable with this function.
60 In fact it is recommended that you do not use it at all.
62 SEE ALSO
63 SuperState(), UserState()
65 INTERNALS
66 You can do what you want with this function, even ignoring it if
67 you don't think it makes any sense. But it could be quite useful
68 to make it run something under different protection levels.
70 You should trust that the programmer know what they are doing :-)
72 ******************************************************************************/
74 AROS_LIBFUNC_INIT
76 register ULONG retval;
77 register APTR stack;
79 stack = SuperState();
81 retval = (*userFunction)();
83 UserState(stack);
85 return retval;
87 AROS_LIBFUNC_EXIT
88 } /* Supervisor() */