setjmp.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /**
  2. * This file has no copyright assigned and is placed in the Public Domain.
  3. * This file is part of the w64 mingw-runtime package.
  4. * No warranty is given; refer to the file DISCLAIMER within this package.
  5. */
  6. #ifndef _INC_SETJMP
  7. #define _INC_SETJMP
  8. #include <_mingw.h>
  9. #pragma pack(push,_CRT_PACKING)
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. #if (defined(_X86_) && !defined(__x86_64))
  14. #define _JBLEN 16
  15. #define _JBTYPE int
  16. typedef struct __JUMP_BUFFER {
  17. unsigned long Ebp;
  18. unsigned long Ebx;
  19. unsigned long Edi;
  20. unsigned long Esi;
  21. unsigned long Esp;
  22. unsigned long Eip;
  23. unsigned long Registration;
  24. unsigned long TryLevel;
  25. unsigned long Cookie;
  26. unsigned long UnwindFunc;
  27. unsigned long UnwindData[6];
  28. } _JUMP_BUFFER;
  29. #elif defined(__ia64__)
  30. typedef _CRT_ALIGN(16) struct _SETJMP_FLOAT128 {
  31. __int64 LowPart;
  32. __int64 HighPart;
  33. } SETJMP_FLOAT128;
  34. #define _JBLEN 33
  35. typedef SETJMP_FLOAT128 _JBTYPE;
  36. typedef struct __JUMP_BUFFER {
  37. unsigned long iAReserved[6];
  38. unsigned long Registration;
  39. unsigned long TryLevel;
  40. unsigned long Cookie;
  41. unsigned long UnwindFunc;
  42. unsigned long UnwindData[6];
  43. SETJMP_FLOAT128 FltS0;
  44. SETJMP_FLOAT128 FltS1;
  45. SETJMP_FLOAT128 FltS2;
  46. SETJMP_FLOAT128 FltS3;
  47. SETJMP_FLOAT128 FltS4;
  48. SETJMP_FLOAT128 FltS5;
  49. SETJMP_FLOAT128 FltS6;
  50. SETJMP_FLOAT128 FltS7;
  51. SETJMP_FLOAT128 FltS8;
  52. SETJMP_FLOAT128 FltS9;
  53. SETJMP_FLOAT128 FltS10;
  54. SETJMP_FLOAT128 FltS11;
  55. SETJMP_FLOAT128 FltS12;
  56. SETJMP_FLOAT128 FltS13;
  57. SETJMP_FLOAT128 FltS14;
  58. SETJMP_FLOAT128 FltS15;
  59. SETJMP_FLOAT128 FltS16;
  60. SETJMP_FLOAT128 FltS17;
  61. SETJMP_FLOAT128 FltS18;
  62. SETJMP_FLOAT128 FltS19;
  63. __int64 FPSR;
  64. __int64 StIIP;
  65. __int64 BrS0;
  66. __int64 BrS1;
  67. __int64 BrS2;
  68. __int64 BrS3;
  69. __int64 BrS4;
  70. __int64 IntS0;
  71. __int64 IntS1;
  72. __int64 IntS2;
  73. __int64 IntS3;
  74. __int64 RsBSP;
  75. __int64 RsPFS;
  76. __int64 ApUNAT;
  77. __int64 ApLC;
  78. __int64 IntSp;
  79. __int64 IntNats;
  80. __int64 Preds;
  81. } _JUMP_BUFFER;
  82. #elif defined(__x86_64)
  83. typedef _CRT_ALIGN(16) struct _SETJMP_FLOAT128 {
  84. unsigned __int64 Part[2];
  85. } SETJMP_FLOAT128;
  86. #define _JBLEN 16
  87. typedef SETJMP_FLOAT128 _JBTYPE;
  88. typedef struct _JUMP_BUFFER {
  89. unsigned __int64 Frame;
  90. unsigned __int64 Rbx;
  91. unsigned __int64 Rsp;
  92. unsigned __int64 Rbp;
  93. unsigned __int64 Rsi;
  94. unsigned __int64 Rdi;
  95. unsigned __int64 R12;
  96. unsigned __int64 R13;
  97. unsigned __int64 R14;
  98. unsigned __int64 R15;
  99. unsigned __int64 Rip;
  100. unsigned __int64 Spare;
  101. SETJMP_FLOAT128 Xmm6;
  102. SETJMP_FLOAT128 Xmm7;
  103. SETJMP_FLOAT128 Xmm8;
  104. SETJMP_FLOAT128 Xmm9;
  105. SETJMP_FLOAT128 Xmm10;
  106. SETJMP_FLOAT128 Xmm11;
  107. SETJMP_FLOAT128 Xmm12;
  108. SETJMP_FLOAT128 Xmm13;
  109. SETJMP_FLOAT128 Xmm14;
  110. SETJMP_FLOAT128 Xmm15;
  111. } _JUMP_BUFFER;
  112. #endif
  113. #ifndef _JMP_BUF_DEFINED
  114. typedef _JBTYPE jmp_buf[_JBLEN];
  115. #define _JMP_BUF_DEFINED
  116. #endif
  117. void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp(void);
  118. #ifdef USE_MINGW_SETJMP_TWO_ARGS
  119. #ifndef _INC_SETJMPEX
  120. #define setjmp(BUF) _setjmp((BUF),mingw_getsp())
  121. int __cdecl __attribute__ ((__nothrow__)) _setjmp(jmp_buf _Buf,void *_Ctx);
  122. #else
  123. #undef setjmp
  124. #define setjmp(BUF) _setjmpex((BUF),mingw_getsp())
  125. #define setjmpex(BUF) _setjmpex((BUF),mingw_getsp())
  126. int __cdecl __attribute__ ((__nothrow__)) _setjmpex(jmp_buf _Buf,void *_Ctx);
  127. #endif
  128. #else
  129. #ifndef _INC_SETJMPEX
  130. #define setjmp _setjmp
  131. #endif
  132. int __cdecl __attribute__ ((__nothrow__)) setjmp(jmp_buf _Buf);
  133. #endif
  134. __declspec(noreturn) __attribute__ ((__nothrow__)) void __cdecl ms_longjmp(jmp_buf _Buf,int _Value)/* throw(...)*/;
  135. __declspec(noreturn) __attribute__ ((__nothrow__)) void __cdecl longjmp(jmp_buf _Buf,int _Value);
  136. #ifdef __cplusplus
  137. }
  138. #endif
  139. #pragma pack(pop)
  140. #endif