Simulate_IO

include vmm.inc

mov eax, Data ; data for output operations

mov ebx, VM ; current VM handle

mov ecx, IOType ; type of I/O (as passed to I/O trap routine)

mov edx, Port ; I/O port number

mov ebp, OFFSET32 crs ; points to a Client_Reg_Struc

VMMjmp Simulate_IO

mov [Data], eax ; data for input operation


The Simulate_IO service reduces complex I/O instructions to simpler I/O operations. An I/O callback procedure typically jumps to this service whenever the procedure receives a type of I/O that it does not directly support.

Parameters

Data

Specifies the data for an output operation. This parameter is used only if the IOType parameter specifies an output operation.

VM

Specifies a handle identifying the current virtual machine.

IOType

Specifies the type of I/O operation. This parameter can be a combination of the following values:

Value Meaning

Addr_32_IO Uses 32-bit address offsets for input or output string operations. If this value is not given, the 16-bit offsets are used.
Byte_Input Inputs a single byte; place in AL if String_IO is not given.
Byte_Output Outputs a single byte from AL if String_IO is not given.
Dword_Input Inputs a doubleword; place in EAX if String_IO is not given.
Dword_Output Outputs a doubleword from EAX if String_IO is not given.
Rep_IO Repeats the input or output string operation the number of times specified by the Client_CX field in the Client_Reg_Struc structure.
Reverse_IO Decrements string address on each input or output operation. If this value is not given, the string address is incremented on each operation.
String_IO Inputs or outputs a string. The high 16-bits specifies the segment address of the buffer containing the string to output, or to receive the string input.
Word_Input Inputs a word; place in AX if String_IO is not given.
Word_Output Outputs a word from AX if String_IO is not given.

Port

Specifies the number of the I/O port through which to carry out the operation.

crs

Points to a Client_Reg_Struc structure containing the register contents for the current virtual machine.

Return Value

The EAX register contains input data if the IOType parameter specifies an input operation. IOType also specifies the size of the data in EAX.

Comments

The parameters to this service are identical to the parameters passed to an I/O callback procedure. A callback procedure should jump to this service, using the VMMjmp macro, with all of the registers in the same state as when the procedure was called. The procedure may modify the ESI and EDI register before jumping, if necessary.

Uses

EAX, EBX, ECX, EDI, EDX, ESI, Flags

See Also

Dispatch_Byte_IO, Emulate_Non_Byte_IO