a few more fields used by task resource, etc.
[AROS.git] / rom / exec / etask.h
blob6cc4f67700f6fa3941ab3af8c04eb6429cdb1f55
1 #ifndef _ETASK_H
2 #define _ETASK_H
4 /*
5 Copyright © 1995-2012, 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 <exec_platform.h>
17 #include "alertextra.h"
19 /* Known alert context types */
20 #define AT_NONE 0x00
21 #define AT_CPU 0x01
22 #define AT_MUNGWALL 0x02
23 #define AT_MEMORY 0x03
25 /* Alert data. Can have different contents, depending on what actually happened */
26 struct AlertContext
28 union
30 struct ExceptionContext acpu;
31 struct MungwallContext amw;
32 struct MMContext amm;
33 } u;
36 struct IntETask
38 struct ETask iet_ETask;
39 APTR iet_RT; /* Structure for resource tracking */
40 #if defined(__AROSEXEC_SMP__)
41 IPTR iet_CpuNumber; /* core this task is currently running on */
42 IPTR iet_CpuAffinity; /* bitmap of cores this task can run on */
43 #endif
44 UQUAD iet_StartTime; /* time the task was launched */
45 UQUAD iet_CpuTime; /* time the task has spent running */
46 UQUAD iet_private1;
47 ULONG iet_AlertCode; /* Alert code for crash handler */
48 UBYTE iet_AlertType; /* Type of the alert context */
49 UBYTE iet_AlertFlags; /* See below */
50 APTR iet_AlertLocation; /* Alert location for crash handler */
51 APTR iet_AlertStack; /* Frame pointer for stack backtrace */
52 struct AlertContext iet_AlertData; /* Extra data coming with the crash */
53 #ifdef DEBUG_ETASK
54 STRPTR iet_Me;
55 #endif
58 #define GetIntETask(task) ((struct IntETask *)GetETask(task))
59 #define IntETask(etask) ((struct IntETask *)(etask))
61 /* iet_AlertFlags */
62 #define AF_Alert 0x01 /* The task is in alert state */
63 #define AF_Location 0x02 /* iet_AlertLocation is filled in */
66 * This function resets crash status of the task:
67 * - AF_Alert flag serves as an actual indicator of crash status.
68 * If we enter Alert() with this flag already set, this is
69 * considered a nested alert and is directed to supervisor-mode routine.
70 * - AF_Location flag can also be set only once. It is either set explicitly
71 * before calling Alert(), or it is set by Alert() routine itself. So we clear
72 * it in order for Alert() to be able to remember it if task ever alerts again.
73 * - iet_AlertType specifies type of alert context (if any). We make sure
74 * it is clear so as next time Alert() will not display old information.
76 static inline void ResetETask(struct IntETask *etask)
78 etask->iet_AlertType = AT_NONE;
79 etask->iet_AlertFlags = 0;
82 #endif /* _ETASK_H */