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.

255 lines
5.8 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. #define VdmGetTrapFrame(pKThread) \
  157. ((PKTRAP_FRAME)( (PUCHAR)(pKThread)->InitialStack - \
  158. sizeof(FX_SAVE_AREA) - \
  159. ((ULONG)(sizeof(KTRAP_FRAME)+KTRAP_FRAME_ROUND) \
  160. & ~(KTRAP_FRAME_ROUND)) \
  161. ) \
  162. )
  163. //
  164. // These values are defined here to describe the structure of an array
  165. // containing running counts of v86 opcode emulation. The array lives in
  166. // ke\i386, but is referenced in ex.
  167. //
  168. #define VDM_INDEX_Invalid 0
  169. #define VDM_INDEX_0F 1
  170. #define VDM_INDEX_ESPrefix 2
  171. #define VDM_INDEX_CSPrefix 3
  172. #define VDM_INDEX_SSPrefix 4
  173. #define VDM_INDEX_DSPrefix 5
  174. #define VDM_INDEX_FSPrefix 6
  175. #define VDM_INDEX_GSPrefix 7
  176. #define VDM_INDEX_OPER32Prefix 8
  177. #define VDM_INDEX_ADDR32Prefix 9
  178. #define VDM_INDEX_INSB 10
  179. #define VDM_INDEX_INSW 11
  180. #define VDM_INDEX_OUTSB 12
  181. #define VDM_INDEX_OUTSW 13
  182. #define VDM_INDEX_PUSHF 14
  183. #define VDM_INDEX_POPF 15
  184. #define VDM_INDEX_INTnn 16
  185. #define VDM_INDEX_INTO 17
  186. #define VDM_INDEX_IRET 18
  187. #define VDM_INDEX_NPX 19
  188. #define VDM_INDEX_INBimm 20
  189. #define VDM_INDEX_INWimm 21
  190. #define VDM_INDEX_OUTBimm 22
  191. #define VDM_INDEX_OUTWimm 23
  192. #define VDM_INDEX_INB 24
  193. #define VDM_INDEX_INW 25
  194. #define VDM_INDEX_OUTB 26
  195. #define VDM_INDEX_OUTW 27
  196. #define VDM_INDEX_LOCKPrefix 28
  197. #define VDM_INDEX_REPNEPrefix 29
  198. #define VDM_INDEX_REPPrefix 30
  199. #define VDM_INDEX_CLI 31
  200. #define VDM_INDEX_STI 32
  201. #define VDM_INDEX_HLT 33
  202. // The following value must be 1 more than the last defined index value
  203. #define MAX_VDM_INDEX 34
  204. //
  205. // This is the address of the Vdm communication area.
  206. //
  207. #define FIXED_NTVDMSTATE_LINEAR_PC_AT ((PLONG)0x714)
  208. extern ULONG VdmpMaxPMCliTime;
  209. #endif // i386
  210. #endif // _VDMNTOS_