📄 idevxd.asm
字号:
PAGE 58,132
;******************************************************************************
TITLE IDEVXD.ASM - Windows/386 for Overlay VxD
;******************************************************************************
; Version: 1.00
;==============================================================================
.386p
;******************************************************************************
; I N C L U D E S
;******************************************************************************
.xlist
include vmm.inc
include debug.inc
include IDEVXD.inc
.list
;============================================================================
; V I R T U A L D E V I C E D E C L A R A T I O N
;============================================================================
DECLARE_VIRTUAL_DEVICE IDECTRL, 1, 0,IDEVXD_Control, \
IDEVXD_Device_ID,UNDEFINED_INIT_ORDER
VXD_LOCKED_CODE_SEG
;===========================================================================
;
; PROCEDURE: IDEVXD_Control
;
; DESCRIPTION:
; Device control procedure for the IDEVXD.VXD
;
; ENTRY:
; EAX = Control call ID
;
; EXIT:
; If carry clear then
; Successful
; else
; Control call failed
;
; USES:
; EAX, EBX, ECX, EDX, ESI, EDI, Flags
;
;============================================================================
BeginProc IDEVXD_Control
Control_Dispatch SYS_DYNAMIC_DEVICE_INIT, IDEVXD_Init, sCall, <>
Control_Dispatch SYS_DYNAMIC_DEVICE_EXIT, IDEVXD_Exit, sCall, <>
Control_Dispatch W32_DEVICEIOCONTROL, IDEVXD_W32_DeviceIOControl, sCall, <ecx, ebx, edx, esi>
clc
ret
EndProc IDEVXD_Control
BeginProc _GetPhysicalFromLinear, PUBLIC
mov ecx, DWORD PTR [esp + 4] ;ECX contain Linear Address
push ebx
push eax ;reserve dword on stack
mov edx, esp ;EDX -> reserved dword
mov ebx, ecx ;borrow EBX
shr ecx, 12 ;ECX now contain Linear Page #
VMMCall _CopyPageTable <ecx, 1, edx, 0>;
pop edx ;EDX = Page table entry
test dl, P_PRES ;Did anyone map this linear ?
jz short PageNotPresent ;Nope, bad call
mov ecx, ebx ;Get Linear Address back
pop ebx
and dx, 0F000h ;Clear Flag bytes
and ecx, 0FFFh
or edx, ecx ;EDX = Physical Address
mov eax, edx ;Life is good, we got it.
jmp ExitingFunction
PageNotPresent:
xor eax, eax
pop ebx
ExitingFunction:
ret
EndProc _GetPhysicalFromLinear
BeginProc _CritEnter, PUBLIC
mov ecx, Block_Svc_Ints
VMMCall Begin_Critical_Section
ret
EndProc _CritEnter
BeginProc _CritLeave, PUBLIC
VMMCall End_Critical_Section
ret
EndProc _CritLeave
BeginProc _Sleep, PUBLIC
MiliSecond equ [esp + 4]
mov eax, DWORD PTR [MiliSecond]
VMMCall Time_Slice_Sleep
xor eax,eax
ret
EndProc _Sleep
VXD_LOCKED_CODE_ENDS
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -