From ccdc601e2a70a0f27891f6db8c9151456d08f05a Mon Sep 17 00:00:00 2001 From: iximeow Date: Sat, 30 Nov 2019 18:00:56 -0800 Subject: support ucomiss, cvt*, some other sse instructions --- src/display.rs | 2 ++ src/lib.rs | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/display.rs b/src/display.rs index e1343ce..029eed3 100644 --- a/src/display.rs +++ b/src/display.rs @@ -441,6 +441,7 @@ impl fmt::Display for Opcode { &Opcode::MAXPS => write!(f, "{}", "maxps"), &Opcode::MINPS => write!(f, "{}", "minps"), &Opcode::MOVAPS => write!(f, "{}", "movaps"), + &Opcode::MOVAPD => write!(f, "{}", "movapd"), &Opcode::MOVD => write!(f, "{}", "movd"), &Opcode::MOVLPS => write!(f, "{}", "movlps"), &Opcode::MOVLHPS => write!(f, "{}", "movlhps"), @@ -702,6 +703,7 @@ impl Colorize for Opcode { Opcode::CVTTSS2SI | Opcode::MASKMOVQ | Opcode::MOVAPS | + Opcode::MOVAPD | Opcode::MOVD | Opcode::MOVHPS | Opcode::MOVHLPS | diff --git a/src/lib.rs b/src/lib.rs index bf94dbe..fd791b0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -622,6 +622,7 @@ pub enum Opcode { MAXPS, MINPS, MOVAPS, + MOVAPD, MOVD, MOVLPS, MOVHPS, @@ -1200,7 +1201,7 @@ pub enum OperandCode { Gb_Eb_Ib = 0xc4, Gv_Ev_Iv = 0xc5, // gap: 0xc6 - G_U_xmm = 0xc7, + Gd_U_xmm = 0xc7, M_G_xmm = 0xc9, ModRM_0x0f12 = 0xcb, ModRM_0x0f16 = 0xce, @@ -1297,8 +1298,8 @@ const OPCODE_660F_MAP: [OpcodeRecord; 256] = [ OpcodeRecord(Interpretation::Instruction(Opcode::Invalid), OperandCode::Nothing), OpcodeRecord(Interpretation::Instruction(Opcode::Invalid), OperandCode::Nothing), OpcodeRecord(Interpretation::Instruction(Opcode::Invalid), OperandCode::Nothing), - OpcodeRecord(Interpretation::Instruction(Opcode::Invalid), OperandCode::Nothing), - OpcodeRecord(Interpretation::Instruction(Opcode::Invalid), OperandCode::Nothing), + OpcodeRecord(Interpretation::Instruction(Opcode::MOVAPD), OperandCode::G_E_xmm), + OpcodeRecord(Interpretation::Instruction(Opcode::MOVAPD), OperandCode::E_G_xmm), OpcodeRecord(Interpretation::Instruction(Opcode::Invalid), OperandCode::Nothing), OpcodeRecord(Interpretation::Instruction(Opcode::Invalid), OperandCode::Nothing), OpcodeRecord(Interpretation::Instruction(Opcode::Invalid), OperandCode::Nothing), @@ -2175,8 +2176,8 @@ const OPCODE_0F_MAP: [OpcodeRecord; 256] = [ OpcodeRecord(Interpretation::Instruction(Opcode::MOVNTPS), OperandCode::M_G_xmm), OpcodeRecord(Interpretation::Instruction(Opcode::CVTTPS2PI), OperandCode::Nothing), OpcodeRecord(Interpretation::Instruction(Opcode::CVTPS2PI), OperandCode::Nothing), - OpcodeRecord(Interpretation::Instruction(Opcode::UCOMISS), OperandCode::Nothing), - OpcodeRecord(Interpretation::Instruction(Opcode::COMISS), OperandCode::Nothing), + OpcodeRecord(Interpretation::Instruction(Opcode::UCOMISS), OperandCode::G_E_xmm), + OpcodeRecord(Interpretation::Instruction(Opcode::COMISS), OperandCode::G_E_xmm), // 0x30 OpcodeRecord(Interpretation::Instruction(Opcode::WRMSR), OperandCode::Nothing), @@ -2215,7 +2216,7 @@ const OPCODE_0F_MAP: [OpcodeRecord; 256] = [ OpcodeRecord(Interpretation::Instruction(Opcode::CMOVG), OperandCode::Gv_Ev), // 0x50 - OpcodeRecord(Interpretation::Instruction(Opcode::MOVMSKPS), OperandCode::G_U_xmm), + OpcodeRecord(Interpretation::Instruction(Opcode::MOVMSKPS), OperandCode::Gd_U_xmm), OpcodeRecord(Interpretation::Instruction(Opcode::SQRTPS), OperandCode::G_E_xmm), OpcodeRecord(Interpretation::Instruction(Opcode::RSQRTPS), OperandCode::G_E_xmm), OpcodeRecord(Interpretation::Instruction(Opcode::RCPPS), OperandCode::G_E_xmm), @@ -2225,8 +2226,8 @@ const OPCODE_0F_MAP: [OpcodeRecord; 256] = [ OpcodeRecord(Interpretation::Instruction(Opcode::XORPS), OperandCode::G_E_xmm), OpcodeRecord(Interpretation::Instruction(Opcode::ADDPS), OperandCode::G_E_xmm), OpcodeRecord(Interpretation::Instruction(Opcode::MULPS), OperandCode::G_E_xmm), - OpcodeRecord(Interpretation::Instruction(Opcode::CVTPS2PD), OperandCode::Unsupported), - OpcodeRecord(Interpretation::Instruction(Opcode::CVTDQ2PS), OperandCode::Unsupported), + OpcodeRecord(Interpretation::Instruction(Opcode::CVTPS2PD), OperandCode::G_E_xmm), + OpcodeRecord(Interpretation::Instruction(Opcode::CVTDQ2PS), OperandCode::G_E_xmm), OpcodeRecord(Interpretation::Instruction(Opcode::SUBPS), OperandCode::G_E_xmm), OpcodeRecord(Interpretation::Instruction(Opcode::MINPS), OperandCode::G_E_xmm), OpcodeRecord(Interpretation::Instruction(Opcode::DIVPS), OperandCode::G_E_xmm), @@ -3619,11 +3620,13 @@ fn unlikely_operands>(mut bytes_iter: T, instruction: &mut _ => Opcode::NOP, }; } - OperandCode::G_U_xmm => { + OperandCode::Gd_U_xmm => { + instruction.operands[1] = mem_oper; if instruction.operands[1] != OperandSpec::RegMMM { instruction.opcode = Opcode::Invalid; return Err(()); } + instruction.modrm_rrr.bank = RegisterBank::D; instruction.modrm_mmm.bank = RegisterBank::X; } OperandCode::M_G_xmm => { -- cgit v1.1