Skip to main content

io_permission_accesses

Function io_permission_accesses 

Source
pub fn io_permission_accesses(
    state: &CpuState,
    d: &Decoded,
    mem: &dyn GuestMemory,
) -> Vec<PlannedAccess>
Expand description

The reads the CPU makes to check I/O permission before IN, OUT, INS or OUTS.

In protected mode, when CPL > IOPL (or always, in virtual-8086 mode), the processor consults the I/O permission bitmap in the TSS: it reads the 16-bit bitmap offset at TSS+0x66, then two bytes of the bitmap that cover the port. These are real memory reads, made with supervisor privilege on behalf of a user-mode instruction, and a cache simulator sees them like any other load. If the bitmap lies beyond the TSS limit the instruction raises #GP without reading it.

Returns nothing for any other instruction, or when IOPL allows the I/O.