aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2021-03-21 17:40:39 -0700
committeriximeow <me@iximeow.net>2021-03-21 17:40:39 -0700
commit3ee3f55f9a5239664ff9fb0d4b73926c4d76ac26 (patch)
treea4c203b06a6587e2612a6a53f40eb00add9c8988 /src
parentfcd9fc30d2fa41b2267a6539e5806735bae8931d (diff)
include memory sizes on inc/dec in C format
Diffstat (limited to 'src')
-rw-r--r--src/long_mode/display.rs22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/long_mode/display.rs b/src/long_mode/display.rs
index 8750cc6..3631800 100644
--- a/src/long_mode/display.rs
+++ b/src/long_mode/display.rs
@@ -2709,10 +2709,28 @@ fn contextualize_c<T: fmt::Write, Color: fmt::Display, Y: YaxColors<Color>>(inst
write!(out, "{} = movntq({})", instr.operand(0), instr.operand(1))?;
}
Opcode::INC => {
- write!(out, "{}++", instr.operand(0))?;
+ if instr.operand(0).is_memory() {
+ match instr.mem_size {
+ 1 => { write!(out, "byte {}++", instr.operand(0))?; },
+ 2 => { write!(out, "word {}++", instr.operand(0))?; },
+ 4 => { write!(out, "dword {}++", instr.operand(0))?; },
+ _ => { write!(out, "qword {}++", instr.operand(0))?; }, // sizes that are not 1, 2, or 4, *better* be 8.
+ }
+ } else {
+ write!(out, "{}++", instr.operand(0))?;
+ }
}
Opcode::DEC => {
- write!(out, "{}--", instr.operand(0))?;
+ if instr.operand(0).is_memory() {
+ match instr.mem_size {
+ 1 => { write!(out, "byte {}--", instr.operand(0))?; },
+ 2 => { write!(out, "word {}--", instr.operand(0))?; },
+ 4 => { write!(out, "dword {}--", instr.operand(0))?; },
+ _ => { write!(out, "qword {}--", instr.operand(0))?; }, // sizes that are not 1, 2, or 4, *better* be 8.
+ }
+ } else {
+ write!(out, "{}--", instr.operand(0))?;
+ }
}
Opcode::JG => {
write!(out, "if greater(rflags) then jmp {}", instr.operand(0))?;