revert between 56095 -> 55830 in arch
[AROS.git] / arch / .unmaintained / m68k-emul / exception.s
blob34d7a1ffe84d9f9a7fe02538e253d026a4b739d6
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Exec function Exception
6 Lang: english
7 */
9 /******************************************************************************
11 NAME
12 AROS_LH0(void, Exception,
14 LOCATION
15 struct ExecBase *, SysBase, 11, Exec)
17 FUNCTION
19 INPUTS
21 RESULT
23 NOTES
25 EXAMPLE
27 BUGS
29 SEE ALSO
31 INTERNALS
33 HISTORY
35 ******************************************************************************/
37 #include "machine.i"
39 .text
40 .balign 16
41 .globl AROS_SLIB_ENTRY(Exception,Exec)
42 .type AROS_SLIB_ENTRY(Exception,Exec),@function
43 AROS_SLIB_ENTRY(Exception,Exec):
44 movem.l %a2/%a6/%d2,-(%sp)
45 /* First clear task exception bit. */
46 #if !UseRegisterArgs
47 move.l 16(%sp),%a6
48 #endif
49 move.l ThisTask(%a6),%a2
50 bclr #TB_EXCEPT,tc_Flags(%a2)
52 /* If the exception is raised out of Wait IDNestCnt may be >0 */
53 move.b IDNestCnt(%a6),%d2
54 /* Set it to a defined value */
55 clr.b IDNestCnt(%a6)
57 .exloop: /* Get mask of signals causing the exception */
58 move.l tc_SigExcept(%a2),%d0
59 and.l tc_SigRecvd(%a2),%d0
60 jbeq .excend
62 /* Clear bits */
63 eor.l %d0,tc_SigExcept(%a2)
64 eor.l %d0,tc_SigRecvd(%a2)
66 /* Raise exception. Enable Interrupts */
67 move.l tc_ExceptData(%a2),%a1
68 #if !UseRegisterArgs
69 move.l %a6,-(%sp)
70 #endif
71 jsr Enable(%a6)
72 #if !UseRegisterArgs
73 move.l %a6,-(%sp)
74 move.l %a1,-(%sp)
75 move.l %d0,-(%sp)
76 #endif
77 move.l tc_ExceptCode(%a2),%a0
78 jsr (%a0)
79 #if !UseRegisterArgs
80 move.l %a6,-(%sp)
81 #endif
82 jsr Disable(%a6)
83 #if !UseRegisterArgs
84 add.w #20,%sp
85 #endif
87 /* Re-use returned bits */
88 or.l %d0,tc_SigExcept(%a2)
89 jbra .exloop
91 .excend: /* Restore IDNestCnt and return */
92 move.b %d2,IDNestCnt(%a6)
93 movem.l (%sp)+,%a2/%a6/%d2
94 rts