aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2020-08-03 00:30:32 -0700
committeriximeow <me@iximeow.net>2020-08-09 01:38:57 -0700
commitcb26b3cba6a64989f17e6f1282dca1bf8e42cc08 (patch)
treec3602ebbf30dcfd2694a8cda6f86ed174563abf5
parent1683b7af689b021946d1d869bf32ad95934639f2 (diff)
movabs/offset
-rw-r--r--src/long_mode/mod.rs8
-rw-r--r--test/long_mode/mod.rs11
2 files changed, 10 insertions, 9 deletions
diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs
index 18b9f7b..6ff6ac9 100644
--- a/src/long_mode/mod.rs
+++ b/src/long_mode/mod.rs
@@ -5799,9 +5799,7 @@ fn read_operands<T: Iterator<Item=u8>>(decoder: &InstDecoder, mut bytes_iter: T,
unsafe { unreachable_unchecked() }
}
};
- let _addr_width = if instruction.prefixes.address_size() { 4 } else { 8 };
- // stupid RCT thing:
- let addr_width = if instruction.prefixes.address_size() { 2 } else { 4 };
+ let addr_width = if instruction.prefixes.address_size() { 4 } else { 8 };
let imm = read_num(&mut bytes_iter, addr_width)?;
*length += addr_width;
instruction.modrm_rrr =
@@ -5825,9 +5823,7 @@ fn read_operands<T: Iterator<Item=u8>>(decoder: &InstDecoder, mut bytes_iter: T,
unsafe { unreachable_unchecked() }
}
};
- let _addr_width = if instruction.prefixes.address_size() { 4 } else { 8 };
- // stupid RCT thing:
- let addr_width = if instruction.prefixes.address_size() { 2 } else { 4 };
+ let addr_width = if instruction.prefixes.address_size() { 4 } else { 8 };
let imm = read_num(&mut bytes_iter, addr_width)?;
*length += addr_width;
instruction.disp = imm;
diff --git a/test/long_mode/mod.rs b/test/long_mode/mod.rs
index 7472c06..3d38d09 100644
--- a/test/long_mode/mod.rs
+++ b/test/long_mode/mod.rs
@@ -1040,9 +1040,14 @@ fn test_sse() {
#[test]
fn test_mov() {
- // test_display(&[0xa1, 0x93, 0x62, 0xc4, 0x00, 0x12, 0x34, 0x12, 0x34], "mov eax, [0x3412341200c46293]");
- // RCT.exe 32bit version, TODO: FIX
- test_display(&[0xa1, 0x93, 0x62, 0xc4, 0x00], "mov eax, [0xc46293]");
+ test_display(&[0xa0, 0x93, 0x62, 0xc4, 0x00, 0x12, 0x34, 0x12, 0x34], "mov al, [0x3412341200c46293]");
+ test_display(&[0x67, 0xa0, 0x93, 0x62, 0xc4, 0x00], "mov al, [0xc46293]");
+ test_display(&[0xa1, 0x93, 0x62, 0xc4, 0x00, 0x12, 0x34, 0x12, 0x34], "mov eax, [0x3412341200c46293]");
+ test_display(&[0x67, 0xa1, 0x93, 0x62, 0xc4, 0x00], "mov eax, [0xc46293]");
+ test_display(&[0xa2, 0x93, 0x62, 0xc4, 0x00, 0x12, 0x34, 0x12, 0x34], "mov [0x3412341200c46293], al");
+ test_display(&[0x67, 0xa2, 0x93, 0x62, 0xc4, 0x00], "mov [0xc46293], al");
+ test_display(&[0xa3, 0x93, 0x62, 0xc4, 0x00, 0x12, 0x34, 0x12, 0x34], "mov [0x3412341200c46293], eax");
+ test_display(&[0x67, 0xa3, 0x93, 0x62, 0xc4, 0x00], "mov [0xc46293], eax");
test_display(&[0xba, 0x01, 0x00, 0x00, 0x00], "mov edx, 0x1");
test_display(&[0x48, 0xc7, 0x04, 0x24, 0x00, 0x00, 0x00, 0x00], "mov [rsp], 0x0");
test_display(&[0x48, 0x89, 0x44, 0x24, 0x08], "mov [rsp + 0x8], rax");