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 operation
mov     edx, Port          ; I/O port number
mov     ebp, OFFSET32 crs  ; address of Client_Reg_Struc
VMMjmp  Simulate_IO

mov     [Data], eax        ; data for input operation

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. Uses EAX, EBX, ECX, EDI, EDX, ESI, Flags.

Data

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

VM

Handle of the current virtual machine.

IOType

Type of I/O operation, as specified in a call to an I/O trap procedure. Can be one or more of these 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. (The number of repetitions is stored in the Client_ECX field if Addr_32_IO is also set.)

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

Number of the I/O port through which to carry out the operation. If word I/O is requested, then Port+1 is also used. If dword I/O is requested, then Port+1 through Port+3 are also used.

crs

Address of a Client_Reg_Struc structure containing the register contents for the current virtual machine.

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.

See also Dispatch_Byte_IO, Emulate_Non_Byte_IO