Hook_V86_Int_Chain

include vmm.inc

mov eax, Interrupt ; number of interrupt to hook

mov esi, OFFSET32 HookProc ; points to hook procedure

VMMcall Hook_V86_Int_Chain

jc not_installed ; carry flag set if procedure not installed


The Hook_V86_Int_Chain service installs a hook procedure that the system calls whenever the specified interrupt occurs. Virtual devices use this service to monitor software interrupts, and simulated hardware interrupts in V86 mode.

This service is only available during initialization.

Parameters

Interrupt

Specifies the number of the interrupt for which to install the hook procedure.

HookProc

Points to the hook procedure. For more information about the procedure, see the following “Comments” section.

Return Value

The carry flag is clear if the hook procedure is installed. The carry flag is set to indicate an error such as an invalid interrupt number.

Comments

The system calls the hook procedure whenever the corresponding interrupt occurs, a virtual device calls the Simulate_Int service, or the system simulates a hardware interrupt. This means a hook procedure must make no assumptions about the origin of the interrupt.

The system calls the procedure as follows:

mov eax, Interrupt ; number of interrupt hooked

mov ebx, VM ; current VM handle

mov ebp, OFFSET32 crs ; points to a Client_Reg_Struc

call [HookProc]

jc pass_to_next ; carry flag set if interrupt not serviced

The Interrupt parameter is the number of the current interrupt, the VM parameter is a handle identifying the current virtual machine, and the crs parameter points to a Client_Reg_Struc structure containing the register values of the current virtual machine. If the hook procedure services the interrupt, it must clear the carry flag to prevent the system from passing the interrupt to the next hook procedure.

Any number of virtual devices can install a hook procedure for a given interrupt. The system always calls the last hook procedure first. A hook procedure either services the interrupt or directs the system to pass the interrupt to the next hook procedure. If no hook procedure services the interrupt, the system reflects the interrupt to the virtual machine.

This service is recommended instead of hooking the V86 interrupt vector directly.

Uses

Flags

See Also

Set_V86_Int_Vector, Simulate_Int