Skip to main content

patch_setcc

Function patch_setcc 

Source
pub fn patch_setcc(original: &[u8], value: bool) -> Result<Vec<u8>>
Expand description

Rewrite a SETcc instruction so it unconditionally writes value as u8 to its destination operand.

original is the verbatim instruction byte sequence (typically 3 bytes for setcc r/m8 or 4 bytes with a REX prefix; longer for memory operands with SIB / displacement). The returned vector is the same length and contains the equivalent MOV r/m8, imm8.

ยงErrors

Returns Error::Parse if the byte sequence does not look like a SETcc encoding (no 0F 9x opcode pair, REG field of ModR/M not /0, or the buffer is too short).