Cancel redefinition of DOSBase for the 'cdrom' test utility. Now the
[AROS.git] / rom / exec / exception.c
blob5dce565fa24ad86911788c7940f3f0f1ca7b19e4
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Exception - Perform a task exception.
6 Lang: english
7 */
8 #include <exec/execbase.h>
9 #include <aros/asmcall.h>
11 /*****i*************************************************************************
13 NAME */
14 #include <proto/exec.h>
16 AROS_LH0(void, Exception,
18 /* LOCATION */
19 struct ExecBase *, SysBase, 11, Exec)
21 /* FUNCTION
22 Exception handler. This function is called by the dispatcher if
23 a task exception has occured. It is called in the Disable()'d
24 state so that all signals are still unchanged.
26 TF_EXCEPT is still set and must be reset by task route.
28 The exception code is called with the following parameters:
30 A1 - Task->tc_ExceptData
31 D0 - Mask of Flags which caused task exception.
32 A6 - SysBase
34 INPUTS
36 RESULT
38 NOTES
39 This function is private. Do not call it from any program.
41 EXAMPLE
43 BUGS
45 SEE ALSO
46 Dispatch()
48 INTERNALS
49 Unlike in AmigaOS task function is called in user mode.
51 ******************************************************************************/
53 AROS_LIBFUNC_INIT
55 struct Task *task = FindTask (NULL);
56 BYTE nestCnt;
57 ULONG flags;
59 task->tc_Flags &= ~TF_EXCEPT;
61 nestCnt = SysBase->IDNestCnt;
62 SysBase->IDNestCnt = 0;
64 while ((flags = (task->tc_SigExcept & task->tc_SigRecvd)))
66 task->tc_SigExcept ^= flags;
67 task->tc_SigRecvd ^= flags;
69 Enable();
71 /* Call the Exception */
72 if(task->tc_ExceptCode)
74 task->tc_SigExcept |= AROS_UFC3(ULONG, task->tc_ExceptCode,
75 AROS_UFCA(APTR, task->tc_ExceptData, A1),
76 AROS_UFCA(ULONG, flags, D0),
77 AROS_UFCA(struct ExecBase *, SysBase, A6));
80 Disable();
83 SysBase->IDNestCnt = nestCnt;
85 AROS_LIBFUNC_EXIT
86 } /* Exception */