Set_NMI_Handler_Addr

include vmm.inc

mov     esi, OFFSET32 nmi       ; points to new NMI handler
VMMCall Set_NMI_Handler_Addr
 

Sets the Non-Maskable Interrupt (NMI) vector to the address of the specified NMI handler. Uses Flags.

nmi
Address of the new NMI handler.

To install an NMI handler, a virtual device must retrieve and save the current NMI handler address using the Get_NMI_Handler_Addr service, and set the new address using Set_NMI_Handler_Addr.

The NMI handler must not call VMM or virtual device services. This restriction includes calls to asynchronous VMM services. The NMI handler can examine and modify local data in the VxD_LOCKED_DATA_SEG segment, but it must not attempt to access any other memory, including virtual machine and V86 memory. If a virtual device needs to use VMM services in response to an NMI, it should install an NMI event handler using the Hook_NMI_Event service.

The NMI handler must not execute the iret instruction. Instead, it must jump to the address of the previous NMI handler (retrieved using the Get_NMI_Handler_Addr service). The CPU ignores additional NMIs until it executes the iret instruction. Because no NMI handlers in the chain execute this instruction, the handlers are guaranteed not to be re-entered.

Some computers require the latch at port 70h be reset to enable further NMIs. To simplify NMI processing for other NMI handlers, the virtual-parity device (PARITY) automatically resets this latch.

See Also

Get_NMI_Handler_Addr, Hook_NMI_Event