Hook_V86_Page


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.

PageNum

Page 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

Address of the callback procedure to install. For more information about the callback procedure, see below.

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.

See also Unhook_V86_Page