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.

759 lines
21 KiB

  1. /*++ BUILD Version: 0011 // Increment this if a change has global effects
  2. Copyright (c) 1992-2000 Digital Equipment Corporation
  3. Module Name:
  4. ntalpha.h
  5. Abstract:
  6. User-mode visible Alpha specific structures and constants
  7. Author:
  8. Joe Notarangelo 27-March-1992 (based on ntmips.h by Dave Cutler)
  9. Revision History:
  10. Kim Peterson 21-May-1997 Add DNZ bit to FPCR and SoftFPCR
  11. Miche Baker-Harvey 28-Jan-1993 Add 32-bit API for context structure
  12. Jeff McLeman 22-Jul-1992 Add SystemTime struct
  13. Jeff McLeman 10-July-1992 Add Stall entries in the PCR
  14. Steve Jenness 08-July-1992 Add NtCurrentTeb definition.
  15. John DeRosa 30-June-1992
  16. Added volatile qualifier to the address arguments of the I/O
  17. space function prototypes.
  18. Put back in sections of the PCR, and a typedef, that were deleted.
  19. Rod Gamache 15-May-1992 Add EISA access routines prototypes
  20. Thomas Van Baak (tvb) 9-Jul-1992
  21. Created proper Alpha CONTEXT structure definitions.
  22. --*/
  23. #ifndef _NTALPHA_
  24. #define _NTALPHA_
  25. #if _MSC_VER > 1000
  26. #pragma once
  27. #endif
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. #ifdef _ALPHA_ // ntddk wdm nthal
  32. //
  33. // Cfront doesn't support the volatile attribute and complains about
  34. // it loudly. This disables volatile when compiling C++ code, but it
  35. // isn't clear the semantics are correct. It all comes down to the fact
  36. // that cfront is bogus.
  37. //
  38. #ifdef _CFRONT
  39. #define VOLATILE
  40. #else
  41. #define VOLATILE volatile
  42. #endif
  43. //
  44. // Define breakpoint codes.
  45. //
  46. #define USER_BREAKPOINT 0 // user breakpoint
  47. #define KERNEL_BREAKPOINT 1 // kernel breakpoint
  48. #define DEBUG_PRINT_BREAKPOINT 20 // debug print breakpoint
  49. #define DEBUG_PROMPT_BREAKPOINT 21 // debug prompt breakpoint
  50. #define DEBUG_STOP_BREAKPOINT 22 // debug stop breakpoint
  51. #define DEBUG_LOAD_SYMBOLS_BREAKPOINT 23 // load symbols breakpoint
  52. #define DEBUG_UNLOAD_SYMBOLS_BREAKPOINT 24 // unload symbols breakpoint
  53. #define BREAKIN_BREAKPOINT 25 // breakin breakpoint
  54. #define DEBUG_COMMAND_STRING_BREAKPOINT 26 // command string breakpoint
  55. //
  56. // Define Alpha specific read control space commands for the
  57. // Kernel Debugger. These definitions are for values that must be
  58. // accessed via defined interfaces (PAL on MP systems).
  59. //
  60. #define DEBUG_CONTROL_SPACE_PCR 1
  61. #define DEBUG_CONTROL_SPACE_THREAD 2
  62. #define DEBUG_CONTROL_SPACE_PRCB 3
  63. #define DEBUG_CONTROL_SPACE_PSR 4
  64. #define DEBUG_CONTROL_SPACE_DPCACTIVE 5
  65. #define DEBUG_CONTROL_SPACE_TEB 6
  66. #define DEBUG_CONTROL_SPACE_IPRSTATE 7
  67. #define DEBUG_CONTROL_SPACE_COUNTERS 8
  68. //
  69. // Define Alpha GENTRAP codes.
  70. //
  71. #define GENTRAP_INTEGER_OVERFLOW (-1)
  72. #define GENTRAP_INTEGER_DIVIDE_BY_ZERO (-2)
  73. #define GENTRAP_FLOATING_OVERFLOW (-3)
  74. #define GENTRAP_FLOATING_DIVIDE_BY_ZERO (-4)
  75. #define GENTRAP_FLOATING_UNDERFLOW (-5)
  76. #define GENTRAP_FLOATING_INVALID_OPERAND (-6)
  77. #define GENTRAP_FLOATING_INEXACT_RESULT (-7)
  78. //
  79. // Define special fast path event pair client/server system service codes.
  80. //
  81. // N.B. These codes are VERY special. The high bit signifies a fast path
  82. // event pair service and the low bit signifies what type.
  83. //
  84. #define SET_LOW_WAIT_HIGH -2 // fast path event pair service
  85. #define SET_HIGH_WAIT_LOW -1 // fast path event pair service
  86. // begin_ntddk begin_nthal
  87. //
  88. // Define size of kernel mode stack.
  89. //
  90. #if defined(_AXP64_)
  91. #define KERNEL_STACK_SIZE 0x6000
  92. #else
  93. #define KERNEL_STACK_SIZE 0x4000
  94. #endif
  95. //
  96. // Define size of large kernel mode stack for callbacks.
  97. //
  98. #define KERNEL_LARGE_STACK_SIZE 65536
  99. //
  100. // Define number of pages to initialize in a large kernel stack.
  101. //
  102. #define KERNEL_LARGE_STACK_COMMIT KERNEL_STACK_SIZE
  103. // end_ntddk end_nthal
  104. //
  105. // Define address of data shared between user and kernel mode.
  106. //
  107. #define MM_SHARED_USER_DATA_VA 0x7FFE0000
  108. #define USER_SHARED_DATA ((KUSER_SHARED_DATA * const)MM_SHARED_USER_DATA_VA)
  109. #if defined(_AXP64_)
  110. //
  111. // Define address of the wow64 reserved compatibility area.
  112. //
  113. #define WOW64_COMPATIBILITY_AREA_ADDRESS (MM_SHARED_USER_DATA_VA - 0x1000000)
  114. //
  115. // Define address of the system-wide csrss shared section.
  116. //
  117. #define CSR_SYSTEM_SHARED_ADDRESS (WOW64_COMPATIBILITY_AREA_ADDRESS)
  118. #endif
  119. // begin_winnt
  120. //
  121. // Define function to return the current Thread Environment Block
  122. //
  123. #ifdef _ALPHA_ // winnt
  124. void *_rdteb(void); // winnt
  125. #if defined(_M_ALPHA) // winnt
  126. #pragma intrinsic(_rdteb) // winnt
  127. #endif // winnt
  128. #endif // winnt
  129. #if defined(_M_ALPHA)
  130. #define NtCurrentTeb() ((struct _TEB *)_rdteb())
  131. #else
  132. struct _TEB *
  133. NtCurrentTeb(void);
  134. #endif
  135. //
  136. // Define functions to get the address of the current fiber and the
  137. // current fiber data.
  138. //
  139. #ifdef _ALPHA_
  140. #define GetCurrentFiber() (((PNT_TIB)NtCurrentTeb())->FiberData)
  141. #define GetFiberData() (*(PVOID *)(GetCurrentFiber()))
  142. // begin_ntddk begin_nthal
  143. //
  144. // The following flags control the contents of the CONTEXT structure.
  145. //
  146. #if !defined(RC_INVOKED)
  147. #define CONTEXT_ALPHA 0x00020000
  148. #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L)
  149. #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L)
  150. #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L)
  151. #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
  152. #endif
  153. #ifndef _PORTABLE_32BIT_CONTEXT
  154. //
  155. // Context Frame
  156. //
  157. // This frame has a several purposes: 1) it is used as an argument to
  158. // NtContinue, 2) it is used to construct a call frame for APC delivery,
  159. // 3) it is used to construct a call frame for exception dispatching
  160. // in user mode, 4) it is used in the user level thread creation
  161. // routines, and 5) it is used to to pass thread state to debuggers.
  162. //
  163. // N.B. Because this record is used as a call frame, it must be EXACTLY
  164. // a multiple of 16 bytes in length.
  165. //
  166. // There are two variations of the context structure. This is the real one.
  167. //
  168. typedef struct _CONTEXT {
  169. //
  170. // This section is specified/returned if the ContextFlags word contains
  171. // the flag CONTEXT_FLOATING_POINT.
  172. //
  173. ULONGLONG FltF0;
  174. ULONGLONG FltF1;
  175. ULONGLONG FltF2;
  176. ULONGLONG FltF3;
  177. ULONGLONG FltF4;
  178. ULONGLONG FltF5;
  179. ULONGLONG FltF6;
  180. ULONGLONG FltF7;
  181. ULONGLONG FltF8;
  182. ULONGLONG FltF9;
  183. ULONGLONG FltF10;
  184. ULONGLONG FltF11;
  185. ULONGLONG FltF12;
  186. ULONGLONG FltF13;
  187. ULONGLONG FltF14;
  188. ULONGLONG FltF15;
  189. ULONGLONG FltF16;
  190. ULONGLONG FltF17;
  191. ULONGLONG FltF18;
  192. ULONGLONG FltF19;
  193. ULONGLONG FltF20;
  194. ULONGLONG FltF21;
  195. ULONGLONG FltF22;
  196. ULONGLONG FltF23;
  197. ULONGLONG FltF24;
  198. ULONGLONG FltF25;
  199. ULONGLONG FltF26;
  200. ULONGLONG FltF27;
  201. ULONGLONG FltF28;
  202. ULONGLONG FltF29;
  203. ULONGLONG FltF30;
  204. ULONGLONG FltF31;
  205. //
  206. // This section is specified/returned if the ContextFlags word contains
  207. // the flag CONTEXT_INTEGER.
  208. //
  209. // N.B. The registers gp, sp, and ra are defined in this section, but are
  210. // considered part of the control context rather than part of the integer
  211. // context.
  212. //
  213. ULONGLONG IntV0; // $0: return value register, v0
  214. ULONGLONG IntT0; // $1: temporary registers, t0 - t7
  215. ULONGLONG IntT1; // $2:
  216. ULONGLONG IntT2; // $3:
  217. ULONGLONG IntT3; // $4:
  218. ULONGLONG IntT4; // $5:
  219. ULONGLONG IntT5; // $6:
  220. ULONGLONG IntT6; // $7:
  221. ULONGLONG IntT7; // $8:
  222. ULONGLONG IntS0; // $9: nonvolatile registers, s0 - s5
  223. ULONGLONG IntS1; // $10:
  224. ULONGLONG IntS2; // $11:
  225. ULONGLONG IntS3; // $12:
  226. ULONGLONG IntS4; // $13:
  227. ULONGLONG IntS5; // $14:
  228. ULONGLONG IntFp; // $15: frame pointer register, fp/s6
  229. ULONGLONG IntA0; // $16: argument registers, a0 - a5
  230. ULONGLONG IntA1; // $17:
  231. ULONGLONG IntA2; // $18:
  232. ULONGLONG IntA3; // $19:
  233. ULONGLONG IntA4; // $20:
  234. ULONGLONG IntA5; // $21:
  235. ULONGLONG IntT8; // $22: temporary registers, t8 - t11
  236. ULONGLONG IntT9; // $23:
  237. ULONGLONG IntT10; // $24:
  238. ULONGLONG IntT11; // $25:
  239. ULONGLONG IntRa; // $26: return address register, ra
  240. ULONGLONG IntT12; // $27: temporary register, t12
  241. ULONGLONG IntAt; // $28: assembler temp register, at
  242. ULONGLONG IntGp; // $29: global pointer register, gp
  243. ULONGLONG IntSp; // $30: stack pointer register, sp
  244. ULONGLONG IntZero; // $31: zero register, zero
  245. //
  246. // This section is specified/returned if the ContextFlags word contains
  247. // the flag CONTEXT_FLOATING_POINT.
  248. //
  249. ULONGLONG Fpcr; // floating point control register
  250. ULONGLONG SoftFpcr; // software extension to FPCR
  251. //
  252. // This section is specified/returned if the ContextFlags word contains
  253. // the flag CONTEXT_CONTROL.
  254. //
  255. // N.B. The registers gp, sp, and ra are defined in the integer section,
  256. // but are considered part of the control context rather than part of
  257. // the integer context.
  258. //
  259. ULONGLONG Fir; // (fault instruction) continuation address
  260. ULONG Psr; // processor status
  261. //
  262. // The flags values within this flag control the contents of
  263. // a CONTEXT record.
  264. //
  265. // If the context record is used as an input parameter, then
  266. // for each portion of the context record controlled by a flag
  267. // whose value is set, it is assumed that that portion of the
  268. // context record contains valid context. If the context record
  269. // is being used to modify a thread's context, then only that
  270. // portion of the threads context will be modified.
  271. //
  272. // If the context record is used as an IN OUT parameter to capture
  273. // the context of a thread, then only those portions of the thread's
  274. // context corresponding to set flags will be returned.
  275. //
  276. // The context record is never used as an OUT only parameter.
  277. //
  278. ULONG ContextFlags;
  279. ULONG Fill[4]; // padding for 16-byte stack frame alignment
  280. } CONTEXT, *PCONTEXT;
  281. #else
  282. #error _PORTABLE_32BIT_CONTEXT no longer supported on Alpha.
  283. #endif // _PORTABLE_32BIT_CONTEXT
  284. // end_ntddk end_nthal
  285. #endif // _ALPHA_
  286. // end_winnt
  287. #define CONTEXT_TO_PROGRAM_COUNTER(Context) ((Context)->Fir)
  288. #define PROGRAM_COUNTER_TO_CONTEXT(Context, ProgramCounter) ((Context)->Fir = (ProgramCounter))
  289. #define CONTEXT_LENGTH (sizeof(CONTEXT))
  290. #define CONTEXT_ALIGN (sizeof(ULONG))
  291. #define CONTEXT_ROUND (CONTEXT_ALIGN - 1)
  292. //
  293. // Nonvolatile context pointer record.
  294. //
  295. typedef struct _KNONVOLATILE_CONTEXT_POINTERS {
  296. PULONGLONG FloatingContext[1];
  297. PULONGLONG FltF1;
  298. // Nonvolatile floating point registers start here.
  299. PULONGLONG FltF2;
  300. PULONGLONG FltF3;
  301. PULONGLONG FltF4;
  302. PULONGLONG FltF5;
  303. PULONGLONG FltF6;
  304. PULONGLONG FltF7;
  305. PULONGLONG FltF8;
  306. PULONGLONG FltF9;
  307. PULONGLONG FltF10;
  308. PULONGLONG FltF11;
  309. PULONGLONG FltF12;
  310. PULONGLONG FltF13;
  311. PULONGLONG FltF14;
  312. PULONGLONG FltF15;
  313. PULONGLONG FltF16;
  314. PULONGLONG FltF17;
  315. PULONGLONG FltF18;
  316. PULONGLONG FltF19;
  317. PULONGLONG FltF20;
  318. PULONGLONG FltF21;
  319. PULONGLONG FltF22;
  320. PULONGLONG FltF23;
  321. PULONGLONG FltF24;
  322. PULONGLONG FltF25;
  323. PULONGLONG FltF26;
  324. PULONGLONG FltF27;
  325. PULONGLONG FltF28;
  326. PULONGLONG FltF29;
  327. PULONGLONG FltF30;
  328. PULONGLONG FltF31;
  329. PULONGLONG IntegerContext[1];
  330. PULONGLONG IntT0;
  331. PULONGLONG IntT1;
  332. PULONGLONG IntT2;
  333. PULONGLONG IntT3;
  334. PULONGLONG IntT4;
  335. PULONGLONG IntT5;
  336. PULONGLONG IntT6;
  337. PULONGLONG IntT7;
  338. // Nonvolatile integer registers start here.
  339. PULONGLONG IntS0;
  340. PULONGLONG IntS1;
  341. PULONGLONG IntS2;
  342. PULONGLONG IntS3;
  343. PULONGLONG IntS4;
  344. PULONGLONG IntS5;
  345. PULONGLONG IntFp;
  346. PULONGLONG IntA0;
  347. PULONGLONG IntA1;
  348. PULONGLONG IntA2;
  349. PULONGLONG IntA3;
  350. PULONGLONG IntA4;
  351. PULONGLONG IntA5;
  352. PULONGLONG IntT8;
  353. PULONGLONG IntT9;
  354. PULONGLONG IntT10;
  355. PULONGLONG IntT11;
  356. PULONGLONG IntRa;
  357. PULONGLONG IntT12;
  358. PULONGLONG IntAt;
  359. PULONGLONG IntGp;
  360. PULONGLONG IntSp;
  361. PULONGLONG IntZero;
  362. } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
  363. //
  364. // Define Exception Summary Register for arithmetic exceptions.
  365. //
  366. typedef struct _EXC_SUM {
  367. ULONG SoftwareCompletion : 1;
  368. ULONG InvalidOperation : 1;
  369. ULONG DivisionByZero : 1;
  370. ULONG Overflow : 1;
  371. ULONG Underflow : 1;
  372. ULONG InexactResult : 1;
  373. ULONG IntegerOverflow : 1;
  374. ULONG Fill : 25;
  375. } EXC_SUM, *PEXC_SUM;
  376. //
  377. // Define hardware Floating Point Control Register.
  378. //
  379. typedef struct _FPCR {
  380. ULONG LowPart;
  381. ULONG Fill : 16;
  382. ULONG DenormalOperandsToZeroEnable : 1;
  383. ULONG DisableInvalid : 1;
  384. ULONG DisableDivisionByZero : 1;
  385. ULONG DisableOverflow : 1;
  386. ULONG InvalidOperation : 1;
  387. ULONG DivisionByZero : 1;
  388. ULONG Overflow : 1;
  389. ULONG Underflow : 1;
  390. ULONG InexactResult : 1;
  391. ULONG IntegerOverflow : 1;
  392. ULONG DynamicRoundingMode : 2;
  393. ULONG UnderflowToZeroEnable : 1;
  394. ULONG DisableUnderflow : 1;
  395. ULONG DisableInexact : 1;
  396. ULONG SummaryBit : 1;
  397. } FPCR, *PFPCR;
  398. //
  399. // Define software Floating Point Control and Status Register.
  400. //
  401. // N.B. The five IEEE trap enable bits are in the same position as the bits
  402. // in the exception summary register. The five IEEE status bits are in
  403. // the same order and 16 bits left of the IEEE enable bits.
  404. //
  405. // N.B. The ArithmeticTrapIgnore bit will supress all arithmetic traps (and
  406. // leave unpredictable results in the destination register of floating
  407. // point instructions that trap) when the /S qualifier is not used.
  408. //
  409. // The Software FPCR defaults to zero.
  410. //
  411. typedef struct _SW_FPCR {
  412. ULONG ArithmeticTrapIgnore : 1;
  413. ULONG EnableInvalid : 1;
  414. ULONG EnableDivisionByZero : 1;
  415. ULONG EnableOverflow : 1;
  416. ULONG EnableUnderflow : 1;
  417. ULONG EnableInexact : 1;
  418. ULONG FillA : 5;
  419. ULONG DenormalOperandsEnable : 1; // DNZ for EV4/EV5
  420. ULONG DenormalResultEnable : 1;
  421. ULONG NoSoftwareEmulation : 1; // tvb debug
  422. ULONG UnderflowToZeroEnable : 1; // bit 14 not used
  423. ULONG ThreadInheritEnable : 1; // bit 15 not used
  424. ULONG EmulationOccurred : 1;
  425. ULONG StatusInvalid : 1;
  426. ULONG StatusDivisionByZero : 1;
  427. ULONG StatusOverflow : 1;
  428. ULONG StatusUnderflow : 1;
  429. ULONG StatusInexact : 1;
  430. ULONG FillB : 10;
  431. } SW_FPCR, *PSW_FPCR;
  432. // begin_nthal
  433. //
  434. // Define address space layout as defined by Alpha 32-bit and 43-bit super-page
  435. // memory management.
  436. //
  437. #define KUSEG_BASE 0x0 // base of user segment
  438. #if defined(_AXP64_)
  439. #define KSEG0_BASE 0xFFFFFFFF80000000UI64 // base of 32-bit superpage physical
  440. #define KSEG2_BASE 0xFFFFFFFFC0000000UI64 // limit of 32-bit superpage physical
  441. #define KSEG43_BASE 0xFFFFFC0000000000UI64 // base of 43-bit superpage physical
  442. #define KSEG43_LIMIT 0xFFFFFE0000000000UI64 // limit of 43-bit superpage physical
  443. #else
  444. #define KSEG0_BASE 0x80000000 // base of cached kernel physical
  445. #define KSEG2_BASE 0xc0000000 // base of cached kernel virtual
  446. #endif
  447. // end_nthal
  448. //
  449. // Define Alpha exception handling structures and function prototypes.
  450. //
  451. //
  452. // Function table entry structure definition.
  453. //
  454. // Exception Mode is in the low bit of ExceptionHandler and the low two bits
  455. // of PrologEndAddress. Entry Type is in the low two bits of HandlerData
  456. // in secondary function entries. Low two bits of BeginAddress and EndAddress
  457. // are reserved for future use. RF_ macros are defined to provide consistent
  458. // access to the fields of RUNTIME_FUNCTION without the low order bits.
  459. typedef struct _RUNTIME_FUNCTION {
  460. ULONG_PTR BeginAddress;
  461. ULONG_PTR EndAddress;
  462. PEXCEPTION_ROUTINE ExceptionHandler;
  463. PVOID HandlerData;
  464. ULONG_PTR PrologEndAddress;
  465. } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
  466. #define RF_BEGIN_ADDRESS(RF) ((RF)->BeginAddress & (~3))
  467. #define RF_END_ADDRESS(RF) ((RF)->EndAddress & (~3))
  468. #define RF_EXCEPTION_HANDLER(RF) (PEXCEPTION_ROUTINE)((ULONG_PTR)((RF)->ExceptionHandler) & (~3))
  469. #define RF_ENTRY_TYPE(RF) (ULONG)((ULONG_PTR)((RF)->HandlerData) & 3)
  470. #define RF_PROLOG_END_ADDRESS(RF) ((RF)->PrologEndAddress & (~3))
  471. #define RF_IS_FIXED_RETURN(RF) (BOOLEAN)(((ULONG_PTR)((RF)->ExceptionHandler) & 2) >> 1)
  472. #define RF_NULL_CONTEXT_COUNT(RF) (ULONG)((ULONG_PTR)((RF)->EndAddress) & 3)
  473. #define RF_FIXED_RETURN(RF) ((ULONG_PTR)((RF)->ExceptionHandler) & (~3))
  474. #define RF_ALT_PROLOG(RF) ((ULONG_PTR)((RF)->ExceptionHandler) & (~3))
  475. #define RF_STACK_ADJUST(RF) (ULONG)((ULONG_PTR)((RF)->ExceptionHandler) & (~3))
  476. // Values for secondary function entry type
  477. #define RF_NOT_CONTIGUOUS 0
  478. #define RF_ALT_ENT_PROLOG 1
  479. #define RF_NULL_CONTEXT 2
  480. // Dynamic function table link entry. List head for this structure
  481. // is returned by RtlGetFunctionTableListHead.
  482. typedef struct _DYNAMIC_FUNCTION_TABLE {
  483. LIST_ENTRY Links;
  484. PRUNTIME_FUNCTION FunctionTable;
  485. ULONG EntryCount;
  486. LARGE_INTEGER TimeStamp;
  487. ULONG_PTR MinimumAddress;
  488. ULONG_PTR MaximumAddress;
  489. BOOLEAN Sorted;
  490. } DYNAMIC_FUNCTION_TABLE, *PDYNAMIC_FUNCTION_TABLE;
  491. //
  492. // Scope table structure definition - for acc.
  493. //
  494. // One table entry is created by the acc C compiler for each try-except or
  495. // try-finally scope. Nested scopes are ordered from inner to outer scope.
  496. // Current scope is passively maintained by PC-mapping (function tables).
  497. //
  498. typedef struct _SCOPE_TABLE {
  499. ULONG Count;
  500. struct
  501. {
  502. ULONG_PTR BeginAddress;
  503. ULONG_PTR EndAddress;
  504. ULONG_PTR HandlerAddress;
  505. ULONG_PTR JumpTarget;
  506. } ScopeRecord[1];
  507. } SCOPE_TABLE, *PSCOPE_TABLE;
  508. //
  509. // Scope structure definition - for GEM.
  510. //
  511. // One descriptor is created by the GEM C compiler for each try-except or
  512. // try-finally scope. Nested scopes are linked from inner to outer scope.
  513. // Current scope is actively maintained by a dynamic scope context structure.
  514. //
  515. typedef struct _SEH_BLOCK {
  516. ULONG_PTR HandlerAddress;
  517. ULONG_PTR JumpTarget;
  518. struct _SEH_BLOCK *ParentSeb;
  519. } SEH_BLOCK, *PSEH_BLOCK;
  520. //
  521. // Dynamic SEH context definition for GEM.
  522. //
  523. // For GEM generated C code, dynamic SEH scope for a procedure is maintained
  524. // with a pointer to the current SEB (or NULL when not in any SEH scope). The
  525. // SEB pointer, as well as except handler linkage variables, is contained in
  526. // a structure located at a known offset within the stack frame.
  527. //
  528. typedef struct _SEH_CONTEXT {
  529. PSEH_BLOCK CurrentSeb;
  530. ULONG ExceptionCode;
  531. ULONG_PTR RealFramePointer;
  532. } SEH_CONTEXT, *PSEH_CONTEXT;
  533. //
  534. // Runtime Library function prototypes.
  535. //
  536. VOID
  537. RtlCaptureContext (
  538. OUT PCONTEXT ContextRecord
  539. );
  540. PRUNTIME_FUNCTION
  541. RtlLookupFunctionEntry (
  542. IN ULONG_PTR ControlPc
  543. );
  544. PRUNTIME_FUNCTION
  545. RtlLookupDirectFunctionEntry (
  546. IN ULONG_PTR ControlPc
  547. );
  548. BOOLEAN
  549. RtlAddFunctionTable (
  550. IN PRUNTIME_FUNCTION FunctionTable,
  551. IN ULONG EntryCount
  552. );
  553. BOOLEAN
  554. RtlDeleteFunctionTable (
  555. IN PRUNTIME_FUNCTION FunctionTable
  556. );
  557. PLIST_ENTRY
  558. RtlGetFunctionTableListHead (
  559. VOID
  560. );
  561. typedef struct _FRAME_POINTERS {
  562. ULONG_PTR VirtualFramePointer;
  563. ULONG_PTR RealFramePointer;
  564. } FRAME_POINTERS, *PFRAME_POINTERS;
  565. ULONG_PTR
  566. RtlVirtualUnwind (
  567. IN ULONG_PTR ControlPc,
  568. IN PRUNTIME_FUNCTION FunctionEntry,
  569. IN OUT PCONTEXT ContextRecord,
  570. OUT PBOOLEAN InFunction,
  571. OUT PFRAME_POINTERS EstablisherFrame,
  572. IN OUT PKNONVOLATILE_CONTEXT_POINTERS ContextPointers OPTIONAL
  573. );
  574. //
  575. // Define C structured exception handing function prototypes.
  576. //
  577. typedef struct _DISPATCHER_CONTEXT {
  578. ULONG_PTR ControlPc;
  579. PRUNTIME_FUNCTION FunctionEntry;
  580. ULONG_PTR EstablisherFrame;
  581. PCONTEXT ContextRecord;
  582. } DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
  583. struct _EXCEPTION_POINTERS;
  584. typedef
  585. LONG
  586. (*EXCEPTION_FILTER) (
  587. struct _EXCEPTION_POINTERS *ExceptionPointers
  588. );
  589. typedef
  590. VOID
  591. (*TERMINATION_HANDLER) (
  592. BOOLEAN is_abnormal
  593. );
  594. // begin_winnt
  595. #ifdef _ALPHA_
  596. VOID
  597. __jump_unwind (
  598. PVOID VirtualFramePointer,
  599. PVOID TargetPc
  600. );
  601. #endif // _ALPHA_
  602. // end_winnt
  603. #endif // _ALPHA_ // ntddk wdm nthal
  604. #ifdef __cplusplus
  605. }
  606. #endif
  607. #endif // _NTALPHA_