I/O Port Intercept Message
An I/O port intercept message is delivered by the hypervisor when a virtual processor executes an IN, OUT, INS, or OUTS instruction and the parent partition previously called the HvInstallIntercept hypercall function to install an intercept on one of the accessed I/O ports. A multi-byte I/O port access is treated as though it accesses multiple consecutive ports. If intercepts have been installed for any of the ports within the range, an intercept is generated.
The format of I/O port intercept messages is shown in the following table. An HV_X64_IO_PORT_INTERCEPT_MESSAGE structure is used to encode an I/O port intercept message.
Message Header | |||||||
0 |
MessageType (4 bytes) |
Rsvd (3 bytes) |
PayloadSize (1 byte) | ||||
8 |
SourcePartition (8 bytes) | ||||||
IO Port Intercept Payload | |||||||
16 |
VpIndex (4 bytes) |
InstLen (1 byte) |
(1 byte) |
ExecutionState (2 bytes) | |||
24 |
CsSegment[0] (8 bytes) | ||||||
32 |
CsSegment[1] (8 bytes) | ||||||
40 |
Rip (8 bytes) | ||||||
48 |
Rflags (8 bytes) | ||||||
56 |
PortNum (2 bytes) |
Access Info (1 byte) |
InstByteCount (1 byte) |
Rsvd (4 bytes) | |||
64 |
Rax (8 bytes) | ||||||
72 |
InstructionBytes[0] (8 bytes) | ||||||
80 |
InstructionBytes[1] (8 bytes) | ||||||
88 |
DsSegment[0] (8 bytes) | ||||||
96 |
DsSegment[1] (8 bytes) | ||||||
104 |
EsSegment[0] (8 bytes) | ||||||
112 |
EsSegment[1] (8 bytes) | ||||||
120 |
Rcx (8 bytes) | ||||||
128 |
Rsi (8 bytes) | ||||||
136 |
Rdi (8 bytes) |
The following list describes the fields of I/O port intercept messages:
- PortNum
-
The number of the I/O port being accessed.
- AccessInfo
-
A HV_X64_IO_PORT_ACCESS_INFO union that indicates the size of the access, whether the intercepted instruction was a string operation, and whether a "rep" prefix was specified.
- InstByteCount
-
The number of instruction bytes that have been provided in the InstructionBytes fields. Valid values are in the range 0 through 16. This field is valid only for string operations. This field is set to zero and should be ignored for simple (non-string) I/O port accesses.
- Rax
-
The value of the Rax register. For OUT instructions, this value represents the value written to the I/O port. For IN instructions, this value can be used by an intercept handler to insert the input value into AL, AX, or EAX and to compute the final value of RAX.
- The remaining fields (offsets 72 and beyond) are applicable only for string operations. These fields are set to zero and should be ignored for simple (non-string) I/O port accesses.
- InstructionBytes
-
Includes up to 16 bytes from the instruction stream that starts at the current CS:RIP. The number of valid bytes is specified by InstByteCount. The hypervisor might only fetch up to the next page boundary that results in an instruction byte count that is less than 16.
- DsSegment
-
The selector, base, limit, and flags for the current data segment (DS).
- EsSegment
-
The selector, base, limit, and flags for the current extended segment (ES).
- Rcx, Rsi, and Rdi
-
The values of the RCX, RSI, and RDI registers.
Send comments about this topic to Microsoft
Build date: 11/16/2013