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.

181 lines
3.3 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. data.c
  5. Abstract:
  6. This module contains the x86 specific data for the dpmi library.
  7. Common data is found in dpmi32.c
  8. Author:
  9. Dave Hastings (daveh) creation-date 09-Feb-1994
  10. Revision History:
  11. Neil Sandlin (neilsa) 31-Jul-1995 Updates for the 486 emulator
  12. --*/
  13. #include "precomp.h"
  14. #pragma hdrstop
  15. //
  16. // Information about the current PSP
  17. //
  18. USHORT CurrentPSPSelector;
  19. ULONG CurrentPSPXmem;
  20. //
  21. // Table of selector bases and limits
  22. //
  23. ULONG FlatAddress[LDT_SIZE];
  24. //
  25. // LDT information
  26. //
  27. PLDT_ENTRY Ldt;
  28. USHORT LdtSel;
  29. USHORT LdtMaxSel = 0;
  30. USHORT LdtUserSel = 0;
  31. //
  32. // Address of 16 bit Idt
  33. //
  34. PIDT_ENTRY Idt;
  35. //
  36. // Pointers to the low memory buffers
  37. //
  38. PUCHAR SmallXlatBuffer;
  39. PUCHAR LargeXlatBuffer;
  40. BOOL SmallBufferInUse;
  41. USHORT LargeBufferInUseCount = 0;
  42. //
  43. // Segment of realmode dosx stack
  44. //
  45. USHORT DosxStackSegment;
  46. //
  47. // segment of realmode dosx code
  48. //
  49. USHORT DosxRmCodeSegment;
  50. //
  51. // selector of realmode code
  52. //
  53. USHORT DosxRmCodeSelector;
  54. //
  55. // Address of pointer to next frame on Dosx stack
  56. //
  57. PWORD16 DosxStackFramePointer;
  58. //
  59. // Size of dosx stack frame
  60. //
  61. USHORT DosxStackFrameSize;
  62. //
  63. // Dpmi flags for the current application
  64. //
  65. USHORT CurrentAppFlags;
  66. //
  67. // Address of Bop fe for ending interrupt simulation
  68. //
  69. ULONG RmBopFe;
  70. ULONG PmBopFe;
  71. //
  72. // Address of buffer for DTA in Dosx
  73. //
  74. PUCHAR DosxDtaBuffer;
  75. //
  76. // Information about the current DTA
  77. //
  78. // N.B. The selector:offset, and CurrentDta following MAY point to
  79. // different linear addresses. This will be the case if the
  80. // dta selector is in high memory.
  81. // CurrentDosDta holds the "cached" value of the Dta that has
  82. // actually been issued to DOS.
  83. PUCHAR CurrentDta;
  84. PUCHAR CurrentPmDtaAddress;
  85. PUCHAR CurrentDosDta;
  86. USHORT CurrentDtaSelector;
  87. USHORT CurrentDtaOffset;
  88. //
  89. // These are the functions in WOW (GlobalDOSAlloc, GlobalDOSFree)
  90. // that are used as helper functions to perform DPMI func's 100,101
  91. // when we are running under WOW.
  92. //
  93. USHORT WOWAllocSeg = 0;
  94. USHORT WOWAllocFunc;
  95. USHORT WOWFreeSeg = 0;
  96. USHORT WOWFreeFunc;
  97. //
  98. // Selector limits
  99. //
  100. #if DBG
  101. ULONG SelectorLimit[LDT_SIZE];
  102. PULONG ExpSelectorLimit = SelectorLimit;
  103. #else
  104. PULONG ExpSelectorLimit = NULL;
  105. #endif
  106. //
  107. // Start of intel address space in process memory
  108. //
  109. ULONG IntelBase = 0;
  110. //
  111. // Variables used for supporting stack switching
  112. // (on x86, these are in the vdmtib)
  113. //
  114. #ifndef i386
  115. USHORT LockedPMStackSel;
  116. ULONG LockedPMStackCount;
  117. ULONG PMLockOrigEIP;
  118. ULONG PMLockOrigSS;
  119. ULONG PMLockOrigESP;
  120. ULONG DosxFaultHandlerIret;
  121. ULONG DosxFaultHandlerIretd;
  122. ULONG DosxIntHandlerIret;
  123. ULONG DosxIntHandlerIretd;
  124. ULONG DosxRMReflector;
  125. #endif
  126. VDM_INTERRUPTHANDLER DpmiInterruptHandlers[256] = {0};
  127. VDM_FAULTHANDLER DpmiFaultHandlers[32] = {0};
  128. ULONG DosxIret;
  129. ULONG DosxIretd;
  130. USHORT PMReflectorSeg;
  131. ULONG DosxRmSaveRestoreState;
  132. ULONG DosxPmSaveRestoreState;
  133. ULONG DosxRmRawModeSwitch;
  134. ULONG DosxPmRawModeSwitch;
  135. ULONG DosxVcdPmSvcCall;
  136. ULONG DosxMsDosApi;
  137. ULONG DosxXmsControl;
  138. ULONG DosxHungAppExit;
  139. //
  140. // WORKITEM: should be in VDMTIB
  141. //
  142. ULONG LastLockedPMStackSS;
  143. ULONG LastLockedPMStackESP;