ReactOS 0.4.15-dev-7711-g5627da4
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,
60 VdmBop,
@ VdmBop
Definition: vdm.h:60
@ VdmIrq13
Definition: vdm.h:62
@ VdmIntAck
Definition: vdm.h:59
@ VdmStringIO
Definition: vdm.h:57
@ VdmMemAccess
Definition: vdm.h:58
@ VdmError
Definition: vdm.h:61
@ VdmIO
Definition: vdm.h:56
enum _VdmEventClass * PVDMEVENTCLASS
enum _VdmEventClass VDMEVENTCLASS

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;
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 */
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 PAGED_CODE()
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define APC_LEVEL
Definition: env_spec_w32.h:695
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
Status
Definition: gdiplustypes.h:25
#define InterlockedOr
Definition: interlocked.h:224
#define InterlockedAnd
Definition: interlocked.h:62
#define ASSERT(a)
Definition: mode.c:44
#define EFLAGS_INTERRUPT_MASK
Definition: ketypes.h:187
#define EFLAGS_V86_MASK
Definition: ketypes.h:193
#define EFLAGS_VIF
Definition: ketypes.h:195
struct _FX_SAVE_AREA FX_SAVE_AREA
#define FRAME_EDITED
Definition: ke.h:68
BOOLEAN KeI386VirtualIntExtensions
Definition: v86vdm.c:24
#define VdmState
Definition: vdm.h:48
#define STATUS_INVALID_SYSTEM_SERVICE
Definition: ntstatus.h:265
#define BOOLEAN
Definition: pedump.c:73
ULONG SegCs
Definition: nt_native.h:1477
ULONG EFlags
Definition: nt_native.h:1478
KTHREAD Tcb
Definition: pstypes.h:1103
PVOID InitialStack
Definition: ketypes.h:1664
ULONG Eax
Definition: ketypes.h:310
Definition: vdm.h:135
CONTEXT VdmContext
Definition: vdm.h:140
CONTEXT MonitorContext
Definition: vdm.h:139
void * PVOID
Definition: typedefs.h:50
uint32_t ULONG_PTR
Definition: typedefs.h:65
int32_t * PLONG
Definition: typedefs.h:58
NTSTATUS NTAPI VdmpGetVdmTib(OUT PVDM_TIB *VdmTib)
Definition: vdmexec.c:23
VOID NTAPI VdmSwapContext(IN PKTRAP_FRAME TrapFrame, IN PCONTEXT OutContext, IN PCONTEXT InContext)
Definition: vdmexec.c:45
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778

Referenced by NtVdmControl().