Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

352 lines
7.5 KiB

  1. /***
  2. *setjmp.h - definitions/declarations for setjmp/longjmp routines
  3. *
  4. * Copyright (c) 1985-1995, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This file defines the machine-dependent buffer used by
  8. * setjmp/longjmp to save and restore the program state, and
  9. * declarations for those routines.
  10. * [ANSI/System V]
  11. *
  12. * [Public]
  13. *
  14. ****/
  15. #ifndef _INC_SETJMP
  16. #define _INC_SETJMP
  17. #if !defined(_WIN32) && !defined(_MAC)
  18. #error ERROR: Only Mac or Win32 targets supported!
  19. #endif
  20. #ifdef _MSC_VER
  21. /*
  22. * Currently, all MS C compilers for Win32 platforms default to 8 byte
  23. * alignment.
  24. */
  25. #pragma pack(push,8)
  26. #endif /* _MSC_VER */
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  31. #ifndef _CRTAPI1
  32. #if _MSC_VER >= 800 && _M_IX86 >= 300
  33. #define _CRTAPI1 __cdecl
  34. #else
  35. #define _CRTAPI1
  36. #endif
  37. #endif
  38. /* Define _CRTAPI2 (for compatibility with the NT SDK) */
  39. #ifndef _CRTAPI2
  40. #if _MSC_VER >= 800 && _M_IX86 >= 300
  41. #define _CRTAPI2 __cdecl
  42. #else
  43. #define _CRTAPI2
  44. #endif
  45. #endif
  46. /* Define _CRTIMP */
  47. #ifndef _CRTIMP
  48. #ifdef _NTSDK
  49. /* definition compatible with NT SDK */
  50. #define _CRTIMP
  51. #else /* ndef _NTSDK */
  52. /* current definition */
  53. #ifdef _DLL
  54. #define _CRTIMP __declspec(dllimport)
  55. #else /* ndef _DLL */
  56. #define _CRTIMP
  57. #endif /* _DLL */
  58. #endif /* _NTSDK */
  59. #endif /* _CRTIMP */
  60. /* Define __cdecl for non-Microsoft compilers */
  61. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  62. #define __cdecl
  63. #endif
  64. /*
  65. * Definitions specific to particular setjmp implementations.
  66. */
  67. #if defined(_M_IX86)
  68. /*
  69. * MS compiler for x86
  70. */
  71. #ifndef _INC_SETJMPEX
  72. #define setjmp _setjmp
  73. #endif
  74. #define _JBLEN 16
  75. #define _JBTYPE int
  76. /*
  77. * Define jump buffer layout for x86 setjmp/longjmp.
  78. */
  79. typedef struct __JUMP_BUFFER {
  80. unsigned long Ebp;
  81. unsigned long Ebx;
  82. unsigned long Edi;
  83. unsigned long Esi;
  84. unsigned long Esp;
  85. unsigned long Eip;
  86. unsigned long Registration;
  87. unsigned long TryLevel;
  88. unsigned long Cookie;
  89. unsigned long UnwindFunc;
  90. unsigned long UnwindData[6];
  91. } _JUMP_BUFFER;
  92. #elif defined(_M_MRX000)
  93. #ifndef _INC_SETJMPEX
  94. #define setjmp _setjmp
  95. #endif
  96. /*
  97. * All MIPS implementations need _JBLEN of 16
  98. */
  99. #define _JBLEN 16
  100. #define _JBTYPE double
  101. /*
  102. * Define jump buffer layout for MIPS setjmp/longjmp.
  103. */
  104. typedef struct __JUMP_BUFFER {
  105. unsigned long FltF20;
  106. unsigned long FltF21;
  107. unsigned long FltF22;
  108. unsigned long FltF23;
  109. unsigned long FltF24;
  110. unsigned long FltF25;
  111. unsigned long FltF26;
  112. unsigned long FltF27;
  113. unsigned long FltF28;
  114. unsigned long FltF29;
  115. unsigned long FltF30;
  116. unsigned long FltF31;
  117. unsigned long IntS0;
  118. unsigned long IntS1;
  119. unsigned long IntS2;
  120. unsigned long IntS3;
  121. unsigned long IntS4;
  122. unsigned long IntS5;
  123. unsigned long IntS6;
  124. unsigned long IntS7;
  125. unsigned long IntS8;
  126. unsigned long IntSp;
  127. unsigned long Type;
  128. unsigned long Fir;
  129. } _JUMP_BUFFER;
  130. #elif defined(_M_ALPHA)
  131. /*
  132. * The Alpha C8/GEM C compiler uses an intrinsic _setjmp.
  133. * The Alpha acc compiler implements setjmp as a function.
  134. */
  135. #ifdef _MSC_VER
  136. #ifndef _INC_SETJMPEX
  137. #define setjmp _setjmp
  138. #endif
  139. #endif
  140. /*
  141. * Alpha implementations use a _JBLEN of 24 quadwords.
  142. * A double is used only to obtain quadword size and alignment.
  143. */
  144. #define _JBLEN 24
  145. #define _JBTYPE double
  146. /*
  147. * Define jump buffer layout for Alpha setjmp/longjmp.
  148. * A double is used only to obtain quadword size and alignment.
  149. */
  150. typedef struct __JUMP_BUFFER {
  151. unsigned long Fp;
  152. unsigned long Pc;
  153. unsigned long Seb;
  154. unsigned long Type;
  155. double FltF2;
  156. double FltF3;
  157. double FltF4;
  158. double FltF5;
  159. double FltF6;
  160. double FltF7;
  161. double FltF8;
  162. double FltF9;
  163. double IntS0;
  164. double IntS1;
  165. double IntS2;
  166. double IntS3;
  167. double IntS4;
  168. double IntS5;
  169. double IntS6;
  170. double IntSp;
  171. double Fir;
  172. double Fill[5];
  173. } _JUMP_BUFFER;
  174. #elif defined(_M_PPC)
  175. /*
  176. * The Microsoft VC++ V4.0 compiler uses an intrinsic _setjmp.
  177. * The Motorola C8.5 compiler implements setjmp as a function.
  178. */
  179. #if _MSC_VER > 850
  180. #ifndef _INC_SETJMPEX
  181. #undef _setjmp
  182. #define setjmp _setjmp
  183. #endif
  184. #endif
  185. /*
  186. * Min length is 240 bytes; round to 256 bytes.
  187. * Since this is allocated as an array of "double", the
  188. * number of entries required is 32.
  189. *
  190. * All PPC implementations need _JBLEN of 32
  191. */
  192. #define _JBLEN 32
  193. #define _JBTYPE double
  194. /*
  195. * Define jump buffer layout for PowerPC setjmp/longjmp.
  196. */
  197. typedef struct __JUMP_BUFFER {
  198. double Fpr14;
  199. double Fpr15;
  200. double Fpr16;
  201. double Fpr17;
  202. double Fpr18;
  203. double Fpr19;
  204. double Fpr20;
  205. double Fpr21;
  206. double Fpr22;
  207. double Fpr23;
  208. double Fpr24;
  209. double Fpr25;
  210. double Fpr26;
  211. double Fpr27;
  212. double Fpr28;
  213. double Fpr29;
  214. double Fpr30;
  215. double Fpr31;
  216. unsigned long Gpr1;
  217. unsigned long Gpr2;
  218. unsigned long Gpr13;
  219. unsigned long Gpr14;
  220. unsigned long Gpr15;
  221. unsigned long Gpr16;
  222. unsigned long Gpr17;
  223. unsigned long Gpr18;
  224. unsigned long Gpr19;
  225. unsigned long Gpr20;
  226. unsigned long Gpr21;
  227. unsigned long Gpr22;
  228. unsigned long Gpr23;
  229. unsigned long Gpr24;
  230. unsigned long Gpr25;
  231. unsigned long Gpr26;
  232. unsigned long Gpr27;
  233. unsigned long Gpr28;
  234. unsigned long Gpr29;
  235. unsigned long Gpr30;
  236. unsigned long Gpr31;
  237. unsigned long Cr;
  238. unsigned long Iar;
  239. unsigned long Type;
  240. } _JUMP_BUFFER;
  241. #elif defined(_M_M68K)
  242. #ifndef _INC_SETJMPEX
  243. #define setjmp _setjmp
  244. #endif
  245. /* internal only for version checking for compatibility */
  246. #define _SETJMP_VER 1.0
  247. /* internal only, jump buffer layout definition */
  248. typedef struct __JUMP_BUFFER {
  249. unsigned long d1; /* 0x00, saved */
  250. unsigned long d2; /* 0x04, saved */
  251. unsigned long d3; /* 0x08, saved */
  252. unsigned long d4; /* 0x0c, saved */
  253. unsigned long d5; /* 0x10, saved */
  254. unsigned long d6; /* 0x14, saved */
  255. unsigned long d7; /* 0x18, saved */
  256. unsigned long a1; /* 0x1c, non-swappable version: return address,
  257. swappable version: swapper lib routine pointer for building return address */
  258. unsigned long a2; /* 0x20, saved */
  259. unsigned long a3; /* 0x24, saved */
  260. unsigned long a4; /* 0x28, saved */
  261. unsigned long a6; /* 0x2c, saved */
  262. unsigned long a7; /* 0x30, saved */
  263. unsigned long SwapChain; /* 0x34, without swapper: unused. with swapper: link swappable frames */
  264. unsigned short reserved; /* 0x38, unused */
  265. unsigned short SN; /* 0x3a, swappable version: segment number */
  266. unsigned long BPC; /* 0x3c, swappable version: offset within segment */
  267. } _JUMP_BUFFER;
  268. #define _JBTYPE int
  269. #define _JBLEN (sizeof(_JUMP_BUFFER)/sizeof(_JBTYPE))
  270. #elif defined(_M_MPPC)
  271. #ifndef _INC_SETJMPEX
  272. #define setjmp _setjmp
  273. #endif
  274. #define _JBTYPE int
  275. /* define the buffer type for building the state information */
  276. #define _JBLEN 64 /* return address, R1, R2, R13-R31, FPR14-FPR31, CR 2-5 */
  277. #endif
  278. /* Define the buffer type for holding the state information */
  279. #ifndef _JMP_BUF_DEFINED
  280. typedef _JBTYPE jmp_buf[_JBLEN];
  281. #define _JMP_BUF_DEFINED
  282. #endif
  283. /* Function prototypes */
  284. int __cdecl setjmp(jmp_buf);
  285. _CRTIMP void __cdecl longjmp(jmp_buf, int);
  286. #ifdef __cplusplus
  287. }
  288. #endif
  289. #ifdef _MSC_VER
  290. #pragma pack(pop)
  291. #endif /* _MSC_VER */
  292. #endif /* _INC_SETJMP */