2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
6 #include <exec/alerts.h>
7 #include <exec/types.h>
8 #include <exec/execbase.h>
9 #include <exec/interrupts.h>
10 #include <exec/tasks.h>
11 #include <dos/dosextens.h>
12 #include <graphics/clip.h>
18 #include "exec_intern.h"
20 #include "kernel_base.h"
21 #include "kernel_intern.h"
23 /* m68k relative addresses must *not* start with a '#' */
24 #define DEFINE(sym, val) \
25 asm volatile("\n#define " #sym " %c0 ": : "i" (val))
27 #define DEFINE(sym, val) \
28 asm volatile("\n#define " #sym " %0 ": : "i" (val))
31 #define FuncOffset(x) (long)__AROS_GETJUMPVEC(0,x)
34 asm volatile("\n/* Macros */" ::);
36 asm volatile("\n#define AROS_CSYMNAME(n) n\n" ::);
37 asm volatile("\n#define AROS_CDEFNAME(n) n\n" ::);
38 asm volatile("\n#define AROS_SLIB_ENTRY(n,s,o) s ## _ ## o ## _ ## n\n" ::);
40 asm volatile("\n#define _FUNCTION(n) .type n,@function" ::);
41 asm volatile("\n#define _ALIGNMENT .balign %0" :: "i" (AROS_WORSTALIGN
));
43 asm volatile("\n/* ExecBase */" ::);
44 DEFINE(AttnResched
, offsetof (struct ExecBase
, AttnResched
));
45 DEFINE(AttnFlags
, offsetof (struct ExecBase
, AttnFlags
));
46 DEFINE(IDNestCnt
, offsetof (struct ExecBase
, IDNestCnt
));
47 DEFINE(TDNestCnt
, offsetof (struct ExecBase
, TDNestCnt
));
48 DEFINE(TaskReady
, offsetof (struct ExecBase
, TaskReady
));
49 DEFINE(ThisTask
, offsetof (struct ExecBase
, ThisTask
));
50 DEFINE(SysFlags
, offsetof (struct ExecBase
, SysFlags
));
51 DEFINE(IdleCount
, offsetof (struct ExecBase
, IdleCount
));
52 DEFINE(DispCount
, offsetof (struct ExecBase
, DispCount
));
53 DEFINE(Quantum
, offsetof (struct ExecBase
, Quantum
));
54 DEFINE(Elapsed
, offsetof (struct ExecBase
, Elapsed
));
55 DEFINE(SysStkUpper
, offsetof (struct ExecBase
, SysStkUpper
));
57 asm volatile("\n/* struct Task */" ::);
58 DEFINE(tc_State
, offsetof (struct Task
, tc_State
));
59 DEFINE(tc_Flags
, offsetof (struct Task
, tc_Flags
));
60 DEFINE(tc_ExceptCode
, offsetof (struct Task
, tc_ExceptCode
));
61 DEFINE(tc_ExceptData
, offsetof (struct Task
, tc_ExceptData
));
62 DEFINE(tc_SigExcept
, offsetof (struct Task
, tc_SigExcept
));
63 DEFINE(tc_SigRecvd
, offsetof (struct Task
, tc_SigRecvd
));
64 DEFINE(tc_Launch
, offsetof (struct Task
, tc_Launch
));
65 DEFINE(tc_Switch
, offsetof (struct Task
, tc_Switch
));
66 DEFINE(tc_SPReg
, offsetof (struct Task
, tc_SPReg
));
67 DEFINE(tc_SPLower
, offsetof (struct Task
, tc_SPLower
));
68 DEFINE(tc_SPUpper
, offsetof (struct Task
, tc_SPUpper
));
69 DEFINE(tc_IDNestCnt
, offsetof (struct Task
, tc_IDNestCnt
));
70 DEFINE(tc_ETask
, offsetof (struct Task
, tc_UnionETask
.tc_ETask
));
72 asm volatile("\n/* struct ETask */" ::);
73 DEFINE(et_TaskStorage
, offsetof (struct ETask
, et_TaskStorage
));
75 asm volatile("\n/* struct Process */" ::);
76 DEFINE(pr_CES
, offsetof (struct Process
, pr_CES
));
77 DEFINE(pr_CIS
, offsetof (struct Process
, pr_CIS
));
78 DEFINE(pr_CLI
, offsetof (struct Process
, pr_CLI
));
79 DEFINE(pr_COS
, offsetof (struct Process
, pr_COS
));
80 DEFINE(pr_CurrentDir
, offsetof (struct Process
, pr_CurrentDir
));
81 DEFINE(pr_ConsoleTask
, offsetof (struct Process
, pr_ConsoleTask
));
82 DEFINE(pr_FileSystemTask
, offsetof (struct Process
, pr_FileSystemTask
));
83 DEFINE(pr_MsgPort
, offsetof (struct Process
, pr_MsgPort
));
84 DEFINE(pr_Result2
, offsetof (struct Process
, pr_Result2
));
85 DEFINE(pr_ReturnAddr
, offsetof (struct Process
, pr_ReturnAddr
));
86 DEFINE(pr_SegList
, offsetof (struct Process
, pr_SegList
));
87 DEFINE(pr_WindowPtr
, offsetof (struct Process
, pr_WindowPtr
));
89 asm volatile("\n/* struct DosBase */" ::);
90 DEFINE(dl_Root
, offsetof (struct DosLibrary
, dl_Root
));
91 DEFINE(dl_TimeReq
, offsetof (struct DosLibrary
, dl_TimeReq
));
92 DEFINE(dl_UtilityBase
, offsetof (struct DosLibrary
, dl_UtilityBase
));
93 DEFINE(dl_IntuitionBase
, offsetof (struct DosLibrary
, dl_IntuitionBase
));
95 asm volatile("\n/* struct DosPacket */" ::);
96 DEFINE(dp_Link
, offsetof (struct DosPacket
, dp_Link
));
97 DEFINE(dp_Port
, offsetof (struct DosPacket
, dp_Port
));
98 DEFINE(dp_Type
, offsetof (struct DosPacket
, dp_Type
));
99 DEFINE(dp_Res1
, offsetof (struct DosPacket
, dp_Res1
));
100 DEFINE(dp_Res2
, offsetof (struct DosPacket
, dp_Res2
));
101 DEFINE(dp_Arg1
, offsetof (struct DosPacket
, dp_Arg1
));
102 DEFINE(dp_Arg2
, offsetof (struct DosPacket
, dp_Arg2
));
103 DEFINE(dp_Arg3
, offsetof (struct DosPacket
, dp_Arg3
));
104 DEFINE(dp_Arg4
, offsetof (struct DosPacket
, dp_Arg4
));
105 DEFINE(dp_Arg5
, offsetof (struct DosPacket
, dp_Arg5
));
106 DEFINE(dp_Arg6
, offsetof (struct DosPacket
, dp_Arg6
));
107 DEFINE(dp_Arg7
, offsetof (struct DosPacket
, dp_Arg7
));
109 asm volatile("\n/* struct FileHandle */" ::);
110 DEFINE(fh_Flags
, offsetof (struct FileHandle
, fh_Flags
));
111 DEFINE(fh_Interactive
, offsetof (struct FileHandle
, fh_Interactive
));
112 DEFINE(fh_Type
, offsetof (struct FileHandle
, fh_Type
));
113 DEFINE(fh_Buf
, offsetof (struct FileHandle
, fh_Buf
));
114 DEFINE(fh_Pos
, offsetof (struct FileHandle
, fh_Pos
));
115 DEFINE(fh_End
, offsetof (struct FileHandle
, fh_End
));
117 asm volatile("\n/* struct IORequest */" ::);
118 DEFINE(io_Message
, offsetof (struct IORequest
, io_Message
));
119 DEFINE(io_Device
, offsetof (struct IORequest
, io_Device
));
120 DEFINE(io_Unit
, offsetof (struct IORequest
, io_Unit
));
121 DEFINE(io_Command
, offsetof (struct IORequest
, io_Command
));
122 DEFINE(io_Flags
, offsetof (struct IORequest
, io_Flags
));
123 DEFINE(io_Error
, offsetof (struct IORequest
, io_Error
));
125 asm volatile("\n/* struct timerequest */" ::);
126 DEFINE(tr_time
, offsetof (struct timerequest
, tr_time
));
128 asm volatile("\n/* struct MsgPort */" ::);
129 DEFINE(mp_SigTask
, offsetof (struct MsgPort
, mp_SigTask
));
131 asm volatile("\n/* struct StackSwapStruct */" ::);
132 DEFINE(stk_Lower
, offsetof (struct StackSwapStruct
, stk_Lower
));
133 DEFINE(stk_Upper
, offsetof (struct StackSwapStruct
, stk_Upper
));
134 DEFINE(stk_Pointer
, offsetof (struct StackSwapStruct
, stk_Pointer
));
136 asm volatile("\n/* struct Layer */" ::);
137 DEFINE(ly_Lock
, offsetof (struct Layer
, Lock
));
139 asm volatile("\n/* Task Flags */" ::);
140 DEFINE(TS_RUN
, TS_RUN
);
141 DEFINE(TS_READY
, TS_READY
);
142 DEFINE(TF_STACKCHK
, TF_STACKCHK
);
143 DEFINE(TF_EXCEPT
, TF_EXCEPT
);
144 DEFINE(TF_SWITCH
, TF_SWITCH
);
145 DEFINE(TF_LAUNCH
, TF_LAUNCH
);
147 asm volatile("\n/* Exec Flags */" ::);
148 DEFINE(AFF_FPU
, AFF_FPU
);
150 asm volatile("\n/* Exec functions */" ::);
151 DEFINE(Supervisor
, FuncOffset (5));
152 DEFINE(Reschedule
, FuncOffset (8));
153 DEFINE(Switch
, FuncOffset (9));
154 DEFINE(Dispatch
, FuncOffset (10));
155 DEFINE(Exception
, FuncOffset (11));
156 DEFINE(Alert
, FuncOffset (18));
157 DEFINE(Disable
, FuncOffset (20));
158 DEFINE(Enable
, FuncOffset (21));
159 DEFINE(Enqueue
, FuncOffset (45));
160 DEFINE(FindTask
, FuncOffset (49));
161 DEFINE(ObtainSemaphore
, FuncOffset (94));
162 DEFINE(ReleaseSemaphore
, FuncOffset (95));
163 DEFINE(AttemptSemaphore
, FuncOffset (96));
164 DEFINE(StackSwap
, FuncOffset (122));
166 asm volatile("\n/* Constants */" ::);
167 DEFINE(AT_DeadEnd
, AT_DeadEnd
);
168 DEFINE(AN_StackProbe
, AN_StackProbe
);
170 DEFINE(ln_Succ
, offsetof (struct Node
, ln_Succ
));
171 DEFINE(ln_Pred
, offsetof (struct Node
, ln_Pred
));
172 DEFINE(ln_Pri
, offsetof (struct Node
, ln_Pri
));
173 DEFINE(ln_Name
, offsetof (struct Node
, ln_Name
));
175 DEFINE(lh_Head
, offsetof (struct List
, lh_Head
));
176 DEFINE(lh_TailPred
, offsetof (struct List
, lh_TailPred
));
178 asm volatile("\n/* CPU context */" ::);
180 DEFINE(ECF_SEGMENTS
, ECF_SEGMENTS
);
182 DEFINE(Flags
, offsetof(struct ExceptionContext
, Flags
));
183 DEFINE(reg_ds
, offsetof(struct ExceptionContext
, ds
));
184 DEFINE(reg_es
, offsetof(struct ExceptionContext
, es
));
185 DEFINE(reg_fs
, offsetof(struct ExceptionContext
, fs
));
186 DEFINE(reg_gs
, offsetof(struct ExceptionContext
, gs
));
189 DEFINE(ECF_SEGMENTS
, ECF_SEGMENTS
);
191 DEFINE(Flags
, offsetof(struct ExceptionContext
, Flags
));
192 DEFINE(reg_ds
, offsetof(struct ExceptionContext
, ds
));
193 DEFINE(reg_es
, offsetof(struct ExceptionContext
, es
));
194 DEFINE(reg_fs
, offsetof(struct ExceptionContext
, fs
));
195 DEFINE(reg_gs
, offsetof(struct ExceptionContext
, gs
));
198 DEFINE(eb_KernelBase
, offsetof(struct IntExecBase
, KernelBase
));
199 DEFINE(kb_PlatformData
, offsetof(struct KernelBase
, kb_PlatformData
));
200 DEFINE(MMU_Level_A
, offsetof(struct PlatformData
, MMU_Level_A
));
201 DEFINE(zeropagedescriptor
, offsetof(struct PlatformData
, zeropagedescriptor
));
202 DEFINE(cachemodestore
, offsetof(struct PlatformData
, cachemodestore
));
206 asm volatile("\n#define UseExecstubs 1" ::);
209 asm volatile("\n/* jmp_buf */" ::);
210 DEFINE(jmpbuf_SIZEOF
, sizeof(jmp_buf));
211 DEFINE(retaddr
, offsetof(struct __jmp_buf
, retaddr
));