include vmm.inc mov eax, PageNum ; page number mov esi, OFFSET32 Callback ; points to address of trap routine VMMcall Hook_V86_Page |
The Hook_V86_Page service install 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.
PageNum
Specifies the number of the V86 page to install the callback procedure for. This number must be within the range specified by the number of the last V86 page and 0FFh.
Callback
Points to the callback procedure to install. For more information about the callback procedure, see the following “Comments” section.
The carry flag is clear if the service installs the callback procedure. Otherwise, the carry flag is set to indicate an error, such as an invalid page number or the page is already hooked.
The system calls the callback procedure whenever a page fault occurs for the specified page regardless of the current virtual machine.
The system calls the callback 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.
Flags