Port the SB128 code to AROS.
[AROS.git] / rom / exec / etask.h
blob4387a37d2ad0e982fbb98342b12f101393c70515
1 #ifndef _ETASK_H
2 #define _ETASK_H
4 /*
5 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
6 $Id$
8 Desc: Internal description of the ETask structure
9 Lang: english
12 #include <exec/interrupts.h>
13 #include <exec/tasks.h>
15 #include "mungwallextra.h"
17 /* Known alert context types */
18 #define AT_NONE 0x00
19 #define AT_CPU 0x01
20 #define AT_MUNGWALL 0x02
22 /* Alert data. Can have different contents, depending on what actually happened */
23 struct AlertContext
25 union
27 struct ExceptionContext acpu;
28 struct MungwallContext amw;
29 } u;
32 struct IntETask
34 struct ETask iet_ETask;
35 #ifdef DEBUG_ETASK
36 STRPTR iet_Me;
37 #endif
38 APTR iet_RT; /* Structure for resource tracking */
39 APTR iet_Context; /* Structure to store CPU registers */
40 APTR iet_acpd; /* Structure to store shared clib's data */
41 APTR iet_startup; /* Structure to store startup code stuff */
42 UQUAD iet_CpuTime;
43 UQUAD iet_private1;
44 ULONG iet_AlertCode; /* Alert code for crash handler */
45 UBYTE iet_AlertType; /* Type of the alert context */
46 UBYTE iet_AlertFlags; /* See below */
47 APTR iet_AlertLocation; /* Alert location for crash handler */
48 APTR iet_AlertStack; /* Frame pointer for stack backtrace */
49 struct AlertContext iet_AlertData; /* Extra data coming with the crash */
52 #define GetIntETask(task) ((struct IntETask *)(((struct Task *) \
53 (task))->tc_UnionETask.tc_ETask))
54 #define IntETask(etask) ((struct IntETask *)(etask))
56 /* iet_AlertFlags */
57 #define AF_Alert 0x01 /* The task is in alert state */
58 #define AF_Location 0x02 /* iet_AlertLocation is filled in */
61 * This function resets crash status of the task:
62 * - AF_Alert flag serves as an actual indicator of crash status.
63 * If we enter Alert() with this flag already set, this is
64 * considered a nested alert and is directed to supervisor-mode routine.
65 * - AF_Location flag can also be set only once. It is either set explicitly
66 * before calling Alert(), or it is set by Alert() routine itself. So we clear
67 * it in order for Alert() to be able to remember it if task ever alerts again.
68 * - iet_AlertType specifies type of alert context (if any). We make sure
69 * it is clear so as next time Alert() will not display old information.
71 static inline void ResetETask(struct IntETask *etask)
73 etask->iet_AlertType = AT_NONE;
74 etask->iet_AlertFlags = 0;
77 #endif /* _ETASK_H */