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.

127 lines
3.6 KiB

  1. /* w32sys.h
  2. *
  3. * Definitions of various quantities associated with the
  4. * Win32 system DLLs. Used during Win32 boot.
  5. *
  6. * NOTE that these are NOT general PE DLL stats.
  7. */
  8. /*
  9. * Minimum granularity of PE objects is 512 bytes
  10. */
  11. #define SectorShift 9
  12. #define SectorSize 512
  13. #define SectorMask (SectorSize - 1)
  14. /*
  15. * DLLHeaderSize must be at least as large as the largest system dll header.
  16. */
  17. #define DLLHeaderSize PAGESIZE
  18. /*
  19. * The following define the bit fields of the pager dword associated with each
  20. * page of memory.
  21. *
  22. * 31 0
  23. * xxxxxxxxxxyyyzzzzzzzzzzzzzzzzzzz
  24. *
  25. * where 'x' is a 10 bit module index,
  26. * 'y' is a 3 bit count of zero fill sectors at the end of the page,
  27. * 'z' is a 19 bit file seek offset in unit sectors.
  28. *
  29. * this value is then rotated left 3 bits prior to passing it to the
  30. * memory manager so that when it increments it by one, the sector number
  31. * is actually incremented by 8 (# of sectors in a page).
  32. *
  33. * x = DLLIndexMask
  34. * y = DLLZFillMask
  35. * z = DLL
  36. */
  37. #define DLLIndexShift 22
  38. #define DLLIndexMask (0x3ff << DLLIndexShift)
  39. #define DLLZFillShift 19
  40. #define DLLZFillMask (7 << DLLZFillShift)
  41. #define DLLSectorShift 0
  42. #define DLLSectorMask (0x7ffff << DLLSectorShift)
  43. #define DLLIncrShift (PAGESHIFT - SectorShift)
  44. // Fault information block used between vwin32 and kernel32
  45. #define MAX_FI_CRSTS (SL_TOTAL + 8)
  46. #define CB_FI_CSEIP 16
  47. #define CB_FI_SSESP (16*4)
  48. typedef struct faultinfo_s {
  49. struct TDBX *fi_ptdbx;
  50. ULONG fi_ulExceptionNumber;
  51. ULONG fi_ulErrorCode;
  52. CONTEXT fi_context;
  53. LONG fi_acCrsts[MAX_FI_CRSTS];
  54. #ifdef SYSLEVELCHECK
  55. LONG fi_laLvlCounts[SL_TOTAL];
  56. struct _lcrst *fi_plcaOwnedCrsts[SL_TOTAL];
  57. #endif
  58. ULONG fi_cMustComplete;
  59. LONG fi_cbCSEIP;
  60. BYTE fi_abCSEIP[CB_FI_CSEIP];
  61. LONG fi_cbSSESP;
  62. ULONG fi_aulSSESP[CB_FI_SSESP/4];
  63. volatile DWORD fi_dwFaultResp;
  64. WORD fi_wWin16LockVCount;
  65. BYTE fi_fFlags;
  66. } FAULTINFO;
  67. typedef FAULTINFO *PFAULTINFO;
  68. // fi_fFlags and flag parameter to VWIN32_PMAPI_DPMI_Fault
  69. #define FI_FIGNORE 0x01 // allow ignore (put up ignore error box)
  70. #define FI_FDEBUG 0x02 // allow debug on normal popup
  71. #define FI_FTERMINATE 0x04 // do terminate if selected
  72. #define FI_FFREEITLATER 0x08 // delay freeing the fi block
  73. // fi_bFaultResp flags and return code to VWIN32_PMAPI_DPMI_Fault
  74. #define FI_TERMINATE 0 // terminate the app
  75. #define FI_DEBUG 1 // send to debugger
  76. #define FI_IGNORE 2 // ignore instruction
  77. // special fi_ulExceptionNumber values
  78. #define FI_LOAD_SEGMENT_ERROR 0xffffffff
  79. // VWIN32_CallWhenCrstSafe structure
  80. typedef struct cwcs {
  81. struct cwcs *cwcs_pcwcsNext; // link
  82. ULONG cwcs_pfn; // call back address
  83. ULONG cwcs_ulRef; // refernce data
  84. } CWCS;
  85. // VWIN32_ForceCrsts/RestoreCrsts structures
  86. typedef struct frcrst {
  87. struct frcrst *pfrcrstNext; // INIT <0> next frcrst on list
  88. struct _crst *pcrst; // INIT <0> pointer to crst
  89. struct _tdb *ptdbTraced; // thread that was single-stepped
  90. struct TDBX *ptdbxCrstOwner; // original owner
  91. ULONG ulOrder; // INIT <0> order to add crsts to list
  92. ULONG cRecur; // original recursion count
  93. ULONG htimeout; // time out handle
  94. ULONG cMustComplete; // must complete count of owner
  95. struct cwcs cwcsData; // VWIN32_CallWhenCrstSafe data
  96. } FRCRST;
  97. typedef FRCRST *PFRCRST;
  98. typedef struct frinfo {
  99. struct frcrst *pfrcrstHead; // points to fcrstLoadLock
  100. struct frcrst frcrstLoadLock; // for the current process's load crst
  101. struct vmmfrinfo vmmfrinfoData; // VMM force/restore mutex info struct
  102. } FRINFO;
  103. typedef FRINFO *PFRINFO;