📄 vxmain.asm
字号:
;----------------------------------------------------------------------------
;COPYRIGHT (c) 1995 by Philips Semiconductors
;
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED AND COPIED IN
;ACCORDANCE WITH THE TERMS AND CONDITIONS OF SUCH A LICENSE AND WITH THE
;INCLUSION OF THE THIS COPY RIGHT NOTICE. THIS SOFTWARE OR ANY OTHER COPIES
;OF THIS SOFTWARE MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER
;PERSON. THE OWNERSHIP AND TITLE OF THIS SOFTWARE IS NOT TRANSFERRED.
;
;THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT ANY PRIOR NOTICE
;AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY Philips Semiconductor.
;
;PHILIPS ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF THIS SOFTWARE
;ON PLATFORMS OTHER THAN THE ONE ON WHICH THIS SOFTWARE IS FURNISHED.
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
; HISTORY
; 950919 TR Created
; 960209 TR modified all return code to Success = TRUE , Fail = FALSE
;---------------------------------------------------------------------------;
.386p
;---------------------------------------------------------------------------;
; SYSTEM INCLUDES
;---------------------------------------------------------------------------;
.xlist
include vmm.inc
include debug.inc
include shell.inc
include vpicd.inc
include vdmad.inc
;---------------------------------------------------------------------------;
; vtmman SPECIFIC INCLUDE
;---------------------------------------------------------------------------;
include vtmman.inc
.list
VTMMAN_DYNAMIC EQU 1
;---------------------------------------------------------------------------;
; IMPORTED FUCTIONS - INITIALIZATION
;---------------------------------------------------------------------------;
VxD_ICODE_SEG
VxD_ICODE_ENDS
;---------------------------------------------------------------------------;
; NONPAGEABLE DATA
;---------------------------------------------------------------------------;
VxD_LOCKED_DATA_SEG
VxD_LOCKED_DATA_ENDS
;---------------------------------------------------------------------------;
; VXD VIRTUAL DEVICE DECLARATION
;---------------------------------------------------------------------------;
Declare_Virtual_Device \
TMMAN, \
TMMAN_Ver_Major, \
TMMAN_Ver_Minor, \
TMMAN_Control, \
TMMAN_Device_ID , \
UNDEFINED_INIT_ORDER
;---------------------------------------------------------------------------;
; INITIALIZATION TIME ONLY DATA
;---------------------------------------------------------------------------;
VxD_IDATA_SEG
VxD_IDATA_ENDS
;---------------------------------------------------------------------------;
; PAGEABLE DATA ( 4.0 )
;---------------------------------------------------------------------------;
VxD_DATA_SEG
VxD_DATA_ENDS
;---------------------------------------------------------------------------;
; ICODE
;---------------------------------------------------------------------------;
VxD_ICODE_SEG
VXD_ICODE_ENDS
;---------------------------------------------------------------------------;
; LCODE - NON PAGABLE CODE
;---------------------------------------------------------------------------;
;---------------------------------------------------------------------------;
; IMPORTED FUCTIONS - LOCKED
;---------------------------------------------------------------------------;
VxD_LOCKED_CODE_SEG
extern _halHardwareInterruptHandler:NEAR
extern _halDeferredInterruptHandler:NEAR
VxD_LOCKED_CODE_ENDS
;---------------------------------------------------------------------------;
; IMPORTED FUCTIONS - PAGABLE
;---------------------------------------------------------------------------;
VxD_PAGEABLE_CODE_SEG
;extern _FunctionName:NEAR here
VxD_PAGEABLE_CODE_ENDS
VxD_LOCKED_CODE_SEG
;---------------------------------------------------------------------------;
; FUNC TMMAN_Control - Locked Code
;
; ENTRY
;
; EXIT
; SUCCESS - Carry flag = 0
; ERROR - Carry flag = 1
;
; ABOUT
; Dispatch control messages to the correct handlers. Must be in locked
; code segment. (All VxD segments are locked in 3.0 and 3.1). This entry
; point is registered in the VI960 Device DriverBlock.
;---------------------------------------------------------------------------;
BeginProc TMMAN_Control
Control_Dispatch Sys_Dynamic_Device_Init, DriverEntry, sCall, <>
Control_Dispatch Sys_Dynamic_Device_Exit, DriverExit, sCall, <>
Control_Dispatch W32_DEVICEIOCONTROL, tmmanDeviceControl, sCall, <ecx, ebx, edx, esi>
Control_Dispatch Pnp_New_DevNode, vxdConfigRegisterHandler, sCall, <ebx, edx, eax>
clc
ret
EndProc TMMAN_Control
;---------------------------------------------------------------------------;
;------------------------------------------------------------------------------
; FUNC vxdIRQHandlerA - Locked Code
;
; ENTRY
; EAX - IRQ Handle
; EBX - VM Handle
; EDX - Context
;
; EXIT
; Carry Set - Interrupt was not handeled by VxD.
; Carry Clear - Interrupt was Handeled by VxD.
;
;------------------------------------------------------------------------------
BeginProc _vxdIRQHandlerA, PUBLIC, High_Freq
push edi
push edx
push eax
push ebx
call _halHardwareInterruptHandler
; tmman can share interrupts, so this function returns a
; true - if the interrupt was handled by tmman
; false - if the interrupt was not handled by tmman
; check for the return code and accordingly return stc or clc
add esp, 4 * 3
or eax,eax
jz vxdIRQHandlerFail
pop edi
clc
ret
vxdIRQHandlerFail:
pop edi
stc
ret
EndProc _vxdIRQHandlerA
;vxdDPCHandlerC ( DWORD dwVMHandle, PVOID pContext, PVOID pClientRegister )
BeginProc _vxdDPCHandlerA, PUBLIC, High_Freq
push ebp ; Cleint Struct
push edx ; Context
push ebx ; VMHandle
call _halDeferredInterruptHandler
pop ebx
pop edx
pop ebp
cld
ret
EndProc _vxdDPCHandlerA
;----------------------------------------------------------------------------
;FUNC TraceString
;
;PROTO VOID TraceString ( PBYTE pString );
;
;ABOUT
; This fucntion accepts a string and dumps to the mono-chrome monitor
; under SoftIce/W. CR+LF is not appended by this fucntion.
;----------------------------------------------------------------------------
BeginProc vxdTraceString, CCALL, PUBLIC
ArgVar pString, DWORD
EnterProc
pushfd
pushad
mov esi, pString
VMMcall Out_Debug_String
popad
popfd
LeaveProc
return
EndProc vxdTraceString
;-----------------------------------------------------------------------------
; FUNC vxdEnterCritical
;
; PROTO VOID vxdEnterCritical( VOID )
;
; ABOUT
; Meant to be called from a High-Level language program.
; Does the equivalent of
; pushf
; cli
;
; You _must_ call vxdLeaveCritical() after calling this function, but before
; getting out of the calling function. Otherwise the stack will be
; screwed up.
;-----------------------------------------------------------------------------
BeginProc vxdEnterCritical, PUBLIC, CCALL
ArgVar pdwFlags, DWORD
EnterProc
push esi
mov esi, pdwFlags
pushfd
pop [esi]
cli
IFDEF DEBUG
;Trace_Out "[", nocrlf
ENDIF
pop esi ; Restore EIP to return to
LeaveProc
return
EndProc vxdEnterCritical
;-----------------------------------------------------------------------------
; FUNC vxdLeaveCritical
;
; PROTO VOID vxdLeaveCritical ( VOID )
;
; ABOUT
; Meant to be called from a High-Level language program.
; Does the equivalent of
; popf
;
; You _must_ call vxdEnterCritical() before calling this function. Otherwise
; the stack will be screwed up.
;-----------------------------------------------------------------------------
BeginProc vxdLeaveCritical, PUBLIC, CCALL
ArgVar dwFlags, DWORD
EnterProc
push dwFlags
popfd
IFDEF DEBUG
;Trace_Out "]", nocrlf
ENDIF
LeaveProc
return
EndProc vxdLeaveCritical
;VxD_LOCKED_CODE_ENDS
;-------------------------------------------------------------------------------
; vxdConvert2Linear
; This function is used to convert a VM address to a linear pointer.
;
; EXIT :
; eax = 0 - SUCCESS
; eax = ffffffff - ERROR
;-------------------------------------------------------------------------------
BeginProc vxdConvert2Linear , PUBLIC, CCALL
ArgVar dwVMHandle, DWORD
ArgVar wSelector, WORD
ArgVar wOffset, WORD
ArgVar pdwLinear, DWORD
EnterProc
push ebx
; mov ebx, dwVMHandle
; movzx eax, wSelector
VMMCall _SelectorMapFlat < dwVMHandle , wSelector, 0 >
cmp eax, 0ffffffffh
je vxdConvert2Linear_Exit
movzx ebx, wOffset
add eax, ebx
mov ebx, [pdwLinear]
mov [ebx] , eax
xor eax, eax ; indicate success
vxdConvert2Linear_Exit:
pop ebx
LeaveProc
return ; eax is ffffffff - error code
EndProc vxdConvert2Linear
;VxD_PAGEABLE_CODE_ENDS
VxD_LOCKED_CODE_ENDS
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -