aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2020-08-03 00:41:49 -0700
committeriximeow <me@iximeow.net>2020-08-09 01:38:57 -0700
commit70585db861e03ec76648070ed4e3fc88b9808c48 (patch)
treee4b4321239131435ccdd93a38d22bc0b0cb695c4
parentcb26b3cba6a64989f17e6f1282dca1bf8e42cc08 (diff)
loop{,z,nz}/jecxz
-rw-r--r--src/long_mode/display.rs8
-rw-r--r--src/long_mode/mod.rs17
-rw-r--r--test/long_mode/mod.rs4
3 files changed, 21 insertions, 8 deletions
diff --git a/src/long_mode/display.rs b/src/long_mode/display.rs
index 260d5dc..2bd9ad8 100644
--- a/src/long_mode/display.rs
+++ b/src/long_mode/display.rs
@@ -1235,6 +1235,10 @@ const MNEMONICS: &[&'static str] = &[
"fxtract",
"fyl2x",
"fyl2xp1",
+ "loopnz",
+ "loopz",
+ "loop",
+ "jrcxz",
];
impl Opcode {
@@ -1628,6 +1632,10 @@ impl <T: fmt::Write, Color: fmt::Display, Y: YaxColors<Color>> Colorize<T, Color
Opcode::IRETQ |
Opcode::RETF |
Opcode::RETURN => { write!(out, "{}", colors.stop_op(self)) }
+ Opcode::LOOPNZ |
+ Opcode::LOOPZ |
+ Opcode::LOOP |
+ Opcode::JRCXZ |
Opcode::CALL |
Opcode::CALLF |
Opcode::JMP |
diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs
index 6ff6ac9..2f5fe5d 100644
--- a/src/long_mode/mod.rs
+++ b/src/long_mode/mod.rs
@@ -1537,6 +1537,11 @@ pub enum Opcode {
FXTRACT,
FYL2X,
FYL2XP1,
+
+ LOOPNZ,
+ LOOPZ,
+ LOOP,
+ JRCXZ,
}
#[derive(Debug)]
@@ -5236,14 +5241,10 @@ const OPCODES: [OpcodeRecord; 256] = [
// x86 df
OpcodeRecord(Interpretation::Instruction(Opcode::Invalid), OperandCode::x87_df),
// 0xe0
- // LOOPNZ
- OpcodeRecord(Interpretation::Instruction(Opcode::Invalid), OperandCode::Nothing),
- // LOOPZ
- OpcodeRecord(Interpretation::Instruction(Opcode::Invalid), OperandCode::Nothing),
- // LOOP
- OpcodeRecord(Interpretation::Instruction(Opcode::Invalid), OperandCode::Nothing),
- // JECXZ
- OpcodeRecord(Interpretation::Instruction(Opcode::Invalid), OperandCode::Nothing),
+ OpcodeRecord(Interpretation::Instruction(Opcode::LOOPNZ), OperandCode::Ibs),
+ OpcodeRecord(Interpretation::Instruction(Opcode::LOOPZ), OperandCode::Ibs),
+ OpcodeRecord(Interpretation::Instruction(Opcode::LOOP), OperandCode::Ibs),
+ OpcodeRecord(Interpretation::Instruction(Opcode::JRCXZ), OperandCode::Ibs),
OpcodeRecord(Interpretation::Instruction(Opcode::IN), OperandCode::AL_Ib),
OpcodeRecord(Interpretation::Instruction(Opcode::IN), OperandCode::AX_Ib),
OpcodeRecord(Interpretation::Instruction(Opcode::OUT), OperandCode::Ib_AL),
diff --git a/test/long_mode/mod.rs b/test/long_mode/mod.rs
index 3d38d09..7c4c5fa 100644
--- a/test/long_mode/mod.rs
+++ b/test/long_mode/mod.rs
@@ -1099,6 +1099,10 @@ fn test_control_flow() {
test_display(&[0x67, 0xff, 0xe0], "jmp rax");
test_invalid(&[0xff, 0xd8]);
test_display(&[0xff, 0x18], "callf [rax]");
+ test_display(&[0xe0, 0x12], "loopnz 0x12");
+ test_display(&[0xe1, 0x12], "loopz 0x12");
+ test_display(&[0xe2, 0x12], "loop 0x12");
+ test_display(&[0xe3, 0x12], "jrcxz 0x12");
test_display(&[0xc3], "ret");
}