ReactOS  0.4.15-dev-449-g64abd9f
vdm.h File Reference

Go to the source code of this file.

Classes

struct  _Vdm_InterruptHandler
 
struct  _Vdm_FaultHandler
 
struct  _VdmEventInfo
 
struct  _Vdm_Printer_Info
 
struct  _VdmTraceInfo
 
struct  _tagFAMILY_TABLE
 
struct  _Vdm_Tib
 
struct  _VDM_PROCESS_OBJECTS
 

Macros

#define _VM_DEBUG_   0x00
 
#define VM_EXEC_DEBUG   0x01
 
#define VMTRACE(x, fmt, ...)   DPRINT(fmt, ##__VA_ARGS__)
 
#define TRAMPOLINE_BASE   0x10000
 
#define TRAMPOLINE_TIB   0x12000
 
#define TRAMPOLINE_TEB   0x13000
 
#define TRAMPOLINE_BOP   0xFEC4C4
 
#define VdmState   (PULONG)FIXED_NTVDMSTATE_LINEAR_PC_AT
 

Typedefs

typedef enum _VdmEventClass VDMEVENTCLASS
 
typedef enum _VdmEventClassPVDMEVENTCLASS
 
typedef struct _Vdm_InterruptHandler VDM_INTERRUPTHANDLER
 
typedef struct _Vdm_InterruptHandlerPVDM_INTERRUPTHANDLER
 
typedef struct _Vdm_FaultHandler VDM_FAULTHANDLER
 
typedef struct _Vdm_FaultHandlerPVDM_FAULTHANDLER
 
typedef struct _VdmEventInfo VDMEVENTINFO
 
typedef struct _VdmEventInfoPVDMEVENTINFO
 
typedef struct _Vdm_Printer_Info VDM_PRINTER_INFO
 
typedef struct _Vdm_Printer_InfoPVDM_PRINTER_INFO
 
typedef struct _VdmTraceInfo VDMTRACEINFO
 
typedef struct _VdmTraceInfoPVDMTRACEINFO
 
typedef struct _tagFAMILY_TABLE FAMILY_TABLE
 
typedef struct _tagFAMILY_TABLEPFAMILY_TABLE
 
typedef struct _Vdm_Tib VDM_TIB
 
typedef struct _Vdm_TibPVDM_TIB
 
typedef struct _VDM_PROCESS_OBJECTS VDM_PROCESS_OBJECTS
 
typedef struct _VDM_PROCESS_OBJECTSPVDM_PROCESS_OBJECTS
 

Enumerations

enum  _VdmEventClass {
  VdmIO, VdmStringIO, VdmMemAccess, VdmIntAck,
  VdmBop, VdmError, VdmIrq13
}
 

Functions

NTSTATUS NTAPI VdmpStartExecution (VOID)
 

Macro Definition Documentation

◆ _VM_DEBUG_

#define _VM_DEBUG_   0x00

Definition at line 12 of file vdm.h.

◆ TRAMPOLINE_BASE

#define TRAMPOLINE_BASE   0x10000

Definition at line 36 of file vdm.h.

◆ TRAMPOLINE_BOP

#define TRAMPOLINE_BOP   0xFEC4C4

Definition at line 43 of file vdm.h.

◆ TRAMPOLINE_TEB

#define TRAMPOLINE_TEB   0x13000

Definition at line 38 of file vdm.h.

◆ TRAMPOLINE_TIB

#define TRAMPOLINE_TIB   0x12000

Definition at line 37 of file vdm.h.

◆ VdmState

Definition at line 48 of file vdm.h.

◆ VM_EXEC_DEBUG

#define VM_EXEC_DEBUG   0x01

Definition at line 17 of file vdm.h.

◆ VMTRACE

#define VMTRACE (   x,
  fmt,
  ... 
)    DPRINT(fmt, ##__VA_ARGS__)

Definition at line 30 of file vdm.h.

Typedef Documentation

◆ FAMILY_TABLE

◆ PFAMILY_TABLE

◆ PVDM_FAULTHANDLER

◆ PVDM_INTERRUPTHANDLER

◆ PVDM_PRINTER_INFO

◆ PVDM_PROCESS_OBJECTS

◆ PVDM_TIB

◆ PVDMEVENTCLASS

◆ PVDMEVENTINFO

◆ PVDMTRACEINFO

◆ VDM_FAULTHANDLER

◆ VDM_INTERRUPTHANDLER

◆ VDM_PRINTER_INFO

◆ VDM_PROCESS_OBJECTS

◆ VDM_TIB

◆ VDMEVENTCLASS

◆ VDMEVENTINFO

◆ VDMTRACEINFO

Enumeration Type Documentation

◆ _VdmEventClass

Enumerator
VdmIO 
VdmStringIO 
VdmMemAccess 
VdmIntAck 
VdmBop 
VdmError 
VdmIrq13 

Definition at line 54 of file vdm.h.

55 {
56  VdmIO,
59  VdmIntAck,
60  VdmBop,
61  VdmError,
62  VdmIrq13
Definition: vdm.h:62
Definition: vdm.h:56
enum _VdmEventClass VDMEVENTCLASS
Definition: vdm.h:60
enum _VdmEventClass * PVDMEVENTCLASS
Definition: vdm.h:59
Definition: vdm.h:61

Function Documentation

◆ VdmpStartExecution()

NTSTATUS NTAPI VdmpStartExecution ( VOID  )

Definition at line 171 of file vdmexec.c.

172 {
174  PKTRAP_FRAME VdmFrame;
176  PVDM_TIB VdmTib;
177  BOOLEAN Interrupts;
178  KIRQL OldIrql;
179  CONTEXT VdmContext;
180  PAGED_CODE();
181 
182  /* Get the thread's VDM frame and TIB */
183  VdmFrame = (PVOID)((ULONG_PTR)Thread->Tcb.InitialStack -
184  sizeof(FX_SAVE_AREA) -
185  sizeof(KTRAP_FRAME));
186  Status = VdmpGetVdmTib(&VdmTib);
188 
189  /* Go to APC level */
191 
192  /* Check if interrupts are enabled */
193  Interrupts = (BOOLEAN)(VdmTib->VdmContext.EFlags & EFLAGS_INTERRUPT_MASK);
194 
195  /* We don't support full VDM yet, this shouldn't happen */
196  ASSERT(*VdmState == 0);
198 
199  /* Check if VME is supported and V86 mode was enabled */
201  (VdmTib->VdmContext.EFlags & EFLAGS_V86_MASK))
202  {
203  /* Check if interrupts are enabled */
204  if (Interrupts)
205  {
206  /* Set fake IF flag */
207  VdmTib->VdmContext.EFlags |= EFLAGS_VIF;
208  }
209  else
210  {
211  /* Remove fake IF flag, turn on real IF flag */
212  VdmTib->VdmContext.EFlags &= ~EFLAGS_VIF;
214  }
215  }
216  else
217  {
218  /* Set interrupt state in the VDM State */
220  {
221  /* Enable them as well */
223  }
224  else
225  {
226  /* Disable them */
228  }
229 
230  /* Enable the interrupt flag */
232  }
233 
234  /* Get the VDM context and make sure it's not an edited frame */
235  VdmContext = VdmTib->VdmContext;
236  if (!(VdmContext.SegCs & FRAME_EDITED))
237  {
238  /* Fail */
241  }
242 
243  /* Now do the VDM Swap */
244  VdmSwapContext(VdmFrame, &VdmTib->MonitorContext, &VdmContext);
245 
246  /* Lower the IRQL and return EAX */
248  return VdmFrame->Eax;
249 }
#define InterlockedAnd
Definition: interlocked.h:62
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
Definition: vdm.h:134
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
#define VdmState
Definition: vdm.h:48
CONTEXT VdmContext
Definition: vdm.h:140
LONG NTSTATUS
Definition: precomp.h:26
KTHREAD Tcb
Definition: pstypes.h:1042
#define EFLAGS_V86_MASK
Definition: ketypes.h:129
uint32_t ULONG_PTR
Definition: typedefs.h:64
UCHAR KIRQL
Definition: env_spec_w32.h:591
ULONG Eax
Definition: ketypes.h:258
ULONG SegCs
Definition: nt_native.h:1477
unsigned char BOOLEAN
ULONG EFlags
Definition: nt_native.h:1478
void * PVOID
Definition: retypes.h:9
struct _FX_SAVE_AREA FX_SAVE_AREA
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
CONTEXT MonitorContext
Definition: vdm.h:139
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define EFLAGS_VIF
Definition: ketypes.h:131
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
#define InterlockedOr
Definition: interlocked.h:224
Status
Definition: gdiplustypes.h:24
VOID NTAPI VdmSwapContext(IN PKTRAP_FRAME TrapFrame, IN PCONTEXT OutContext, IN PCONTEXT InContext)
Definition: vdmexec.c:45
NTSTATUS NTAPI VdmpGetVdmTib(OUT PVDM_TIB *VdmTib)
Definition: vdmexec.c:23
#define BOOLEAN
Definition: pedump.c:73
#define STATUS_INVALID_SYSTEM_SERVICE
Definition: ntstatus.h:251
#define FRAME_EDITED
Definition: ke.h:64
BOOLEAN KeI386VirtualIntExtensions
Definition: v86vdm.c:24
signed int * PLONG
Definition: retypes.h:5
PVOID InitialStack
Definition: ketypes.h:1554
#define APC_LEVEL
Definition: env_spec_w32.h:695
#define PAGED_CODE()
#define EFLAGS_INTERRUPT_MASK
Definition: ketypes.h:126

Referenced by NtVdmControl().