revert between 56095 -> 55830 in arch
[AROS.git] / rom / exec / etask.h
blob44ae4014cdb061dbb18d2b0b586ee7b83db39057
1 #ifndef _ETASK_H
2 #define _ETASK_H
4 /*
5 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
6 $Id$
8 Desc: Internal description of the ETask structure
9 Lang: english
12 #include <aros/config.h>
13 #include <aros/types/timespec_s.h>
15 #include <exec/interrupts.h>
16 #include <exec/tasks.h>
17 #include <devices/timer.h>
19 #include <exec_platform.h>
21 #include "alertextra.h"
23 #if defined(__AROSEXEC_SMP__)
24 #include <aros/types/spinlock_s.h>
25 #endif
27 /* Known alert context types */
28 #define AT_NONE 0x00
29 #define AT_CPU 0x01
30 #define AT_MUNGWALL 0x02
31 #define AT_MEMORY 0x03
33 /* Alert data. Can have different contents, depending on what actually happened */
34 struct AlertContext
36 union
38 struct ExceptionContext acpu;
39 struct MungwallContext amw;
40 struct MMContext amm;
41 } u;
44 struct IntETask
46 struct ETask iet_ETask;
47 APTR iet_RT; /* Structure for resource tracking */
48 struct timespec iet_StartTime; /* time the task was launched */
49 struct timespec iet_CpuTime; /* time the task has spent running */
50 ULONG iet_CpuUsage; /* CPU Usage of this task */
51 UQUAD iet_private1;
52 UQUAD iet_private2;
53 ULONG iet_AlertCode; /* Alert code for crash handler */
54 UBYTE iet_AlertType; /* Type of the alert context */
55 UBYTE iet_AlertFlags; /* See below */
56 APTR iet_AlertLocation; /* Alert location for crash handler */
57 APTR iet_AlertStack; /* Frame pointer for stack backtrace */
58 struct AlertContext iet_AlertData; /* Extra data coming with the crash */
59 #if defined(__AROSEXEC_SMP__)
60 void *iet_Session;
61 spinlock_t iet_TaskLock;
62 IPTR iet_CpuNumber; /* core this task is currently running on */
63 cpumask_t *iet_CpuAffinity; /* bitmap of cores this task can run on */
64 spinlock_t *iet_SpinLock; /* pointer to spinlock task is spinning on */
65 #endif
66 #ifdef DEBUG_ETASK
67 STRPTR iet_Me;
68 #endif
71 #define GetIntETask(task) ((struct IntETask *)GetETask(task))
72 #define IntETask(etask) ((struct IntETask *)(etask))
74 /* iet_AlertFlags */
75 #define AF_Alert 0x01 /* The task is in alert state */
76 #define AF_Location 0x02 /* iet_AlertLocation is filled in */
79 * This function resets a task's crash status:
80 * - AF_Alert flag serves as an actual indicator of crash status.
81 * If we enter Alert() with this flag already set, this is
82 * considered a nested alert and is directed to supervisor-mode routine.
83 * - AF_Location flag can also be set only once. It is either set explicitly
84 * before calling Alert(), or it is set by Alert() routine itself. So we clear
85 * it in order for Alert() to be able to remember it if task ever alerts again.
86 * - iet_AlertType specifies type of alert context (if any). We make sure
87 * it is clear so as next time Alert() will not display old information.
89 static inline void ResetETask(struct IntETask *etask)
91 etask->iet_AlertType = AT_NONE;
92 etask->iet_AlertFlags = 0;
95 #endif /* _ETASK_H */