Mac OS 9
MachineExceptions.h
Go to the documentation of this file.
1 
19 #ifndef __MACHINEEXCEPTIONS__
20 #define __MACHINEEXCEPTIONS__
21 
22 #ifndef __MACTYPES__
23 #include <MacTypes.h>
24 #endif
25 
26 #ifndef __MIXEDMODE__
27 #include <MixedMode.h>
28 #endif
29 
30 #if PRAGMA_ONCE
31 #pragma once
32 #endif
33 
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #endif
38 
39 #if PRAGMA_IMPORT
40 #pragma import on
41 #endif
42 
43 #if PRAGMA_STRUCT_ALIGN
44 #pragma options align = power
45 #elif PRAGMA_STRUCT_PACKPUSH
46 #pragma pack(push, 2)
47 #elif PRAGMA_STRUCT_PACK
48 #pragma pack(2)
49 #endif
50 
52  typedef struct OpaqueAreaID *AreaID;
53 #if TARGET_OS_MAC
55  struct MachineInformationPowerPC
56  {
57  UnsignedWide CTR;
58  UnsignedWide LR;
59  UnsignedWide PC;
60  unsigned long CR;
61  unsigned long XER;
62  unsigned long MSR;
63  unsigned long MQ;
64  unsigned long ExceptKind;
65  unsigned long DSISR;
66  UnsignedWide DAR;
67  UnsignedWide Reserved;
68  };
69  typedef struct MachineInformationPowerPC MachineInformationPowerPC;
70  struct RegisterInformationPowerPC
71  {
72  UnsignedWide R0;
73  UnsignedWide R1;
74  UnsignedWide R2;
75  UnsignedWide R3;
76  UnsignedWide R4;
77  UnsignedWide R5;
78  UnsignedWide R6;
79  UnsignedWide R7;
80  UnsignedWide R8;
81  UnsignedWide R9;
82  UnsignedWide R10;
83  UnsignedWide R11;
84  UnsignedWide R12;
85  UnsignedWide R13;
86  UnsignedWide R14;
87  UnsignedWide R15;
88  UnsignedWide R16;
89  UnsignedWide R17;
90  UnsignedWide R18;
91  UnsignedWide R19;
92  UnsignedWide R20;
93  UnsignedWide R21;
94  UnsignedWide R22;
95  UnsignedWide R23;
96  UnsignedWide R24;
97  UnsignedWide R25;
98  UnsignedWide R26;
99  UnsignedWide R27;
100  UnsignedWide R28;
101  UnsignedWide R29;
102  UnsignedWide R30;
103  UnsignedWide R31;
104  };
105  typedef struct RegisterInformationPowerPC RegisterInformationPowerPC;
106  struct FPUInformationPowerPC
107  {
108  UnsignedWide Registers[32];
109  unsigned long FPSCR;
110  unsigned long Reserved;
111  };
112  typedef struct FPUInformationPowerPC FPUInformationPowerPC;
113  union Vector128
114  {
115 #ifdef __VEC__
116  vector unsigned long v;
117 #endif
118  unsigned long l[4];
119  unsigned short s[8];
120  unsigned char c[16];
121  };
122  typedef union Vector128 Vector128;
123  struct VectorInformationPowerPC
124  {
125  Vector128 Registers[32];
126  Vector128 VSCR;
127  UInt32 VRsave;
128  };
129  typedef struct VectorInformationPowerPC VectorInformationPowerPC;
131  enum
132  {
133  kWriteReference = 0,
134  kReadReference = 1,
135  kFetchReference = 2,
136  writeReference = kWriteReference,
137  readReference = kReadReference,
138  fetchReference = kFetchReference
139  };
140 
141  typedef unsigned long MemoryReferenceKind;
142  struct MemoryExceptionInformation
143  {
144  AreaID theArea;
145  LogicalAddress theAddress;
146  OSStatus theError;
147  MemoryReferenceKind theReference;
148  };
149  typedef struct MemoryExceptionInformation MemoryExceptionInformation;
150  enum
151  {
152  kUnknownException = 0,
153  kIllegalInstructionException = 1,
154  kTrapException = 2,
155  kAccessException = 3,
156  kUnmappedMemoryException = 4,
157  kExcludedMemoryException = 5,
158  kReadOnlyMemoryException = 6,
159  kUnresolvablePageFaultException = 7,
160  kPrivilegeViolationException = 8,
161  kTraceException = 9,
162  kInstructionBreakpointException = 10,
163  kDataBreakpointException = 11,
164  kIntegerException = 12,
165  kFloatingPointException = 13,
166  kStackOverflowException = 14,
168  kTaskTerminationException = 15,
169  kTaskCreationException = 16,
170  kDataAlignmentException =
171  17
173  };
174 
175 #if OLDROUTINENAMES
176  enum
177  {
178  unknownException = kUnknownException,
179  illegalInstructionException =
180  kIllegalInstructionException,
181  trapException = kTrapException,
182  accessException = kAccessException,
183  unmappedMemoryException = kUnmappedMemoryException,
184  excludedMemoryException = kExcludedMemoryException,
185  readOnlyMemoryException = kReadOnlyMemoryException,
186  unresolvablePageFaultException =
187  kUnresolvablePageFaultException,
188  privilegeViolationException =
189  kPrivilegeViolationException,
190  traceException = kTraceException,
191  instructionBreakpointException =
192  kInstructionBreakpointException,
193  dataBreakpointException = kDataBreakpointException,
194  integerException = kIntegerException,
195  floatingPointException = kFloatingPointException,
196  stackOverflowException = kStackOverflowException,
197  terminationException = kTaskTerminationException,
198  kTerminationException = kTaskTerminationException
199  };
200 
201 #endif
203  typedef unsigned long ExceptionKind;
204  union ExceptionInfo
205  {
206  MemoryExceptionInformation *memoryInfo;
207  };
208  typedef union ExceptionInfo ExceptionInfo;
209  struct ExceptionInformationPowerPC
210  {
211  ExceptionKind theKind;
212  MachineInformationPowerPC *machineState;
213  RegisterInformationPowerPC *registerImage;
214  FPUInformationPowerPC *FPUImage;
215  ExceptionInfo info;
216  VectorInformationPowerPC *vectorImage;
217  };
218  typedef struct ExceptionInformationPowerPC ExceptionInformationPowerPC;
219 #if TARGET_CPU_PPC || TARGET_CPU_68K
220  typedef ExceptionInformationPowerPC ExceptionInformation;
221  typedef MachineInformationPowerPC MachineInformation;
222  typedef RegisterInformationPowerPC RegisterInformation;
223  typedef FPUInformationPowerPC FPUInformation;
224  typedef VectorInformationPowerPC VectorInformation;
225 #endif
233  typedef CALLBACK_API_C(OSStatus, ExceptionHandlerProcPtr)(
234  ExceptionInformation *theException);
235  typedef TVECTOR_UPP_TYPE(ExceptionHandlerProcPtr) ExceptionHandlerUPP;
244  ExceptionHandlerUPP
245  NewExceptionHandlerUPP(ExceptionHandlerProcPtr userRoutine);
246 #if !OPAQUE_UPP_TYPES
247  enum
248  {
249  uppExceptionHandlerProcInfo = 0x000000F1
250  };
251 #ifdef __cplusplus
252  inline ExceptionHandlerUPP
253  NewExceptionHandlerUPP(ExceptionHandlerProcPtr userRoutine)
254  {
255  return userRoutine;
256  }
257 #else
258 #define NewExceptionHandlerUPP(userRoutine) (userRoutine)
259 #endif
260 #endif
261 
270  void
271  DisposeExceptionHandlerUPP(ExceptionHandlerUPP userUPP);
272 #if !OPAQUE_UPP_TYPES
273 #ifdef __cplusplus
274  inline void DisposeExceptionHandlerUPP(ExceptionHandlerUPP) {}
275 #else
276 #define DisposeExceptionHandlerUPP(userUPP)
277 #endif
278 #endif
279 
288  OSStatus
289  InvokeExceptionHandlerUPP(ExceptionInformation *theException,
290  ExceptionHandlerUPP userUPP);
291 #if !OPAQUE_UPP_TYPES
292 #ifdef __cplusplus
293  inline OSStatus InvokeExceptionHandlerUPP(ExceptionInformation *theException,
294  ExceptionHandlerUPP userUPP)
295  {
296  return (*userUPP)(theException);
297  }
298 #else
299 #define InvokeExceptionHandlerUPP(theException, userUPP) \
300  (*userUPP)(theException)
301 #endif
302 #endif
303 
310 #if TARGET_OS_MAC && !OPAQUE_UPP_TYPES
312  typedef ExceptionHandlerProcPtr ExceptionHandlerTPP;
313 #else
315  typedef ExceptionHandlerUPP ExceptionHandlerTPP;
316 #endif
318  typedef ExceptionHandlerTPP ExceptionHandler;
328  ExceptionHandlerTPP
329  InstallExceptionHandler(ExceptionHandlerTPP theHandler);
330 
331 #endif
333 #if PRAGMA_STRUCT_ALIGN
334 #pragma options align = reset
335 #elif PRAGMA_STRUCT_PACKPUSH
336 #pragma pack(pop)
337 #elif PRAGMA_STRUCT_PACK
338 #pragma pack()
339 #endif
340 
341 #ifdef PRAGMA_IMPORT_OFF
342 #pragma import off
343 #elif PRAGMA_IMPORT
344 #pragma import reset
345 #endif
346 
347 #ifdef __cplusplus
348 }
349 #endif
350 
351 #endif
Basic Macintosh data types.
struct OpaqueAreaID * AreaID
Definition: MachineExceptions.h:52
Mixed Mode Manager Interfaces.
Definition: RAVE.h:426
Definition: MacTypes.h:110