5 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
8 Desc: Task structure and constants
13 # include <exec/nodes.h>
16 # include <exec/lists.h>
19 # include <exec/ports.h>
21 #ifndef UTILITY_TAGITEM_H
22 # include <utility/tagitem.h>
25 /* You must use Exec functions to modify task structure fields. */
31 BYTE tc_IDNestCnt
; /* Interrupt disabled nesting */
32 BYTE tc_TDNestCnt
; /* Task disabled nesting */
33 ULONG tc_SigAlloc
; /* Allocated signals */
34 ULONG tc_SigWait
; /* Signals we are waiting for */
35 ULONG tc_SigRecvd
; /* Received signals */
36 ULONG tc_SigExcept
; /* Signals we will take exceptions for */
41 UWORD tc_ETrapAlloc
; /* Allocated traps */
42 UWORD tc_ETrapAble
; /* Enabled traps */
44 APTR tc_ETask
; /* Valid if TF_ETASK is set */
46 APTR tc_ExceptData
; /* Exception data */
47 APTR tc_ExceptCode
; /* Exception code */
48 APTR tc_TrapData
; /* Trap data */
49 APTR tc_TrapCode
; /* Trap code */
50 APTR tc_SPReg
; /* Stack pointer */
51 APTR tc_SPLower
; /* Stack lower bound */
52 APTR tc_SPUpper
; /* Stack upper bound */
53 VOID (* tc_Switch
)(); /* Task loses CPU */
54 VOID (* tc_Launch
)(); /* Task gets CPU */
55 struct List tc_MemEntry
; /* Allocated memory. Freed by RemTask(). */
56 APTR tc_UserData
; /* For use by the task; no restrictions! */
59 #define tc_TrapAlloc tc_UnionETask.tc_ETrap.tc_ETrapAlloc
60 #define tc_TrapAble tc_UnionETask.tc_ETrap.tc_ETrapAble
63 #define GetTrapAlloc(t) \
64 ((((struct Task *)t)->tc_Flags & TF_ETASK) ? \
65 ((struct ETask *)(((struct Task *)t)->tc_UnionETask.tc_ETask))-> \
67 ((struct Task *)t)->tc_UnionETask.tc_ETrap.tc_ETrapAlloc)
68 #define GetTrapAble(t) \
69 ((((struct Task *)t)->tc_Flags & TF_ETASK) ? \
70 ((struct ETask *)(((struct Task *)t)->tc_UnionETask.tc_ETask))-> \
72 ((struct Task *)t)->tc_UnionETask.tc_ETrap.tc_ETrapAble)
74 ((((struct Task *)t)->tc_Flags & TF_ETASK) ? \
75 ((struct ETask *)(((struct Task *)t)->tc_UnionETask.tc_ETask)) \
78 #define GetETaskID(t) \
79 ( (((struct Task *)(t))->tc_Flags & TF_ETASK) \
80 ? (((struct ETask *) \
81 (((struct Task *)(t))->tc_UnionETask.tc_ETask))->et_UniqueID) \
86 /* Stack swap structure as passed to StackSwap() */
87 struct StackSwapStruct
89 APTR stk_Lower
; /* Lowest byte of stack */
90 APTR stk_Upper
; /* Upper end of stack (size + Lowest) */
91 APTR stk_Pointer
; /* Stack pointer at switch point */
102 #define TF_PROCTIME (1L<<0)
103 #define TF_ETASK (1L<<3)
104 #define TF_STACKCHK (1L<<4)
105 #define TF_EXCEPT (1L<<5)
106 #define TF_SWITCH (1L<<6)
107 #define TF_LAUNCH (1L<<7)
109 /* Task States (tc_State) */
118 /* Predefined Signals */
121 #define SIGB_BLIT 4 /* Note: same as SIGB_SINGLE */
122 #define SIGB_SINGLE 4 /* Note: same as SIGB_BLIT */
123 #define SIGB_INTUITION 5
127 #define SIGF_ABORT (1L<<0)
128 #define SIGF_CHILD (1L<<1)
129 #define SIGF_BLIT (1L<<4)
130 #define SIGF_SINGLE (1L<<4)
131 #define SIGF_INTUITION (1L<<5)
132 #define SIGF_NET (1L<<7)
133 #define SIGF_DOS (1L<<8)
135 /* Extended Task structure */
138 struct Message et_Message
;
139 APTR et_Parent
; /* Pointer to task */
141 struct MinList et_Children
; /* List of children */
144 ULONG et_Result1
; /* First result */
145 APTR et_Result2
; /* Result data pointer (AllocVec) */
146 struct MsgPort et_TaskMsgPort
;
148 /* Internal fields follow */
151 /* Return codes from new child functions */
152 #define CHILD_NOTNEW 1 /* Function not called from a new style task */
153 #define CHILD_NOTFOUND 2 /* Child not found */
154 #define CHILD_EXITED 3 /* Child has exited */
155 #define CHILD_ACTIVE 4 /* Child is currently active and running */
157 /* Tags for NewAddTask() */
159 #define TASKTAG_Dummy (TAG_USER + 0x100000)
160 #define TASKTAG_ARG1 (TASKTAG_Dummy + 16)
161 #define TASKTAG_ARG2 (TASKTAG_Dummy + 17)
162 #define TASKTAG_ARG3 (TASKTAG_Dummy + 18)
163 #define TASKTAG_ARG4 (TASKTAG_Dummy + 19)
164 #define TASKTAG_ARG5 (TASKTAG_Dummy + 20)
165 #define TASKTAG_ARG6 (TASKTAG_Dummy + 21)
166 #define TASKTAG_ARG7 (TASKTAG_Dummy + 22)
167 #define TASKTAG_ARG8 (TASKTAG_Dummy + 23)
170 #endif /* EXEC_TASKS_H */