Function emulate_fast_path_set_bit

Source
pub fn emulate_fast_path_set_bit<T: Cpu>(
    instruction_bytes: &[u8],
    cpu: &mut T,
) -> Option<u32>
Expand description

Emulate atomic single-bit writes to a page.

This decodes bts and or instructions (which can and probably will have lock prefixes). It assumes the caller knows which physical page is being modified.

This is more efficient than going through the full emulation path for cases where the guest is likely to be performing single-bit writes. This is particularly useful for emulating Hyper-V monitor pages.

If the fast path is possible, updates the register state, advances the instruction pointer, and returns the bit number being set within the 4K page.

If the fast path is impossible, returns None. The caller should use the full emulator.