include vmm.inc
mov eax, PageNum ; page number
mov esi, OFFSET32 Callback ; points to address of trap routine
VMMCall Hook_V86_Page
Installs a callback procedure to handle faults for the specified page. Virtual devices, such as the virtual display device, use this service to detect when particular address ranges are accessed. Uses Flags.
The system calls the callback procedure whenever a page fault occurs for the specified page regardless of the current virtual machine. It calls the procedure as follows:
mov eax, Page ; faulting page number
mov ebx, VM ; current VM handle
call [Callback]
The Page parameter specifies the number of the page that caused the page fault, and the VM parameter is the handle of the current virtual machine. The EBP register does not point to a client register structure.
The callback procedure must either map physical memory into pages causing the page fault, or terminate the virtual machine. In unusual circumstances, the virtual device may need to map the system nul page into the faulting page.
Virtual devices must not rely on the contents of the CR2 (page fault) register. Instead, the callback procedure must use the Page parameter to determine which page caused the fault.
Call Unhook_V86_Page to remove the hook procedure.
Unhook_V86_Page