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