Allocate_PM_Call_Back


include vmm.inc

mov     edx, RefData            ; reference data (any doubleword)
mov     esi, OFFSET32 Callback  ; callback function to call
VMMcall Allocate_PM_Call_Back

jc      error
mov     [CallbackAddr], eax     ; selector:offset for callback

Registers a callback function that 16-bit protected-mode applications can call. Virtual devices use this service to provide an interface that is available to device drivers and applications in a VM. Uses EAX, Flags.

RefData

Reference data to be passed to the callback procedure. Can be any 32-bit value, but is typically the address of a driver-defined structure.

Callback

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

The system calls the callback procedure as follows:


mov     ebx, VM             ; current VM handle
mov     edi, hCurThread     ; current thread handle
mov     edx, RefData        ; reference data
mov     ebp, OFFSET32 crs   ; points to Client_Reg_Struc
call    [Callback]

The VM parameter is a handle identifying the current virtual machine. The RefData parameter is the value supplied when the callback procedure was installed, and crs points to a Client_Reg_Struc structure containing the register values for the virtual machine at the time it called the PM callback address. The callback may read and modify the client registers; any changes made will be seen by the calling application when control returns to it.

See also Allocate_V86_Call_Back