Leaked source code of windows server 2003
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.

275 lines
6.0 KiB

  1. /***
  2. *setjmp.h - definitions/declarations for setjmp/longjmp routines
  3. *
  4. * Copyright (c) 1985-2001, 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. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif
  18. #ifndef _INC_SETJMP
  19. #define _INC_SETJMP
  20. #if !defined(_WIN32)
  21. #error ERROR: Only Win32 target supported!
  22. #endif
  23. #ifdef _MSC_VER
  24. /*
  25. * Currently, all MS C compilers for Win32 platforms default to 8 byte
  26. * alignment.
  27. */
  28. #pragma pack(push,8)
  29. #endif /* _MSC_VER */
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. /* Define _CRTIMP */
  34. #ifndef _CRTIMP
  35. #ifdef _DLL
  36. #define _CRTIMP __declspec(dllimport)
  37. #else /* ndef _DLL */
  38. #define _CRTIMP
  39. #endif /* _DLL */
  40. #endif /* _CRTIMP */
  41. /* Define __cdecl for non-Microsoft compilers */
  42. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  43. #define __cdecl
  44. #endif
  45. /*
  46. * Definitions specific to particular setjmp implementations.
  47. */
  48. #if defined(_M_IX86)
  49. /*
  50. * MS compiler for x86
  51. */
  52. #ifndef _INC_SETJMPEX
  53. #define setjmp _setjmp
  54. #endif
  55. #define _JBLEN 16
  56. #define _JBTYPE int
  57. /*
  58. * Define jump buffer layout for x86 setjmp/longjmp.
  59. */
  60. typedef struct __JUMP_BUFFER {
  61. unsigned long Ebp;
  62. unsigned long Ebx;
  63. unsigned long Edi;
  64. unsigned long Esi;
  65. unsigned long Esp;
  66. unsigned long Eip;
  67. unsigned long Registration;
  68. unsigned long TryLevel;
  69. unsigned long Cookie;
  70. unsigned long UnwindFunc;
  71. unsigned long UnwindData[6];
  72. } _JUMP_BUFFER;
  73. #elif defined(_M_IA64)
  74. /*
  75. * Minimum length is 528 bytes
  76. * Since this is allocated as an array of "SETJMP_FLOAT128", the
  77. * number of entries required is 33 (16-byte aligned).
  78. */
  79. /* Avoid conflicts with winnt.h FLOAT128 by giving the typedef another name. */
  80. typedef __declspec(align(16)) struct _SETJMP_FLOAT128 {
  81. __int64 LowPart;
  82. __int64 HighPart;
  83. } SETJMP_FLOAT128;
  84. #define _JBLEN 33
  85. typedef SETJMP_FLOAT128 _JBTYPE;
  86. #ifndef _INC_SETJMPEX
  87. #define setjmp _setjmp
  88. #endif
  89. /*
  90. * Define jump buffer layout for IA64 setjmp/longjmp.
  91. */
  92. typedef struct __JUMP_BUFFER {
  93. /*
  94. * x86 reserved.
  95. */
  96. unsigned long iAReserved[6];
  97. /*
  98. * x86 C9.0 compatibility
  99. */
  100. unsigned long Registration; /* point to the UnwindData field. */
  101. unsigned long TryLevel; /* ignored by setjmp */
  102. unsigned long Cookie; /* set to "VC20" by setjmp */
  103. unsigned long UnwindFunc; /* set to EM longjmp() by setjmp */
  104. /*
  105. * First dword is zero to indicate it's an exception registration
  106. * record prepared by EM setjmp function.
  107. * Second dword is set to 0 for unsafe EM setjmp, and 1 for safe
  108. * EM setjmp.
  109. * Third dword is set to the setjmp site memory stack frame pointer.
  110. * Fourth dword is set to the setjmp site backing store frame pointer.
  111. */
  112. unsigned long UnwindData[6];
  113. /*
  114. * floating point status register,
  115. * and preserved floating point registers fs0 - fs19
  116. */
  117. SETJMP_FLOAT128 FltS0;
  118. SETJMP_FLOAT128 FltS1;
  119. SETJMP_FLOAT128 FltS2;
  120. SETJMP_FLOAT128 FltS3;
  121. SETJMP_FLOAT128 FltS4;
  122. SETJMP_FLOAT128 FltS5;
  123. SETJMP_FLOAT128 FltS6;
  124. SETJMP_FLOAT128 FltS7;
  125. SETJMP_FLOAT128 FltS8;
  126. SETJMP_FLOAT128 FltS9;
  127. SETJMP_FLOAT128 FltS10;
  128. SETJMP_FLOAT128 FltS11;
  129. SETJMP_FLOAT128 FltS12;
  130. SETJMP_FLOAT128 FltS13;
  131. SETJMP_FLOAT128 FltS14;
  132. SETJMP_FLOAT128 FltS15;
  133. SETJMP_FLOAT128 FltS16;
  134. SETJMP_FLOAT128 FltS17;
  135. SETJMP_FLOAT128 FltS18;
  136. SETJMP_FLOAT128 FltS19;
  137. __int64 FPSR;
  138. /*
  139. * return link and preserved branch registers bs0 - bs4
  140. */
  141. __int64 StIIP; /* continuation address */
  142. __int64 BrS0;
  143. __int64 BrS1;
  144. __int64 BrS2;
  145. __int64 BrS3;
  146. __int64 BrS4;
  147. /*
  148. * preserved general registers s0 - s3, sp, nats
  149. */
  150. __int64 IntS0;
  151. __int64 IntS1;
  152. __int64 IntS2;
  153. __int64 IntS3;
  154. /*
  155. * bsp, pfs, unat, lc
  156. */
  157. __int64 RsBSP;
  158. __int64 RsPFS; /* previous frame marker (cfm of setjmp's caller) */
  159. __int64 ApUNAT; /* User Nat collection register (preserved) */
  160. __int64 ApLC; /* loop counter */
  161. __int64 IntSp; /* memory stack pointer */
  162. __int64 IntNats; /* Nat bits of preserved integer regs s0 - s3 */
  163. __int64 Preds; /* predicates */
  164. } _JUMP_BUFFER;
  165. #elif defined(_M_AMD64)
  166. typedef __declspec(align(16)) struct _SETJMP_FLOAT128 {
  167. unsigned __int64 Part[2];
  168. } SETJMP_FLOAT128;
  169. #define _JBLEN 16
  170. typedef SETJMP_FLOAT128 _JBTYPE;
  171. #ifndef _INC_SETJMPEX
  172. #define setjmp _setjmp
  173. #endif
  174. typedef struct _JUMP_BUFFER {
  175. unsigned __int64 Frame;
  176. unsigned __int64 Rbx;
  177. unsigned __int64 Rsp;
  178. unsigned __int64 Rbp;
  179. unsigned __int64 Rsi;
  180. unsigned __int64 Rdi;
  181. unsigned __int64 R12;
  182. unsigned __int64 R13;
  183. unsigned __int64 R14;
  184. unsigned __int64 R15;
  185. unsigned __int64 Rip;
  186. unsigned __int64 Spare;
  187. SETJMP_FLOAT128 Xmm6;
  188. SETJMP_FLOAT128 Xmm7;
  189. SETJMP_FLOAT128 Xmm8;
  190. SETJMP_FLOAT128 Xmm9;
  191. SETJMP_FLOAT128 Xmm10;
  192. SETJMP_FLOAT128 Xmm11;
  193. SETJMP_FLOAT128 Xmm12;
  194. SETJMP_FLOAT128 Xmm13;
  195. SETJMP_FLOAT128 Xmm14;
  196. SETJMP_FLOAT128 Xmm15;
  197. } _JUMP_BUFFER;
  198. #endif
  199. /* Define the buffer type for holding the state information */
  200. #ifndef _JMP_BUF_DEFINED
  201. typedef _JBTYPE jmp_buf[_JBLEN];
  202. #define _JMP_BUF_DEFINED
  203. #endif
  204. /* Function prototypes */
  205. int __cdecl setjmp(jmp_buf);
  206. #if _MSC_VER >= 1200
  207. _CRTIMP __declspec(noreturn) void __cdecl longjmp(jmp_buf, int);
  208. #else
  209. _CRTIMP void __cdecl longjmp(jmp_buf, int);
  210. #endif
  211. #ifdef __cplusplus
  212. }
  213. #endif
  214. #ifdef _MSC_VER
  215. #pragma pack(pop)
  216. #endif /* _MSC_VER */
  217. #endif /* _INC_SETJMP */