◄Up► ◄Next► ◄Previous► ──────────────────────────────────────────────────────────────────────────── 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. Parameter Description ──────────────────────────────────────────────────────────────────────────── TaskSwitchCallback Points to the callback procedure to install. See the Comments section for more information about the procedure. Return Value This service has no return value. Comments 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 VM specifies a handle identifying the current virtual machine. The callback procedure can carry out any operation and can modify EAX, EBX, ECX, EDX, ESI, EDI, and Flags. Uses Flags See Also Call_When_Idle, Call_When_Not_Critical ♦