Re-enabled use of AROS.Boot file due to lack of general enthusiasm for
[tangerine.git] / arch / i386-pc / exec / supervisor.c
blob68a2ecee903c7abf15d1c69ae64e2278ffaf843a
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 HISTORY
74 ******************************************************************************/
76 AROS_LIBFUNC_INIT
77 ULONG retval;
79 __asm__ __volatile__ (
80 "movl $-2,%%eax\n\t"
81 "int $0x80"
82 :"=a"(retval)
83 :"d"(userFunction)
86 return retval;
87 AROS_LIBFUNC_EXIT
88 } /* Supervisor() */