fix comment
[AROS.git] / rom / exec / exception.c
blob53f398c6b5db571c882346c344f64c41ba3fe23d
1 /*
2 Copyright © 1995-2015, 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>
10 #include <exec_platform.h>
12 /*****i*************************************************************************
14 NAME */
15 #include <proto/exec.h>
17 AROS_LH0(void, Exception,
19 /* LOCATION */
20 struct ExecBase *, SysBase, 11, Exec)
22 /* FUNCTION
23 Exception handler. This function is called by the dispatcher if
24 a task exception has occured. It is called in the Disable()'d
25 state so that all signals are still unchanged.
27 TF_EXCEPT is still set and must be reset by task route.
29 The exception code is called with the following parameters:
31 A1 - Task->tc_ExceptData
32 D0 - Mask of Flags which caused task exception.
33 A6 - SysBase
35 INPUTS
37 RESULT
39 NOTES
40 This function is private. Do not call it from any program.
42 EXAMPLE
44 BUGS
46 SEE ALSO
47 Dispatch()
49 INTERNALS
50 Unlike in AmigaOS task function is called in user mode.
52 ******************************************************************************/
54 AROS_LIBFUNC_INIT
56 struct Task *task = FindTask (NULL);
57 BYTE nestCnt;
58 ULONG flags;
60 task->tc_Flags &= ~TF_EXCEPT;
62 nestCnt = IDNESTCOUNT_GET;
63 IDNESTCOUNT_SET(0);
65 while ((flags = (task->tc_SigExcept & task->tc_SigRecvd)))
67 task->tc_SigExcept ^= flags;
68 task->tc_SigRecvd ^= flags;
70 Enable();
72 /* Call the Exception */
73 if(task->tc_ExceptCode)
75 task->tc_SigExcept |= AROS_UFC3(ULONG, task->tc_ExceptCode,
76 AROS_UFCA(APTR, task->tc_ExceptData, A1),
77 AROS_UFCA(ULONG, flags, D0),
78 AROS_UFCA(struct ExecBase *, SysBase, A6));
81 Disable();
84 IDNESTCOUNT_SET(nestCnt);
86 AROS_LIBFUNC_EXIT
87 } /* Exception */