Chapter 5. 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 (I/O works directly with hardware and is not intercepted).
Disable_Local_Trapping Disables local I/O trapping (I/O works directly with hardware and is not intercepted).
Enable_Global_Trapping Enables global I/O trapping (I/O requests are trapped instead of working directly with hardware). Enabled by default at system startup.
Enable_Local_Trapping Enables local I/O trapping (I/O requests are trapped instead of working directly with hardware).
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 Reduces complex I/O instructions to simpler I/O operations.
_Simulate_VM_IO Simulate ring 3 port I/O from the current vm (inside a ring 0 VxD).