2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Exception - Perform a task exception.
8 #include <exec/execbase.h>
9 #include <aros/asmcall.h>
10 #include <proto/kernel.h>
11 #include <aros/kernel.h>
12 #include <proto/arossupport.h>
17 /*****i*************************************************************************
20 #include <proto/exec.h>
22 AROS_LH0(void, Exception
,
25 struct ExecBase
*, SysBase
, 11, Exec
)
28 Exception handler. This function is called by the kernel if
29 a task exception has occured. It is called in the Disable()'d
30 state so that all signals are still unchanged.
32 TF_EXCEPT is still set and must be reset by this routine.
34 The user supplied exception code is called with the
37 D0 - Mask of Flags which caused this exception.
38 A1 - Task->tc_ExceptData
46 Exec internal function.
56 At the end of this routine we set task->tc_State to TS_EXCEPT so the
57 the kernel knows it can restore the signaled task context and set it
60 ******************************************************************************/
64 KRNWireImpl(SoftEnable
);
65 KRNWireImpl(SoftCause
);
67 struct Task
* task
= FindTask(NULL
);
71 task
->tc_Flags
&= ~TF_EXCEPT
;
73 nestCnt
= SysBase
->IDNestCnt
;
74 SysBase
->IDNestCnt
= 0;
76 if ((flags
= (task
->tc_SigExcept
& task
->tc_SigRecvd
)))
78 /* Call the Exception with the new AROS ASMCALL macros */
79 if (task
->tc_ExceptCode
!= NULL
)
81 /* Block the signals we are handling now. The exception handler
82 we are calling shall restore them.
84 task
->tc_SigExcept
^= flags
;
87 task
->tc_SigExcept
|= AROS_UFC3(ULONG
, task
->tc_ExceptCode
,
88 AROS_UFCA(ULONG
, flags
, D0
),
89 AROS_UFCA(APTR
, task
->tc_ExceptData
, A1
),
90 AROS_UFCA(struct ExecBase
*, SysBase
, A6
)
96 /* We don't have an exception handler, we shouldn't have
97 any exceptions. Clear them.
100 task
->tc_SigExcept
= 0;
104 task
->tc_State
= TS_EXCEPT
;
106 SysBase
->IDNestCnt
= nestCnt
;
108 /* Enter the kernel. We use an endless loop just in case the
109 signal handler returns us to this point for whatever reason.
113 CALLHOOKPKT(krnSoftEnableImpl
,0,0);
114 CALLHOOKPKT(krnSoftCauseImpl
,0,0);