uin (execute I/O IN instruction in debuggee)
Description of the 'uin' command in HyperDbg.
Command
uin
Syntax
uin [Register (string)] [Port (hex)]
Description
Executes the IN instruction on the target debuggee to read a value from the specified I/O port (port-mapped I/O) and shows the result.
Parameters
[Register (string)]
The destination register, which also determines the size of the IN operation:
al: reads a byte from the portax: reads a word (2 bytes) from the porteax: reads a double-word (4 bytes) from the port
[Port (hex)]
The I/O port address (hex or decimal), in the range 0x0000 to 0xffff.
Examples
The following command reads a byte from the keyboard controller port (0x60).
The following command reads a word from COM1 (0x3f8).
The following command reads a double-word (4 bytes) from the PCI configuration data port (0xcf8).
A common use case for 'uin' and 'uout' is accessing the PCI Configuration Mechanism, which uses I/O ports 0xcf8 (configuration address) and 0xcfc (configuration data).
You first write a 32-bit configuration-address value to 0xcf8 using 'uout' and then read the corresponding 32-bit configuration-data value from 0xcfc using 'uin'. The 0xcf8 value is not just the PCI offset; it encodes the bus, device, function, and offset:
The configuration-address formula is:
For example, to read the Vendor ID and Device ID (configuration offset 0x00) of the device at Bus 0, Device 0, Function 0, the 0xcf8 value is 0x80000000.
In this example, the result 0x71928086 means the Vendor ID is 8086 (Intel) and the Device ID is 7192.
SDK
To execute an IN instruction in the target debuggee, use the following function in libhyperdbg:
Remarks
This command is guaranteed to keep debuggee in a halt state (in Debugger Mode); thus, nothing will change during its execution.
Requirements
None
Related
Last updated