aboutsummaryrefslogtreecommitdiff
path: root/src/display.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2019-11-30 16:12:20 -0800
committeriximeow <me@iximeow.net>2020-01-12 16:10:13 -0800
commit639bcc836b70069e9569b21bd07e5764eba86b66 (patch)
treecacdfc07986c2787b64df56c4cafa66c68e03597 /src/display.rs
parent7561575f135e0ba72f0a90a5859d19f7b02a31e8 (diff)
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.
Diffstat (limited to 'src/display.rs')
-rw-r--r--src/display.rs24
1 files changed, 24 insertions, 0 deletions
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 <T: std::fmt::Write> Colorize<T> 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 <T: std::fmt::Write> Colorize<T> 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 <T: std::fmt::Write> ShowContextual<u64, [Option<String>], 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()) {