Add Allwinner Technology to the vendor ID list
[AROS.git] / rom / exec / supervisor.c
blobcf314d1acc808c0ddf7c769aff86b959ebcfcc97
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Supervisor() - Execute some code in a privileged environment.
6 Lang: english
7 */
9 #include <exec/alerts.h>
11 #include "exec_util.h"
13 /*****************************************************************************
15 NAME */
16 #include <proto/exec.h>
18 AROS_LH1(IPTR, Supervisor,
20 /* SYNOPSIS */
21 AROS_LHA(void *, userFunction, A5),
23 /* LOCATION */
24 struct ExecBase *, SysBase, 5, Exec)
26 /* FUNCTION
27 Supervisor will allow a short privileged instruction sequence to
28 be called from user mode. This has very few uses, and it is probably
29 better to use any system supplied method to do anything.
31 The function supplied will be called as if it was a system interrupt,
32 notably this means that you must *NOT* make any system calls or
33 use any system data structures, and on certain systems you must
34 use special methods to leave the code.
36 The code will not be passed any parameters. However it has access to all
37 CPU registers.
39 INPUTS
40 userFunction - The address of the code you want called in supervisor
41 mode.
43 RESULT
44 The code will be called.
46 NOTES
47 On some architectures this function is impossible or infeasible to implement.
48 In this case it throws a recoverable alert.
50 Currently this function works only on x86 and PowerPC native kickstarts.
52 EXAMPLE
54 BUGS
55 You can very easily make the system unusable with this function.
56 In fact it is recommended that you do not use it at all.
58 SEE ALSO
59 SuperState(), UserState()
61 INTERNALS
62 You can do what you want with this function, even ignoring it if
63 you don't think it makes any sense. But it could be quite useful
64 to make it run something under different protection levels.
66 You should trust that the programmer know what they are doing :-)
68 ******************************************************************************/
70 AROS_LIBFUNC_INIT
73 * This fallback implementation throws a recovertable alert and
74 * returns dummy value. Since we should actually call a real interrupt,
75 * there's no generic way to simulate this.
76 * See architecture-specific code for working implementations.
78 Exec_ExtAlert(ACPU_PrivErr & ~AT_DeadEnd, __builtin_return_address(0), CALLER_FRAME, 0, NULL, SysBase);
79 return 0;
81 AROS_LIBFUNC_EXIT
82 } /* Supervisor() */