Function emulate_io

Source
pub async fn emulate_io(
    vp_index: VpIndex,
    is_write: bool,
    port: u16,
    rax: &mut u64,
    len: u8,
    dev: &impl CpuIo,
)
Expand description

Emulates an IO port instruction.

Just handles calling into the IO bus and updating rax. The caller must update RIP, and it must update the VP’s rax register (when !is_write).

The caller is also responsible for performing any security checks to ensure the guest is allowed to execute I/O instructions. However, typically this is handled by the hardware and hypervisor automatically.