include vmm.inc mov esi, TaskSwitchCallback ; points to callback procedure VMMcall Call_When_Task_Switched |
The Call_When_Task_Switched service installs a task-switched callback procedure. The system calls this procedure whenever it carries out a task switch. This service should be used sparingly, and the callback procedure should be optimized for speed.
TaskSwitchCallback
Points to the callback procedure to install. For more information about the callback procedure, see the following “Comments” section.
This service has no return value.
Some virtual devices must save the state of a hardware device every time a task switch occurs and restore the hardware state for the virtual machine that is about to be run. However, virtual machine events can often be used in place of using this service.
Virtual devices can install any number of callback procedures. The system calls each one in the order installed, until all procedures have been called.
The system calls the callback procedure as follows:
mov eax, OldVM ; previous VM handle
mov ebx, VM ; current VM handle
call [CritSecCallback]
The OldVM parameter specifies a handle identifying the previous virtual machine (just prior to the task switch), and the VM parameter specifies a handle identifying the current virtual machine.
The callback procedure can carry out any operation and can modify the EAX, EBX, ECX, EDX, ESI, EDI, and Flags registers.
Flags