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.

260 lines
6.2 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. vdmntos.h
  5. Abstract:
  6. This is the include file for the vdm component. It describes the kernel
  7. mode visible portions of the vdm component. The \nt\private\inc\vdm.h
  8. file describes the portions that are usermode visible.
  9. Author:
  10. Dave Hastings (daveh) 02-Feb-1992
  11. Revision History:
  12. --*/
  13. #ifndef _VDMNTOS_
  14. #define _VDMNTOS_
  15. //
  16. // Need this #include here because non-x86 ntos\vdm\vdm.c
  17. // references structures defined there.
  18. //
  19. #include "vdm.h"
  20. #if defined(i386)
  21. typedef struct _VDM_IO_LISTHEAD {
  22. PVDM_IO_HANDLER VdmIoHandlerList;
  23. ERESOURCE VdmIoResource;
  24. ULONG Context;
  25. } VDM_IO_LISTHEAD, *PVDM_IO_LISTHEAD;
  26. typedef struct _VDM_PROCESS_OBJECTS {
  27. PVDM_IO_LISTHEAD VdmIoListHead;
  28. KAPC QueuedIntApc;
  29. KAPC QueuedIntUserApc;
  30. FAST_MUTEX DelayIntFastMutex;
  31. KSPIN_LOCK DelayIntSpinLock;
  32. LIST_ENTRY DelayIntListHead;
  33. PVDMICAUSERDATA pIcaUserData;
  34. PETHREAD MainThread;
  35. PVDM_TIB VdmTib;
  36. PUCHAR PrinterState;
  37. PUCHAR PrinterControl;
  38. PUCHAR PrinterStatus;
  39. PUCHAR PrinterHostState;
  40. USHORT AdlibStatus;
  41. USHORT AdlibIndexRegister;
  42. USHORT AdlibPhysPortStart;
  43. USHORT AdlibPhysPortEnd;
  44. USHORT AdlibVirtPortStart;
  45. USHORT AdlibVirtPortEnd;
  46. USHORT AdlibAction;
  47. USHORT VdmControl; // See below
  48. ULONG PMCliTimeStamp;
  49. } VDM_PROCESS_OBJECTS, *PVDM_PROCESS_OBJECTS;
  50. //
  51. // VdmControl definition
  52. //
  53. #define PM_CLI_CONTROL 1
  54. typedef struct _DelayInterruptsIrq {
  55. LIST_ENTRY DelayIntListEntry;
  56. ULONG IrqLine;
  57. PETHREAD Thread;
  58. KDPC Dpc;
  59. KAPC Apc;
  60. KTIMER Timer;
  61. BOOLEAN InUse;
  62. PETHREAD MainThread;
  63. } DELAYINTIRQ, *PDELAYINTIRQ;
  64. #define VDMDELAY_NOTINUSE 0
  65. #define VDMDELAY_KTIMER 1
  66. #define VDMDELAY_PTIMER 2
  67. #define VDMDELAY_KAPC 3
  68. VOID
  69. VdmCheckPMCliTimeStamp (
  70. VOID
  71. );
  72. VOID
  73. VdmSetPMCliTimeStamp (
  74. BOOLEAN Reset
  75. );
  76. VOID
  77. VdmClearPMCliTimeStamp (
  78. VOID
  79. );
  80. BOOLEAN
  81. Ps386GetVdmIoHandler(
  82. IN PEPROCESS Process,
  83. IN ULONG PortNumber,
  84. OUT PVDM_IO_HANDLER VdmIoHandler,
  85. OUT PULONG Context
  86. );
  87. #define SEL_TYPE_READ 0x00000001
  88. #define SEL_TYPE_WRITE 0x00000002
  89. #define SEL_TYPE_EXECUTE 0x00000004
  90. #define SEL_TYPE_BIG 0x00000008
  91. #define SEL_TYPE_ED 0x00000010
  92. #define SEL_TYPE_2GIG 0x00000020
  93. #define SEL_TYPE_NP 0x00000040
  94. // NPX error exception dispatcher
  95. BOOLEAN
  96. VdmDispatchIRQ13(
  97. PKTRAP_FRAME TrapFrame
  98. );
  99. BOOLEAN
  100. VdmSkipNpxInstruction(
  101. PKTRAP_FRAME TrapFrame,
  102. ULONG Address32Bits,
  103. PUCHAR istream,
  104. ULONG InstructionSize
  105. );
  106. VOID
  107. VdmEndExecution(
  108. PKTRAP_FRAME TrapFrame,
  109. PVDM_TIB VdmTib
  110. );
  111. NTSTATUS
  112. VdmDispatchInterrupts(
  113. PKTRAP_FRAME TrapFrame,
  114. PVDM_TIB VdmTib
  115. );
  116. VOID
  117. VdmDispatchException(
  118. PKTRAP_FRAME TrapFrame,
  119. NTSTATUS ExcepCode,
  120. PVOID ExcepAddress,
  121. ULONG NumParms,
  122. ULONG Parm1,
  123. ULONG Parm2,
  124. ULONG Parm3
  125. );
  126. ULONG
  127. VdmFetchBop1 (
  128. IN PVOID Pc
  129. );
  130. ULONG
  131. VdmFetchBop4 (
  132. IN PVOID Pc
  133. );
  134. ULONG
  135. VdmFetchULONG (
  136. IN PVOID Pc
  137. );
  138. LOGICAL
  139. VdmDispatchBop (
  140. IN PKTRAP_FRAME TrapFrame
  141. );
  142. PVOID
  143. VdmTibPass1 (
  144. IN ULONG Cs,
  145. IN ULONG Eip,
  146. IN ULONG Ebx
  147. );
  148. VOID
  149. VdmRundownDpcs (
  150. IN PEPROCESS Process
  151. );
  152. ULONG
  153. VdmDispatchOpcodeV86_try (
  154. IN PKTRAP_FRAME TrapFrame
  155. );
  156. ULONG
  157. VdmDispatchOpcode_try (
  158. IN PKTRAP_FRAME TrapFrame
  159. );
  160. #define VdmGetTrapFrame(pKThread) \
  161. ((PKTRAP_FRAME)( (PUCHAR)(pKThread)->InitialStack - \
  162. sizeof(FX_SAVE_AREA) - \
  163. ((ULONG)(sizeof(KTRAP_FRAME)+KTRAP_FRAME_ROUND) \
  164. & ~(KTRAP_FRAME_ROUND)) \
  165. ) \
  166. )
  167. //
  168. // These values are defined here to describe the structure of an array
  169. // containing running counts of v86 opcode emulation. The array lives in
  170. // ke\i386, but is referenced in ex.
  171. //
  172. #define VDM_INDEX_Invalid 0
  173. #define VDM_INDEX_0F 1
  174. #define VDM_INDEX_ESPrefix 2
  175. #define VDM_INDEX_CSPrefix 3
  176. #define VDM_INDEX_SSPrefix 4
  177. #define VDM_INDEX_DSPrefix 5
  178. #define VDM_INDEX_FSPrefix 6
  179. #define VDM_INDEX_GSPrefix 7
  180. #define VDM_INDEX_OPER32Prefix 8
  181. #define VDM_INDEX_ADDR32Prefix 9
  182. #define VDM_INDEX_INSB 10
  183. #define VDM_INDEX_INSW 11
  184. #define VDM_INDEX_OUTSB 12
  185. #define VDM_INDEX_OUTSW 13
  186. #define VDM_INDEX_PUSHF 14
  187. #define VDM_INDEX_POPF 15
  188. #define VDM_INDEX_INTnn 16
  189. #define VDM_INDEX_INTO 17
  190. #define VDM_INDEX_IRET 18
  191. #define VDM_INDEX_NPX 19
  192. #define VDM_INDEX_INBimm 20
  193. #define VDM_INDEX_INWimm 21
  194. #define VDM_INDEX_OUTBimm 22
  195. #define VDM_INDEX_OUTWimm 23
  196. #define VDM_INDEX_INB 24
  197. #define VDM_INDEX_INW 25
  198. #define VDM_INDEX_OUTB 26
  199. #define VDM_INDEX_OUTW 27
  200. #define VDM_INDEX_LOCKPrefix 28
  201. #define VDM_INDEX_REPNEPrefix 29
  202. #define VDM_INDEX_REPPrefix 30
  203. #define VDM_INDEX_CLI 31
  204. #define VDM_INDEX_STI 32
  205. #define VDM_INDEX_HLT 33
  206. // The following value must be 1 more than the last defined index value
  207. #define MAX_VDM_INDEX 34
  208. //
  209. // This is the address of the Vdm communication area.
  210. //
  211. #define FIXED_NTVDMSTATE_LINEAR_PC_AT ((PLONG)0x714)
  212. extern ULONG VdmpMaxPMCliTime;
  213. #endif // i386
  214. #endif // _VDMNTOS_