From 639bcc836b70069e9569b21bd07e5764eba86b66 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sat, 30 Nov 2019 16:12:20 -0800 Subject: support prefetch, movlps, movhps, refine prefix permissivity rep, repz, repnz prefixes are only displayed on instructions for which they have a semantic effect. movs, cmps, scas, lods, stos, ins, and outs are now decodable. --- src/display.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/display.rs') diff --git a/src/display.rs b/src/display.rs index 5e42cef..e1343ce 100644 --- a/src/display.rs +++ b/src/display.rs @@ -316,6 +316,10 @@ impl fmt::Display for Opcode { &Opcode::POP => write!(f, "{}", "pop"), &Opcode::LEA => write!(f, "{}", "lea"), &Opcode::NOP => write!(f, "{}", "nop"), + &Opcode::PREFETCHNTA => write!(f, "{}", "prefetchnta"), + &Opcode::PREFETCH0 => write!(f, "{}", "prefetch0"), + &Opcode::PREFETCH1 => write!(f, "{}", "prefetch1"), + &Opcode::PREFETCH2 => write!(f, "{}", "prefetch2"), &Opcode::XCHG => write!(f, "{}", "xchg"), &Opcode::POPF => write!(f, "{}", "popf"), &Opcode::ADD => write!(f, "{}", "add"), @@ -439,7 +443,9 @@ impl fmt::Display for Opcode { &Opcode::MOVAPS => write!(f, "{}", "movaps"), &Opcode::MOVD => write!(f, "{}", "movd"), &Opcode::MOVLPS => write!(f, "{}", "movlps"), + &Opcode::MOVLHPS => write!(f, "{}", "movlhps"), &Opcode::MOVHPS => write!(f, "{}", "movhps"), + &Opcode::MOVHLPS => write!(f, "{}", "movhlps"), &Opcode::MOVUPD => write!(f, "{}", "movupd"), &Opcode::MOVMSKPS => write!(f, "{}", "movmskps"), &Opcode::MOVNTI => write!(f, "{}", "movnti"), @@ -642,6 +648,10 @@ impl Colorize for Opcode { Opcode::PUSH | Opcode::POP => { write!(out, "{}", colors.stack_op(self)) } Opcode::WAIT | + Opcode::PREFETCHNTA | + Opcode::PREFETCH0 | + Opcode::PREFETCH1 | + Opcode::PREFETCH2 | Opcode::NOP => { write!(out, "{}", colors.nop_op(self)) } /* Control flow */ @@ -694,7 +704,9 @@ impl Colorize for Opcode { Opcode::MOVAPS | Opcode::MOVD | Opcode::MOVHPS | + Opcode::MOVHLPS | Opcode::MOVLPS | + Opcode::MOVLHPS | Opcode::MOVMSKPS | Opcode::MOVNTI | Opcode::MOVNTPS | @@ -902,6 +914,18 @@ impl ShowContextual], T> for Instructi if self.prefixes.lock() { write!(out, "lock ")?; } + + if [Opcode::MOVS, Opcode::CMPS, Opcode::LODS, Opcode::STOS, Opcode::INS, Opcode::OUTS].contains(&self.opcode) { + // only a few of you actually use the prefix... + if self.prefixes.rep() { + write!(out, "rep ")?; + } else if self.prefixes.repz() { + write!(out, "repz ")?; + } else if self.prefixes.repnz() { + write!(out, "repnz ")?; + } + } + self.opcode.colorize(colors, out)?; match context.and_then(|xs| xs[0].as_ref()) { -- cgit v1.1