About I/O Trapping

The VMM provides the Install_IO_Handler service to install a callback procedure to handle protection faults for a given port. When a virtual device calls Install_IO_Handler, the VMM sets the appropriate bit in the I/O permission map (IOPM) and registers the procedure. When a virtual machine executes an instruction that reads or writes data from an I/O port, the 80386 looks up the port number in the I/O permission map. If the corresponding bit in the IOPM is set, then the instruction will cause a protection fault that results in calling the registered procedure.

There are the following I/O services:

Service

Description

Disable_Global_Trapping

Disables global I/O trapping.

Disable_Local_Trapping

Disables local I/O trapping.

Enable_Global_Trapping

Enables global I/O trapping.

Enable_Local_Trapping

Enables local I/O trapping.

Install_IO_Handler

Install an I/O callback procedure.

Install_Mult_IO_Handlers

Install I/O handlers for multiple ports.

Remove_IO_Handler

Removes the I/O handler for the specified port and disables trapping for that port.

Remove_Mult_IO_Handlers

Repeatedly calls the Remove_IO_Handler service for each entry in the VxD_IO_Table, removing the specified IO handlers.

Simulate_IO

Simulates input and output.

_Simulate_VM_IO

Reduces complex I/O instructions to simpler I/O operations.