include vmm.inc
mov eax, TimeOut ; milliseconds until time out
mov edx, RefData ; reference data
mov esi, OFFSET32 Callback ; address of callback function
VMMCall Call_When_VM_Returns
Installs a callback function that receives control when a virtual machine executes the iret instruction for the current interrupt. Uses Client_CS, Client_EIP, Flags.
A virtual device typically uses this service in a callback procedure that it installed using the Hook_V86_Int_Chain service. This service directs the system to replace the return address for the interrupt with the address of the callback procedure. That is, the system pushes the callback procedure address on the stack when it creates the stack frame for the interrupt. The system then passes the interrupt to the virtual machine.
When the virtual machine executes the iret instruction, the callback procedure receives control and can carry out tasks. After the callback procedure returns, the system restores the original interrupt return address and execution continues as if returning from the interrupt.