MachineExceptions.pas 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. {
  2. File: CarbonCore/MachineExceptions.h
  3. Contains: Processor Exception Handling Interfaces.
  4. The contents of this header file are deprecated.
  5. Copyright: © 1993-2011 by Apple Inc. All rights reserved.
  6. }
  7. {
  8. Modified for use with Free Pascal
  9. Version 308
  10. Please report any bugs to <[email protected]>
  11. }
  12. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  13. {$mode macpas}
  14. {$packenum 1}
  15. {$macro on}
  16. {$inline on}
  17. {$calling mwpascal}
  18. unit MachineExceptions;
  19. interface
  20. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  21. {$setc GAP_INTERFACES_VERSION := $0308}
  22. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  23. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  24. {$endc}
  25. {$ifc defined CPUPOWERPC and defined CPUI386}
  26. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  27. {$endc}
  28. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  29. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  30. {$endc}
  31. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  32. {$setc __ppc__ := 1}
  33. {$elsec}
  34. {$setc __ppc__ := 0}
  35. {$endc}
  36. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  37. {$setc __ppc64__ := 1}
  38. {$elsec}
  39. {$setc __ppc64__ := 0}
  40. {$endc}
  41. {$ifc not defined __i386__ and defined CPUI386}
  42. {$setc __i386__ := 1}
  43. {$elsec}
  44. {$setc __i386__ := 0}
  45. {$endc}
  46. {$ifc not defined __x86_64__ and defined CPUX86_64}
  47. {$setc __x86_64__ := 1}
  48. {$elsec}
  49. {$setc __x86_64__ := 0}
  50. {$endc}
  51. {$ifc not defined __arm__ and defined CPUARM}
  52. {$setc __arm__ := 1}
  53. {$elsec}
  54. {$setc __arm__ := 0}
  55. {$endc}
  56. {$ifc not defined __arm64__ and defined CPUAARCH64}
  57. {$setc __arm64__ := 1}
  58. {$elsec}
  59. {$setc __arm64__ := 0}
  60. {$endc}
  61. {$ifc defined cpu64}
  62. {$setc __LP64__ := 1}
  63. {$elsec}
  64. {$setc __LP64__ := 0}
  65. {$endc}
  66. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  67. {$error Conflicting definitions for __ppc__ and __i386__}
  68. {$endc}
  69. {$ifc defined __ppc__ and __ppc__}
  70. {$setc TARGET_CPU_PPC := TRUE}
  71. {$setc TARGET_CPU_PPC64 := FALSE}
  72. {$setc TARGET_CPU_X86 := FALSE}
  73. {$setc TARGET_CPU_X86_64 := FALSE}
  74. {$setc TARGET_CPU_ARM := FALSE}
  75. {$setc TARGET_CPU_ARM64 := FALSE}
  76. {$setc TARGET_OS_MAC := TRUE}
  77. {$setc TARGET_OS_IPHONE := FALSE}
  78. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  79. {$setc TARGET_OS_EMBEDDED := FALSE}
  80. {$elifc defined __ppc64__ and __ppc64__}
  81. {$setc TARGET_CPU_PPC := FALSE}
  82. {$setc TARGET_CPU_PPC64 := TRUE}
  83. {$setc TARGET_CPU_X86 := FALSE}
  84. {$setc TARGET_CPU_X86_64 := FALSE}
  85. {$setc TARGET_CPU_ARM := FALSE}
  86. {$setc TARGET_CPU_ARM64 := FALSE}
  87. {$setc TARGET_OS_MAC := TRUE}
  88. {$setc TARGET_OS_IPHONE := FALSE}
  89. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  90. {$setc TARGET_OS_EMBEDDED := FALSE}
  91. {$elifc defined __i386__ and __i386__}
  92. {$setc TARGET_CPU_PPC := FALSE}
  93. {$setc TARGET_CPU_PPC64 := FALSE}
  94. {$setc TARGET_CPU_X86 := TRUE}
  95. {$setc TARGET_CPU_X86_64 := FALSE}
  96. {$setc TARGET_CPU_ARM := FALSE}
  97. {$setc TARGET_CPU_ARM64 := FALSE}
  98. {$ifc defined(iphonesim)}
  99. {$setc TARGET_OS_MAC := FALSE}
  100. {$setc TARGET_OS_IPHONE := TRUE}
  101. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  102. {$elsec}
  103. {$setc TARGET_OS_MAC := TRUE}
  104. {$setc TARGET_OS_IPHONE := FALSE}
  105. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  106. {$endc}
  107. {$setc TARGET_OS_EMBEDDED := FALSE}
  108. {$elifc defined __x86_64__ and __x86_64__}
  109. {$setc TARGET_CPU_PPC := FALSE}
  110. {$setc TARGET_CPU_PPC64 := FALSE}
  111. {$setc TARGET_CPU_X86 := FALSE}
  112. {$setc TARGET_CPU_X86_64 := TRUE}
  113. {$setc TARGET_CPU_ARM := FALSE}
  114. {$setc TARGET_CPU_ARM64 := FALSE}
  115. {$ifc defined(iphonesim)}
  116. {$setc TARGET_OS_MAC := FALSE}
  117. {$setc TARGET_OS_IPHONE := TRUE}
  118. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  119. {$elsec}
  120. {$setc TARGET_OS_MAC := TRUE}
  121. {$setc TARGET_OS_IPHONE := FALSE}
  122. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  123. {$endc}
  124. {$setc TARGET_OS_EMBEDDED := FALSE}
  125. {$elifc defined __arm__ and __arm__}
  126. {$setc TARGET_CPU_PPC := FALSE}
  127. {$setc TARGET_CPU_PPC64 := FALSE}
  128. {$setc TARGET_CPU_X86 := FALSE}
  129. {$setc TARGET_CPU_X86_64 := FALSE}
  130. {$setc TARGET_CPU_ARM := TRUE}
  131. {$setc TARGET_CPU_ARM64 := FALSE}
  132. { will require compiler define when/if other Apple devices with ARM cpus ship }
  133. {$setc TARGET_OS_MAC := FALSE}
  134. {$setc TARGET_OS_IPHONE := TRUE}
  135. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  136. {$setc TARGET_OS_EMBEDDED := TRUE}
  137. {$elifc defined __arm64__ and __arm64__}
  138. {$setc TARGET_CPU_PPC := FALSE}
  139. {$setc TARGET_CPU_PPC64 := FALSE}
  140. {$setc TARGET_CPU_X86 := FALSE}
  141. {$setc TARGET_CPU_X86_64 := FALSE}
  142. {$setc TARGET_CPU_ARM := FALSE}
  143. {$setc TARGET_CPU_ARM64 := TRUE}
  144. { will require compiler define when/if other Apple devices with ARM cpus ship }
  145. {$setc TARGET_OS_MAC := FALSE}
  146. {$setc TARGET_OS_IPHONE := TRUE}
  147. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  148. {$setc TARGET_OS_EMBEDDED := TRUE}
  149. {$elsec}
  150. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  151. {$endc}
  152. {$ifc defined __LP64__ and __LP64__ }
  153. {$setc TARGET_CPU_64 := TRUE}
  154. {$elsec}
  155. {$setc TARGET_CPU_64 := FALSE}
  156. {$endc}
  157. {$ifc defined FPC_BIG_ENDIAN}
  158. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  159. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  160. {$elifc defined FPC_LITTLE_ENDIAN}
  161. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  162. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  163. {$elsec}
  164. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  165. {$endc}
  166. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  167. {$setc CALL_NOT_IN_CARBON := FALSE}
  168. {$setc OLDROUTINENAMES := FALSE}
  169. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  170. {$setc OPAQUE_UPP_TYPES := TRUE}
  171. {$setc OTCARBONAPPLICATION := TRUE}
  172. {$setc OTKERNEL := FALSE}
  173. {$setc PM_USE_SESSION_APIS := TRUE}
  174. {$setc TARGET_API_MAC_CARBON := TRUE}
  175. {$setc TARGET_API_MAC_OS8 := FALSE}
  176. {$setc TARGET_API_MAC_OSX := TRUE}
  177. {$setc TARGET_CARBON := TRUE}
  178. {$setc TARGET_CPU_68K := FALSE}
  179. {$setc TARGET_CPU_MIPS := FALSE}
  180. {$setc TARGET_CPU_SPARC := FALSE}
  181. {$setc TARGET_OS_UNIX := FALSE}
  182. {$setc TARGET_OS_WIN32 := FALSE}
  183. {$setc TARGET_RT_MAC_68881 := FALSE}
  184. {$setc TARGET_RT_MAC_CFM := FALSE}
  185. {$setc TARGET_RT_MAC_MACHO := TRUE}
  186. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  187. {$setc TYPE_BOOL := FALSE}
  188. {$setc TYPE_EXTENDED := FALSE}
  189. {$setc TYPE_LONGLONG := TRUE}
  190. uses MacTypes;
  191. {$endc} {not MACOSALLINCLUDE}
  192. {$ifc TARGET_OS_MAC}
  193. {$ALIGN POWER}
  194. { Some basic declarations used throughout the kernel }
  195. type
  196. AreaID = ^OpaqueAreaID; { an opaque type }
  197. OpaqueAreaID = record end;
  198. AreaIDPtr = ^AreaID;
  199. { Machine Dependent types for PowerPC: }
  200. { Because a number of sources do a #define CR 13 and this file contains a struct member named CR,
  201. * an obscure compilation error gets spit out. Rename the field to CRRegister. }
  202. type
  203. MachineInformationPowerPCPtr = ^MachineInformationPowerPC;
  204. MachineInformationPowerPC = record
  205. CTR: UnsignedWide;
  206. LR: UnsignedWide;
  207. PC: UnsignedWide;
  208. CRRegister: UNSIGNEDLONG; { changed from CR since some folks had a #define CR 13 in their source code}
  209. XER: UNSIGNEDLONG;
  210. MSR: UNSIGNEDLONG;
  211. MQ: UNSIGNEDLONG;
  212. ExceptKind: UNSIGNEDLONG;
  213. DSISR: UNSIGNEDLONG;
  214. DAR: UnsignedWide;
  215. Reserved: UnsignedWide;
  216. end;
  217. type
  218. RegisterInformationPowerPCPtr = ^RegisterInformationPowerPC;
  219. RegisterInformationPowerPC = record
  220. R0: UnsignedWide;
  221. R1: UnsignedWide;
  222. R2: UnsignedWide;
  223. R3: UnsignedWide;
  224. R4: UnsignedWide;
  225. R5: UnsignedWide;
  226. R6: UnsignedWide;
  227. R7: UnsignedWide;
  228. R8: UnsignedWide;
  229. R9: UnsignedWide;
  230. R10: UnsignedWide;
  231. R11: UnsignedWide;
  232. R12: UnsignedWide;
  233. R13: UnsignedWide;
  234. R14: UnsignedWide;
  235. R15: UnsignedWide;
  236. R16: UnsignedWide;
  237. R17: UnsignedWide;
  238. R18: UnsignedWide;
  239. R19: UnsignedWide;
  240. R20: UnsignedWide;
  241. R21: UnsignedWide;
  242. R22: UnsignedWide;
  243. R23: UnsignedWide;
  244. R24: UnsignedWide;
  245. R25: UnsignedWide;
  246. R26: UnsignedWide;
  247. R27: UnsignedWide;
  248. R28: UnsignedWide;
  249. R29: UnsignedWide;
  250. R30: UnsignedWide;
  251. R31: UnsignedWide;
  252. end;
  253. type
  254. FPUInformationPowerPCPtr = ^FPUInformationPowerPC;
  255. FPUInformationPowerPC = record
  256. Registers: array [0..31] of UnsignedWide;
  257. FPSCR: UNSIGNEDLONG;
  258. Reserved: UNSIGNEDLONG;
  259. end;
  260. type
  261. Vector128Ptr = ^Vector128;
  262. Vector128 = record
  263. case SInt16 of
  264. 0: (
  265. l: array [0..3] of UInt32;
  266. );
  267. 1: (
  268. s: array [0..7] of UInt16;
  269. );
  270. 2: (
  271. c: packed array [0..15] of UInt8;
  272. );
  273. end;
  274. type
  275. VectorInformationPowerPCPtr = ^VectorInformationPowerPC;
  276. VectorInformationPowerPC = record
  277. Registers: array [0..31] of Vector128;
  278. VSCR: Vector128;
  279. VRsave: UInt32;
  280. end;
  281. { Exception related declarations }
  282. const
  283. kWriteReference = 0;
  284. kReadReference = 1;
  285. kFetchReference = 2;
  286. writeReference = kWriteReference; { Obsolete name}
  287. readReference = kReadReference; { Obsolete name}
  288. fetchReference = kFetchReference; { Obsolete name}
  289. type
  290. MemoryReferenceKind = UNSIGNEDLONG;
  291. MemoryExceptionInformationPtr = ^MemoryExceptionInformation;
  292. MemoryExceptionInformation = record
  293. theArea: AreaID; { The area related to the execption, same as MPAreaID.}
  294. theAddress: LogicalAddress; { The 32-bit address of the exception.}
  295. theError: OSStatus; { See enum below.}
  296. theReference: MemoryReferenceKind; { read, write, instruction fetch.}
  297. end;
  298. const
  299. kUnknownException = 0;
  300. kIllegalInstructionException = 1;
  301. kTrapException = 2;
  302. kAccessException = 3;
  303. kUnmappedMemoryException = 4;
  304. kExcludedMemoryException = 5;
  305. kReadOnlyMemoryException = 6;
  306. kUnresolvablePageFaultException = 7;
  307. kPrivilegeViolationException = 8;
  308. kTraceException = 9;
  309. kInstructionBreakpointException = 10; { Optional}
  310. kDataBreakpointException = 11; { Optional}
  311. kIntegerException = 12;
  312. kFloatingPointException = 13;
  313. kStackOverflowException = 14; { Optional, may be implemented as kAccessException on some systems.}
  314. kTaskTerminationException = 15; { Obsolete}
  315. kTaskCreationException = 16; { Obsolete}
  316. kDataAlignmentException = 17; { May occur when a task is in little endian mode or created with kMPTaskTakesAllExceptions.}
  317. {$ifc OLDROUTINENAMES}
  318. const
  319. unknownException = kUnknownException; { Obsolete name}
  320. illegalInstructionException = kIllegalInstructionException; { Obsolete name}
  321. trapException = kTrapException; { Obsolete name}
  322. accessException = kAccessException; { Obsolete name}
  323. unmappedMemoryException = kUnmappedMemoryException; { Obsolete name}
  324. excludedMemoryException = kExcludedMemoryException; { Obsolete name}
  325. readOnlyMemoryException = kReadOnlyMemoryException; { Obsolete name}
  326. unresolvablePageFaultException = kUnresolvablePageFaultException; { Obsolete name}
  327. privilegeViolationException = kPrivilegeViolationException; { Obsolete name}
  328. traceException = kTraceException; { Obsolete name}
  329. instructionBreakpointException = kInstructionBreakpointException; { Obsolete name}
  330. dataBreakpointException = kDataBreakpointException; { Obsolete name}
  331. integerException = kIntegerException; { Obsolete name}
  332. floatingPointException = kFloatingPointException; { Obsolete name}
  333. stackOverflowException = kStackOverflowException; { Obsolete name}
  334. terminationException = kTaskTerminationException; { Obsolete name}
  335. kTerminationException = kTaskTerminationException; { Obsolete name}
  336. {$endc} {OLDROUTINENAMES}
  337. type
  338. ExceptionKind = UNSIGNEDLONG;
  339. ExceptionInfoPtr = ^ExceptionInfo;
  340. ExceptionInfo = record
  341. case SInt16 of
  342. 0: (
  343. memoryInfo: MemoryExceptionInformationPtr;
  344. );
  345. end;
  346. type
  347. ExceptionInformationPowerPCPtr = ^ExceptionInformationPowerPC;
  348. ExceptionInformationPowerPC = record
  349. theKind: ExceptionKind;
  350. machineState: MachineInformationPowerPCPtr;
  351. registerImage: RegisterInformationPowerPCPtr;
  352. FPUImage: FPUInformationPowerPCPtr;
  353. info: ExceptionInfo;
  354. vectorImage: VectorInformationPowerPCPtr;
  355. end;
  356. {$ifc TARGET_CPU_PPC or TARGET_CPU_PPC64}
  357. type
  358. ExceptionInformation = ExceptionInformationPowerPC;
  359. MachineInformation = MachineInformationPowerPC;
  360. RegisterInformation = RegisterInformationPowerPC;
  361. FPUInformation = FPUInformationPowerPC;
  362. VectorInformation = VectorInformationPowerPC;
  363. ExceptionInformationPtr = ^ExceptionInformation;
  364. MachineInformationPtr = ^MachineInformation;
  365. RegisterInformationPtr = ^RegisterInformation;
  366. FPUInformationPtr = ^FPUInformation;
  367. VectorInformationPtr = ^VectorInformation;
  368. {$endc}
  369. {$ifc TARGET_CPU_X86 or TARGET_CPU_X86_64}
  370. type
  371. Vector128intel = record
  372. case SInt16 of
  373. { requires vector support
  374. 0: (
  375. s: single_128_bit_vector
  376. );
  377. }
  378. 1: (
  379. si: array [0..3] of UInt32;
  380. );
  381. 2: (
  382. s: array [0..1] of Float64;
  383. );
  384. 3: (
  385. c: packed array [0..15] of UInt8;
  386. );
  387. end;
  388. {$endc} { TARGET_CPU_X86 or TARGET_CPU_X86_64 }
  389. {$ifc TARGET_CPU_X86}
  390. type
  391. MachineInformationIntelPtr = ^MachineInformationIntel;
  392. MachineInformationIntel = record
  393. CS: UNSIGNEDLONG;
  394. DS: UNSIGNEDLONG;
  395. SS: UNSIGNEDLONG;
  396. ES: UNSIGNEDLONG;
  397. FS: UNSIGNEDLONG;
  398. GS: UNSIGNEDLONG;
  399. EFLAGS: UNSIGNEDLONG;
  400. EIP: UNSIGNEDLONG;
  401. ExceptTrap: UNSIGNEDLONG;
  402. ExceptErr: UNSIGNEDLONG;
  403. ExceptAddr: UNSIGNEDLONG;
  404. end;
  405. type
  406. RegisterInformationIntelPtr = ^RegisterInformationIntel;
  407. RegisterInformationIntel = record
  408. EAX: UNSIGNEDLONG;
  409. EBX: UNSIGNEDLONG;
  410. ECX: UNSIGNEDLONG;
  411. EDX: UNSIGNEDLONG;
  412. ESI: UNSIGNEDLONG;
  413. EDI: UNSIGNEDLONG;
  414. EBP: UNSIGNEDLONG;
  415. ESP: UNSIGNEDLONG;
  416. end;
  417. type
  418. FPRegIntel = packed array[0..9] of UInt8;
  419. type
  420. FPUInformationIntel = record
  421. Registers: array[0..7] of FPRegIntel;
  422. Control: UInt16;
  423. Status: UInt16;
  424. Tag: UInt16;
  425. Opcode: UInt16;
  426. EIP: UInt32;
  427. DP: UInt32;
  428. DS: UInt32;
  429. end;
  430. type
  431. VectorInformationIntel = record
  432. Registers: array[0..7] of Vector128Intel;
  433. end;
  434. type
  435. MachineInformationPtr = ^MachineInformation;
  436. RegisterInformationPtr = ^RegisterInformation;
  437. FPUInformationPtr = ^FPUInformation;
  438. VectorInformationPtr = ^VectorInformation;
  439. MachineInformation = MachineInformationIntel;
  440. RegisterInformation = RegisterInformationIntel;
  441. FPUInformation = FPUInformationIntel;
  442. VectorInformation = VectorInformationIntel;
  443. {$endc} { TARGET_CPU_X86 }
  444. {$ifc TARGET_CPU_X86_64}
  445. type
  446. MachineInformationIntel64 = record
  447. CS: UNSIGNEDLONG;
  448. FS: UNSIGNEDLONG;
  449. GS: UNSIGNEDLONG;
  450. RFLAGS: UNSIGNEDLONG;
  451. RIP: UNSIGNEDLONG;
  452. ExceptTrap: UNSIGNEDLONG;
  453. ExceptErr: UNSIGNEDLONG;
  454. ExceptAddr: UNSIGNEDLONG;
  455. end;
  456. type
  457. RegisterInformationIntel64 = record
  458. RAX: UNSIGNEDLONG;
  459. RBX: UNSIGNEDLONG;
  460. RCX: UNSIGNEDLONG;
  461. RDX: UNSIGNEDLONG;
  462. RDI: UNSIGNEDLONG;
  463. RSI: UNSIGNEDLONG;
  464. RBP: UNSIGNEDLONG;
  465. RSP: UNSIGNEDLONG;
  466. R8: UNSIGNEDLONG;
  467. R9: UNSIGNEDLONG;
  468. R10: UNSIGNEDLONG;
  469. R11: UNSIGNEDLONG;
  470. R12: UNSIGNEDLONG;
  471. R13: UNSIGNEDLONG;
  472. R14: UNSIGNEDLONG;
  473. R15: UNSIGNEDLONG;
  474. end;
  475. type
  476. FPRegIntel = packed array[0..9] of UInt8;
  477. type
  478. FPUInformationIntel64 = record
  479. Registers: array[0..7] of FPRegIntel;
  480. Control: UInt16;
  481. Status: UInt16;
  482. Tag: UInt16;
  483. Opcode: UInt16;
  484. IP: UInt32;
  485. DP: UInt32;
  486. DS: UInt32;
  487. end;
  488. type
  489. VectorInformationIntel64 = record
  490. Registers: array[0..15] of Vector128Intel;
  491. end;
  492. type
  493. MachineInformationPtr = ^MachineInformation;
  494. RegisterInformationPtr = ^RegisterInformation;
  495. FPUInformationPtr = ^FPUInformation;
  496. VectorInformationPtr = ^VectorInformation;
  497. MachineInformation = MachineInformationIntel64;
  498. RegisterInformation = RegisterInformationIntel64;
  499. FPUInformation = FPUInformationIntel64;
  500. VectorInformation = VectorInformationIntel64;
  501. {$endc} { TARGET_CPU_X86_64 }
  502. {$ifc TARGET_CPU_X86 or TARGET_CPU_X86_64}
  503. type
  504. ExceptionInformationPtr = ^ExceptionInformation;
  505. ExceptionInformation = record
  506. theKind: ExceptionKind;
  507. machineState: MachineInformationPtr;
  508. registerImage: RegisterInformationPtr;
  509. FPUImage: FPUInformationPtr;
  510. info: ExceptionInfo;
  511. vectorImage: VectorInformationPtr;
  512. end;
  513. {$endc} { TARGET_CPU_X86 || TARGET_CPU_X86_64 }
  514. {
  515. Note: An ExceptionHandler is NOT a UniversalProcPtr, except in Carbon.
  516. It must be a PowerPC function pointer with NO routine descriptor,
  517. except on Carbon, where it must be a UniversalProcPtr (TPP actually)
  518. to allow the interface to work from both CFM and Mach-O.
  519. }
  520. type
  521. ExceptionHandlerProcPtr = function( var theException: ExceptionInformation ): OSStatus;
  522. ExceptionHandlerUPP = ExceptionHandlerProcPtr;
  523. {
  524. * NewExceptionHandlerUPP()
  525. *
  526. * Availability:
  527. * Mac OS X: in version 10.0 and later in CoreServices.framework
  528. * CarbonLib: in CarbonLib 1.1 and later
  529. * Non-Carbon CFM: available as macro/inline
  530. }
  531. function NewExceptionHandlerUPP( userRoutine: ExceptionHandlerProcPtr ): ExceptionHandlerUPP; external name '_NewExceptionHandlerUPP';
  532. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  533. {
  534. * DisposeExceptionHandlerUPP()
  535. *
  536. * Availability:
  537. * Mac OS X: in version 10.0 and later in CoreServices.framework
  538. * CarbonLib: in CarbonLib 1.1 and later
  539. * Non-Carbon CFM: available as macro/inline
  540. }
  541. procedure DisposeExceptionHandlerUPP( userUPP: ExceptionHandlerUPP ); external name '_DisposeExceptionHandlerUPP';
  542. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  543. {
  544. * InvokeExceptionHandlerUPP()
  545. *
  546. * Availability:
  547. * Mac OS X: in version 10.0 and later in CoreServices.framework
  548. * CarbonLib: in CarbonLib 1.1 and later
  549. * Non-Carbon CFM: available as macro/inline
  550. }
  551. function InvokeExceptionHandlerUPP( var theException: ExceptionInformation; userUPP: ExceptionHandlerUPP ): OSStatus; external name '_InvokeExceptionHandlerUPP';
  552. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  553. {
  554. ExceptionHandler function pointers (TPP):
  555. on classic PowerPC, use raw function pointers
  556. on classic PowerPC with OPAQUE_UPP_TYPES=1, use UPP's
  557. on Carbon, use UPP's
  558. }
  559. { use UPP's}
  560. type
  561. ExceptionHandlerTPP = ExceptionHandlerUPP;
  562. ExceptionHandler = ExceptionHandlerTPP;
  563. { Routine for installing per-process exception handlers }
  564. {
  565. * InstallExceptionHandler()
  566. *
  567. * Availability:
  568. * Mac OS X: in version 10.0 and later in CoreServices.framework
  569. * CarbonLib: in CarbonLib 1.1 and later
  570. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  571. }
  572. function InstallExceptionHandler( theHandler: ExceptionHandlerTPP ): ExceptionHandlerTPP; external name '_InstallExceptionHandler';
  573. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  574. {$endc} {TARGET_OS_MAC}
  575. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  576. end.
  577. {$endc} {not MACOSALLINCLUDE}