psabiehh.inc 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2017-2018 by Jonas Maebe,
  4. member of the Free Pascal development team
  5. This file contains support for Itanium psABI EH
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {$packrecords c}
  13. const
  14. FPC_URC_NO_REASON = FPC_Unwind_Reason_Code(0);
  15. FPC_URC_OK = FPC_URC_NO_REASON;
  16. FPC_URC_FOREIGN_EXCEPTION_CAUGHT = FPC_Unwind_Reason_Code(1);
  17. {$ifndef __ARM_EABI_UNWINDER__}
  18. FPC_URC_FATAL_PHASE2_ERROR = FPC_Unwind_Reason_Code(2);
  19. FPC_URC_FATAL_PHASE1_ERROR = FPC_Unwind_Reason_Code(3);
  20. FPC_URC_NORMAL_STOP = FPC_Unwind_Reason_Code(4);
  21. FPC_URC_END_OF_STACK = FPC_Unwind_Reason_Code(5);
  22. {$endif not __ARM_EABI_UNWINDER__}
  23. FPC_URC_HANDLER_FOUND = FPC_Unwind_Reason_Code(6);
  24. FPC_URC_INSTALL_CONTEXT = FPC_Unwind_Reason_Code(7);
  25. FPC_URC_CONTINUE_UNWIND = FPC_Unwind_Reason_Code(8);
  26. {$ifdef __ARM_EABI_UNWINDER__}
  27. FPC_URC_FAILURE = FPC_Unwind_Reason_Code(9);
  28. {$endif __ARM_EABI_UNWINDER__}
  29. {$ifdef __ARM_EABI_UNWINDER__}
  30. const
  31. FPC_US_VIRTUAL_UNWIND_FRAME = FPC_Unwind_State(0);
  32. FPC_US_UNWIND_FRAME_STARTING = FPC_Unwind_State(1);
  33. FPC_US_UNWIND_FRAME_RESUME = FPC_Unwind_State(2);
  34. FPC_US_FORCE_UNWIND = FPC_Unwind_State(8);
  35. FPC_US_ACTION_MASK = FPC_Unwind_State(3);
  36. {$endif}
  37. const
  38. FPC_UA_SEARCH_PHASE = FPC_Unwind_Action(1);
  39. FPC_UA_CLEANUP_PHASE = FPC_Unwind_Action(2);
  40. FPC_UA_HANDLER_FRAME = FPC_Unwind_Action(4);
  41. FPC_UA_FORCE_UNWIND = FPC_Unwind_Action(8);
  42. FPC_UA_END_OF_STACK = FPC_Unwind_Action(16);
  43. type
  44. PFPC_Unwind_Context = ^FPC_Unwind_Context;
  45. FPC_Unwind_Context = record
  46. end;
  47. function _Unwind_RaiseException(exception_object: PFPC_Unwind_Exception): FPC_Unwind_Reason_Code; cdecl; external;
  48. procedure _Unwind_Resume(exception_object: PFPC_Unwind_Exception); compilerproc; cdecl; external;
  49. type
  50. TFPC_psabieh_exceptionClass = record
  51. case byte of
  52. 0: (u: qword); {cuint64}
  53. 1: (a: array[0..7] of AnsiChar);
  54. end;
  55. {$push}
  56. {$j-}
  57. const
  58. FPC_psabieh_exceptionClass_ID: TFPC_psabieh_exceptionClass =
  59. (a: 'FPC1PAS'#0);
  60. {$pop}
  61. {$ifdef __ARM_EABI_UNWINDER__}
  62. function _FPC_psabieh_personality_v0(state: FPC_Unwind_State; libunwind_exception: PFPC_Unwind_Exception; context: PFPC_Unwind_Context): FPC_Unwind_Reason_Code; cdecl; public;
  63. {$else}
  64. function _FPC_psabieh_personality_v0(version: longint; actions: FPC_Unwind_Action; exceptionClass: qword; libunwind_exception: PFPC_Unwind_Exception; context: PFPC_Unwind_Context): FPC_Unwind_Reason_Code; cdecl; public;
  65. {$endif}
  66. function FPC_psabi_begin_catch(exc:PFPC_Unwind_Exception): pointer; compilerproc;
  67. procedure FPC_psabi_end_catch; cdecl; compilerproc;
  68. { llvm cannot create a catch/cleanup block if there is no call inside the
  69. try block to a routine that can raise an exception. Hence, we will call
  70. a dummy routine that llvm cannot analyse for such try blocks }
  71. procedure FPC_DummyPotentialRaise;
  72. {$packrecords default}