From 802679e4f8362d3c819b83223854c638cc8f2b7f Mon Sep 17 00:00:00 2001 From: iximeow Date: Sat, 22 Feb 2020 15:38:41 -0800 Subject: fix {jmp,call} , as well as jmpf/callf also support vmxon to finish out the f30f opcode map add tests for forms of inc/dec, as well as TODOs, as yaxpeax-x86 doesn't provide a way to distinguish different operand sizes (yet) --- src/long_mode/display.rs | 2 ++ src/long_mode/mod.rs | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'src') diff --git a/src/long_mode/display.rs b/src/long_mode/display.rs index d45a98a..3025c16 100644 --- a/src/long_mode/display.rs +++ b/src/long_mode/display.rs @@ -652,6 +652,7 @@ impl fmt::Display for Opcode { &Opcode::BLSMSK => write!(f, "blsmsk"), &Opcode::BLSR => write!(f, "blsr"), &Opcode::VMCLEAR => write!(f, "vmclear"), + &Opcode::VMXON => write!(f, "vmxon"), &Opcode::VMCALL => write!(f, "vmcall"), &Opcode::VMLAUNCH => write!(f, "vmlaunch"), &Opcode::VMRESUME => write!(f, "vmresume"), @@ -1855,6 +1856,7 @@ impl > Colorize>(decoder: &InstDecoder, mut bytes_iter: T, Opcode::PUSH, Opcode::Invalid ][((modrm >> 3) & 7) as usize]; + if instruction.operands[0] == OperandSpec::RegMMM { + if opcode == Opcode::CALL || opcode == Opcode::JMP { + instruction.modrm_mmm.bank = RegisterBank::Q; + } else if opcode == Opcode::CALLF || opcode == Opcode::JMPF { + return Err(DecodeError::InvalidOperand); + } + } instruction.opcode = opcode; instruction.operand_count = 1; } @@ -5643,6 +5651,24 @@ fn unlikely_operands>(decoder: &InstDecoder, mut bytes_iter } } }, + OperandCode::ModRM_0xf30fc7 => { + let modrm = read_modrm(&mut bytes_iter, length)?; + + let r = (modrm >> 3) & 7; + match r { + 6 => { + instruction.opcode = Opcode::VMXON; + instruction.operands[0] = read_E(&mut bytes_iter, instruction, modrm, 1 /* doesn't matter, something using this width is invalid */, length)?; + if instruction.operands[0] == OperandSpec::RegMMM { + return Err(DecodeError::InvalidOperand); + } + instruction.operand_count = 1; + } + _ => { + return Err(DecodeError::InvalidOpcode); + } + } + }, OperandCode::G_mm_Edq => { instruction.operands[1] = mem_oper; instruction.modrm_rrr.bank = RegisterBank::MM; -- cgit v1.1