📄 vmm.h
字号:
/*
* Thread status indicates globally interesting thread states.
* Flags are for information only and must not be modified.
*/
#define THFLAG_SUSPENDED_BIT 0x03 // Thread not scheduled
#define THFLAG_SUSPENDED (1L << THFLAG_SUSPENDED_BIT)
#define THFLAG_NOT_EXECUTEABLE_BIT 0x04 // Thread partially destroyed
#define THFLAG_NOT_EXECUTEABLE (1L << THFLAG_NOT_EXECUTEABLE_BIT)
#define THFLAG_THREAD_CREATION_BIT 0x08 // Thread in status nascendi
#define THFLAG_THREAD_CREATION (1L << THFLAG_THREAD_CREATION_BIT)
#define THFLAG_THREAD_BLOCKED_BIT 0x0A // Blocked on semaphore
#define THFLAG_THREAD_BLOCKED (1L << THFLAG_THREAD_BLOCKED_BIT)
#define THFLAG_RING0_THREAD_BIT 0x1C // thread runs only at ring 0
#define THFLAG_RING0_THREAD (1L << THFLAG_RING0_THREAD_BIT)
#define THFLAG_ASYNC_THREAD_BIT 0x1F // thread is asynchronous
#define THFLAG_ASYNC_THREAD (1L << THFLAG_ASYNC_THREAD_BIT)
#define THFLAG_CHARSET_BITS 0x10 // Default character set
#define THFLAG_CHARSET_MASK (3L << THFLAG_CHARSET_BITS)
#define THFLAG_ANSI (0L << THFLAG_CHARSET_BITS)
#define THFLAG_OEM (1L << THFLAG_CHARSET_BITS)
#define THFLAG_UNICODE (2L << THFLAG_CHARSET_BITS)
#define THFLAG_RESERVED (3L << THFLAG_CHARSET_BITS)
#define THFLAG_EXTENDED_HANDLES_BIT 0x12 // Thread uses extended file handles
#define THFLAG_EXTENDED_HANDLES (1L << THFLAG_EXTENDED_HANDLES_BIT)
/* the win32 loader opens win32 exes with this bit set to notify IFS
* so a defragger won't move these files
* the bit is turned off once the open completes.
* file open flags are overloaded which is why this is here
*/
#define THFLAG_OPEN_AS_IMMOVABLE_FILE_BIT 0x13 // File thus opened not moved
#define THFLAG_OPEN_AS_IMMOVABLE_FILE (1L << THFLAG_OPEN_AS_IMMOVABLE_FILE_BIT)
/*
* Protected mode application control blocks
*/
struct pmcb_s {
ULONG PMCB_Flags;
ULONG PMCB_Parent;
};
/*
* The reference data for fault error codes 1-5 (GSDVME_PRIVINST through
* GSDVME_INVALFLT) is a pointer to the following fault information structure.
*/
struct VMFaultInfo {
ULONG VMFI_EIP; // faulting EIP
WORD VMFI_CS; // faulting CS
WORD VMFI_Ints; // interrupts in service, if any
};
typedef struct VMFaultInfo *PVMFaultInfo;
/******************************************************************************
* V M M S E R V I C E S
******************************************************************************/
/*XLATOFF*/
#define VMM_Service Declare_Service
#define VMM_StdCall_Service Declare_SCService
#define VMM_FastCall_Service Declare_SCService
#pragma warning (disable:4003) // turn off not enough params warning
/*XLATON*/
/*MACROS*/
Begin_Service_Table(VMM, VMM)
VMM_Service (Get_VMM_Version, LOCAL) // MUST REMAIN SERVICE 0!
VMM_Service (Get_Cur_VM_Handle)
VMM_Service (Test_Cur_VM_Handle)
VMM_Service (Get_Sys_VM_Handle)
VMM_Service (Test_Sys_VM_Handle)
VMM_Service (Validate_VM_Handle)
VMM_Service (Get_VMM_Reenter_Count)
VMM_Service (Begin_Reentrant_Execution)
VMM_Service (End_Reentrant_Execution)
VMM_Service (Install_V86_Break_Point)
VMM_Service (Remove_V86_Break_Point)
VMM_Service (Allocate_V86_Call_Back)
VMM_Service (Allocate_PM_Call_Back)
VMM_Service (Call_When_VM_Returns)
VMM_Service (Schedule_Global_Event)
VMM_Service (Schedule_VM_Event)
VMM_Service (Call_Global_Event)
VMM_Service (Call_VM_Event)
VMM_Service (Cancel_Global_Event)
VMM_Service (Cancel_VM_Event)
VMM_Service (Call_Priority_VM_Event)
VMM_Service (Cancel_Priority_VM_Event)
VMM_Service (Get_NMI_Handler_Addr)
VMM_Service (Set_NMI_Handler_Addr)
VMM_Service (Hook_NMI_Event)
VMM_Service (Call_When_VM_Ints_Enabled)
VMM_Service (Enable_VM_Ints)
VMM_Service (Disable_VM_Ints)
VMM_Service (Map_Flat)
VMM_Service (Map_Lin_To_VM_Addr)
// Scheduler services
VMM_Service (Adjust_Exec_Priority)
VMM_Service (Begin_Critical_Section)
VMM_Service (End_Critical_Section)
VMM_Service (End_Crit_And_Suspend)
VMM_Service (Claim_Critical_Section)
VMM_Service (Release_Critical_Section)
VMM_Service (Call_When_Not_Critical)
VMM_Service (Create_Semaphore)
VMM_Service (Destroy_Semaphore)
VMM_Service (Wait_Semaphore)
VMM_Service (Signal_Semaphore)
VMM_Service (Get_Crit_Section_Status)
VMM_Service (Call_When_Task_Switched)
VMM_Service (Suspend_VM)
VMM_Service (Resume_VM)
VMM_Service (No_Fail_Resume_VM)
VMM_Service (Nuke_VM)
VMM_Service (Crash_Cur_VM)
VMM_Service (Get_Execution_Focus)
VMM_Service (Set_Execution_Focus)
VMM_Service (Get_Time_Slice_Priority)
VMM_Service (Set_Time_Slice_Priority)
VMM_Service (Get_Time_Slice_Granularity)
VMM_Service (Set_Time_Slice_Granularity)
VMM_Service (Get_Time_Slice_Info)
VMM_Service (Adjust_Execution_Time)
VMM_Service (Release_Time_Slice)
VMM_Service (Wake_Up_VM)
VMM_Service (Call_When_Idle)
VMM_Service (Get_Next_VM_Handle)
// Time-out and system timer services
VMM_Service (Set_Global_Time_Out)
VMM_Service (Set_VM_Time_Out)
VMM_Service (Cancel_Time_Out)
VMM_Service (Get_System_Time)
VMM_Service (Get_VM_Exec_Time)
VMM_Service (Hook_V86_Int_Chain)
VMM_Service (Get_V86_Int_Vector)
VMM_Service (Set_V86_Int_Vector)
VMM_Service (Get_PM_Int_Vector)
VMM_Service (Set_PM_Int_Vector)
VMM_Service (Simulate_Int)
VMM_Service (Simulate_Iret)
VMM_Service (Simulate_Far_Call)
VMM_Service (Simulate_Far_Jmp)
VMM_Service (Simulate_Far_Ret)
VMM_Service (Simulate_Far_Ret_N)
VMM_Service (Build_Int_Stack_Frame)
VMM_Service (Simulate_Push)
VMM_Service (Simulate_Pop)
// Heap Manager
VMM_Service (_HeapAllocate)
VMM_Service (_HeapReAllocate)
VMM_Service (_HeapFree)
VMM_Service (_HeapGetSize)
/*ENDMACROS*/
/****************************************************
*
* Flags for heap allocator calls
*
* NOTE: HIGH 8 BITS (bits 24-31) are reserved
*
***************************************************/
//
// Flags affecting the returned block
//
#define HEAPZEROINIT 0x00000001
#define HEAPZEROREINIT 0x00000002
#define HEAPNOCOPY 0x00000004
//
// Alignment flags
//
#define HEAPALIGN_SHIFT 16
#define HEAPALIGN_MASK 0x000F0000
#define HEAPALIGN_4 0x00000000 // dword aligned
#define HEAPALIGN_8 0x00000000 // quadword aligned
#define HEAPALIGN_16 0x00000000 // paragraph aligned
#define HEAPALIGN_32 0x00010000 // etc.
#define HEAPALIGN_64 0x00020000
#define HEAPALIGN_128 0x00030000
#define HEAPALIGN_256 0x00040000
#define HEAPALIGN_512 0x00050000
#define HEAPALIGN_1K 0x00060000
#define HEAPALIGN_2K 0x00070000
#define HEAPALIGN_4K 0x00080000
#define HEAPALIGN_8K 0x00090000
#define HEAPALIGN_16K 0x000A0000
#define HEAPALIGN_32K 0x000B0000
#define HEAPALIGN_64K 0x000C0000
#define HEAPALIGN_128K 0x000D0000
//
// Flags indicating which system heap to use. There are four bits reserved
// to identify the heap to use. Four are currently defined by the system.
//
#define HEAPTYPESHIFT 8
#define HEAPTYPEMASK 0x00000700
#define HEAPLOCKEDHIGH 0x00000000
#define HEAPLOCKEDIFDP 0x00000100
#define HEAPSWAP 0x00000200
#define HEAPINIT 0x00000400 // will be automatically freed after
// init complete
//
// other flags
//
#define HEAPCLEAN 0x00000800
#define HEAPCONTIG 0x00001000 // memory must be physically contiguous
#define HEAPFORGET 0x00002000 // this memory will never be freed
//
// Combinations of flags understood by HeapAllocateEx
//
#define HEAPLOCKEDLOW 0x00000300
#define HEAPSYSVM 0x00000500
#define HEAPPREEMPT 0x00000600 // code in this heap is preemptable
// Page Manager
/*MACROS*/
VMM_Service (_PageAllocate)
VMM_Service (_PageReAllocate)
VMM_Service (_PageFree)
VMM_Service (_PageLock)
VMM_Service (_PageUnLock)
VMM_Service (_PageGetSizeAddr)
VMM_Service (_PageGetAllocInfo)
VMM_Service (_GetFreePageCount)
VMM_Service (_GetSysPageCount)
VMM_Service (_GetVMPgCount)
VMM_Service (_MapIntoV86)
VMM_Service (_PhysIntoV86)
VMM_Service (_TestGlobalV86Mem)
VMM_Service (_ModifyPageBits)
VMM_Service (_CopyPageTable)
VMM_Service (_LinMapIntoV86)
VMM_Service (_LinPageLock)
VMM_Service (_LinPageUnLock)
VMM_Service (_SetResetV86Pageable)
VMM_Service (_GetV86PageableArray)
VMM_Service (_PageCheckLinRange)
VMM_Service (_PageOutDirtyPages)
VMM_Service (_PageDiscardPages)
/*ENDMACROS*/
/****************************************************
*
* Flags for other page allocator calls
*
* NOTE: HIGH 8 BITS (bits 24-31) are reserved
*
***************************************************/
#define PAGEZEROINIT 0x00000001
#define PAGEUSEALIGN 0x00000002
#define PAGECONTIG 0x00000004
#define PAGEFIXED 0x00000008
#define PAGEDEBUGNULFAULT 0x00000010
#define PAGEZEROREINIT 0x00000020
#define PAGENOCOPY 0x00000040
#define PAGELOCKED 0x00000080
#define PAGELOCKEDIFDP 0x00000100
#define PAGESETV86PAGEABLE 0x00000200
#define PAGECLEARV86PAGEABLE 0x00000400
#define PAGESETV86INTSLOCKED 0x00000800
#define PAGECLEARV86INTSLOCKED 0x00001000
#define PAGEMARKPAGEOUT 0x00002000
#define PAGEPDPSETBASE 0x00004000
#define PAGEPDPCLEARBASE 0x00008000
#define PAGEDISCARD 0x00010000
#define PAGEPDPQUERYDIRTY 0x00020000
#define PAGEMAPFREEPHYSREG 0x00040000
#define PAGEPHYSONLY 0x04000000
//efine PAGEDONTUSE 0x08000000 // ;Internal
#define PAGENOMOVE 0x10000000
#define PAGEMAPGLOBAL 0x40000000
#define PAGEMARKDIRTY 0x80000000
/****************************************************
*
* Flags for _PhysIntoV86,
* _MapIntoV86, and _LinMapIntoV86
*
***************************************************/
#define MAPV86_IGNOREWRAP 0x00000001
/****************************************************
*
* Flags for MapPhysToLinear
*
*
***************************************************/
#define MPL_NonCached 0x00000000
#define MPL_HardwareCoherentCached 0x00000001
#define MPL_FrameBufferCached 0x00000002
#define MPL_Cached 0x00000004
#define MPL_Undoable 0x00000008
#define MPL_Flags 0x0000000F // OR of the above
// Informational services
/*MACROS*/
VMM_Service (_GetNulPageHandle)
VMM_Service (_GetFirstV86Page)
VMM_Service (_MapPhysToLinear)
VMM_Service (_GetAppFlatDSAlias)
VMM_Service (_SelectorMapFlat)
VMM_Service (_GetDemandPageInfo)
VMM_Service (_GetSetPageOutCount)
/*ENDMACROS*/
/*
* Flags bits for _GetSetPageOutCount
*/
#define GSPOC_F_GET 0x00000001
// Device VM page manager
/*MACROS*/
VMM_Service (Hook_V86_Page)
VMM_Service (_Assign_Device_V86_Pages)
VMM_Service (_DeAssign_Device_V86_Pages)
VMM_Service (_Get_Device_V86_Pages_Array)
VMM_Service (MMGR_SetNULPageAddr)
// GDT/LDT management
VMM_Service (_Allocate_GDT_Selector)
VMM_Service (_Free_GDT_Selector)
VMM_Service (_Allocate_LDT_Selector)
VMM_Service (_Free_LDT_Selector)
VMM_Service (_BuildDescriptorDWORDs)
VMM_Service (_GetDescriptor)
VMM_Service (_SetDescriptor)
/*ENDMACROS*/
/*
* Flag equates for _Allocate_GDT_Selector
*/
#define ALLOCFROMEND 0x40000000
/*
* Flag equates for _BuildDescriptorDWORDs
*/
#define BDDEXPLICITDPL 0x00000001
/*
* Flag equates for _Allocate_LDT_Selector
*/
#define ALDTSPECSEL 0x00000001
/*MACROS*/
VMM_Service (_MMGR_Toggle_HMA)
/*ENDMACROS*/
/*
* Flag equates for _MMGR_Toggle_HMA
*/
#define MMGRHMAPHYSICAL 0x00000001
#define MMGRHMAENABLE 0x00000002
#define MMGRHMADISABLE 0x00000004
#define MMGRHMAQUERY 0x00000008
/*MACROS*/
VMM_Service (Get_Fault_Hook_Addrs)
VMM_Service (Hook_V86_Fault)
VMM_Service (Hook_PM_Fault)
VMM_Service (Hook_VMM_Fault)
VMM_Service (Begin_Nest_V86_Exec)
VMM_Service (Begin_Nest_Exec)
VMM_Service (Exec_Int)
VMM_Service (Resume_Exec)
VMM_Service (End_Nest_Exec)
VMM_Service (Allocate_PM_App_CB_Area, VMM_ICODE)
VMM_Service (Get_Cur_PM_App_CB)
VMM_Service (Set_V86_Exec_Mode)
VMM_Service (Set_PM_Exec_Mode)
VMM_Service (Begin_Use_Locked_PM_Stack)
VMM_Service (End_Use_Locked_PM_Stack)
VMM_Service (Save_Client_State)
VMM_Service (Restore_Client_State)
VMM_Service (Exec_VxD_Int)
VMM_Service (Hook_Device_Service)
VMM_Service (Hook_Device_V86_API)
VMM_Service (Hook_Device_PM_API)
VMM_Service (System_Control)
// I/O and software interrupt hooks
VMM_Service (Simulate_IO)
VMM_Service (Install_Mult_IO_Handlers)
VMM_Service (Install_IO_Handler)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -