2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
6 /*****************************************************************************
10 AROS_LH1(ULONG, Supervisor,
13 AROS_LHA(ULONG_FUNC, userFunction, A5),
16 struct ExecBase *, SysBase, 5, Exec)
19 Call a routine in supervisor mode. This routine runs on the
20 supervisor stack and must end with a "rte". No registers are spilled,
21 i.e. Supervisor() effectively works like a function call.
24 userFunction - address of the function to be called.
27 whatever the function left in the registers
30 This function is CPU dependant.
35 Context switches that happen during the duration of this call are lost.
43 ******************************************************************************/
49 .globl AROS_SLIB_ENTRY(Supervisor,Exec)
50 .type AROS_SLIB_ENTRY(Supervisor,Exec),@function
51 AROS_SLIB_ENTRY
(Supervisor
,Exec
):
52 /* I am cheating my way through this routine, because ixemul traps all
53 exceptions. We would never be able to finish this function.
54 I need to change one register, though, because I need to get this
55 Amiga's original ExecBase. I will use register a4 for this. I also
56 assume the original Supervisor() function does not expect its SysBase
60 /* get original SysBase */
62 /* call that Supervisor() function */
65 /* Program flow will not get here */
67 /* a privileged do-nothing instruction */
69 /* No trap? Then this was called from supervisor mode. Prepare a rte. */
73 /* CPU privilege violation vector points to here */
77 /* There is only one legal location which may do a privilege
78 violation - and that is the instruction above.
80 cmp.
l #_Exec_Supervisor,2.w(sp)
82 /* All OK. Prepare returnaddress and go to the right direction. */
87 /* Store trap number */
91 /* And handle the trap */
96 /* get some room for destination address */
99 /* calculate destination address without clobbering any registers */
102 move.
l ThisTask
(a0
),a0
103 move.
l tc_TrapCode
(a0
),4(sp
)