aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2023-07-24 06:41:02 -0700
committeriximeow <me@iximeow.net>2023-07-24 06:41:02 -0700
commitab51fd1b2c7cf1b7bb6f84c5b07e06245f6b3d99 (patch)
tree80b2a81dfb805c49a5c3a43296835bd5195e422a /test
parent855fa08f1d2f4bc405a1cfc205b5e9321dd4ebf5 (diff)
fix handling of lar/lsl source register
Diffstat (limited to 'test')
-rw-r--r--test/long_mode/mod.rs18
-rw-r--r--test/protected_mode/mod.rs10
-rw-r--r--test/real_mode/mod.rs10
3 files changed, 29 insertions, 9 deletions
diff --git a/test/long_mode/mod.rs b/test/long_mode/mod.rs
index 9144dbe..3e6b700 100644
--- a/test/long_mode/mod.rs
+++ b/test/long_mode/mod.rs
@@ -2567,12 +2567,20 @@ fn strange_prefixing() {
#[test]
fn prefixed_0f() {
- test_display(&[0x0f, 0x02, 0xc0], "lar eax, ax");
- test_display(&[0x48, 0x0f, 0x02, 0xc0], "lar rax, ax");
- test_display(&[0x0f, 0x03, 0xc0], "lsl eax, eax");
- // capstone says `lsl rax, rax`, but xed says `rax, eax`. intel docs also say second reg should
+ test_display(&[0x0f, 0x02, 0x01], "lar eax, word [rcx]");
+ test_display(&[0x0f, 0x02, 0xc1], "lar eax, ecx");
+ test_display(&[0x4f, 0x0f, 0x02, 0x01], "lar r8, word [r9]");
+ test_display(&[0x4f, 0x0f, 0x02, 0xc1], "lar r8, r9");
+ test_display(&[0x66, 0x0f, 0x02, 0x01], "lar ax, word [rcx]");
+ test_display(&[0x66, 0x0f, 0x02, 0xc1], "lar ax, cx");
+ test_display(&[0x0f, 0x03, 0x01], "lsl eax, word [rcx]");
+ test_display(&[0x0f, 0x03, 0xc1], "lsl eax, ecx");
+ test_display(&[0x48, 0x0f, 0x03, 0x01], "lsl rax, word [rcx]");
+ // capstone says `lsl rax, rcx`, but xed says `rax, ecx`. intel docs also say second reg should
// be dword.
- test_display(&[0x48, 0x0f, 0x03, 0xc0], "lsl rax, eax");
+ test_display(&[0x48, 0x0f, 0x03, 0xc1], "lsl rax, ecx");
+ test_display(&[0x66, 0x0f, 0x03, 0x01], "lsl ax, word [rcx]");
+ test_display(&[0x66, 0x0f, 0x03, 0xc1], "lsl ax, cx");
test_display(&[0x0f, 0x05], "syscall");
test_display(&[0x48, 0x0f, 0x05], "syscall");
test_display(&[0x66, 0x0f, 0x05], "syscall");
diff --git a/test/protected_mode/mod.rs b/test/protected_mode/mod.rs
index 5229617..85d92ce 100644
--- a/test/protected_mode/mod.rs
+++ b/test/protected_mode/mod.rs
@@ -2270,8 +2270,14 @@ fn strange_prefixing() {
#[test]
fn prefixed_0f() {
- test_display(&[0x0f, 0x02, 0xc0], "lar eax, ax");
- test_display(&[0x0f, 0x03, 0xc0], "lsl eax, eax");
+ test_display(&[0x0f, 0x02, 0x01], "lar eax, word [ecx]");
+ test_display(&[0x0f, 0x02, 0xc1], "lar eax, ecx");
+ test_display(&[0x66, 0x0f, 0x02, 0x01], "lar ax, word [ecx]");
+ test_display(&[0x66, 0x0f, 0x02, 0xc1], "lar ax, cx");
+ test_display(&[0x0f, 0x03, 0x01], "lsl eax, word [ecx]");
+ test_display(&[0x0f, 0x03, 0xc1], "lsl eax, ecx");
+ test_display(&[0x66, 0x0f, 0x03, 0x01], "lsl ax, word [ecx]");
+ test_display(&[0x66, 0x0f, 0x03, 0xc1], "lsl ax, cx");
test_display(&[0x0f, 0x05], "syscall");
test_display(&[0x66, 0x0f, 0x05], "syscall");
test_display(&[0x0f, 0x06], "clts");
diff --git a/test/real_mode/mod.rs b/test/real_mode/mod.rs
index 7cf5fc2..2ae52d8 100644
--- a/test/real_mode/mod.rs
+++ b/test/real_mode/mod.rs
@@ -162,8 +162,10 @@ fn test_real_mode() {
test_display(&[0x0f, 0x01, 0xfb], "mwaitx");
test_display(&[0x0f, 0x01, 0xfc], "clzero");
test_display(&[0x0f, 0x01, 0xfd], "rdpru ecx");
- test_display(&[0x0f, 0x02, 0xc0], "lar ax, ax");
- test_display(&[0x0f, 0x03, 0xc0], "lsl ax, ax");
+ test_display(&[0x0f, 0x02, 0x01], "lar ax, word [bx + di * 1]");
+ test_display(&[0x0f, 0x02, 0xc1], "lar ax, cx");
+ test_display(&[0x0f, 0x03, 0x01], "lsl ax, word [bx + di * 1]");
+ test_display(&[0x0f, 0x03, 0xc1], "lsl ax, cx");
test_display(&[0x0f, 0x05], "syscall");
test_display(&[0x0f, 0x06], "clts");
test_display(&[0x0f, 0x07], "sysret");
@@ -16715,6 +16717,10 @@ fn test_real_mode() {
test_display(&[0x65, 0x89, 0x04], "mov word gs:[si], ax");
test_display(&[0x65, 0xf0, 0x87, 0x0f], "lock xchg word gs:[bx], cx");
test_display(&[0x66, 0x0f, 0x01, 0xd8], "vmrun ax");
+ test_display(&[0x66, 0x0f, 0x02, 0x01], "lar eax, word [bx + di * 1]");
+ test_display(&[0x66, 0x0f, 0x02, 0xc1], "lar eax, ecx");
+ test_display(&[0x66, 0x0f, 0x03, 0x01], "lsl eax, word [bx + di * 1]");
+ test_display(&[0x66, 0x0f, 0x03, 0xc1], "lsl eax, ecx");
test_display(&[0x66, 0x0f, 0x05], "syscall");
test_display(&[0x66, 0x0f, 0x0f, 0xc6, 0xb7], "pmulhrw mm0, mm6");
test_display(&[0x66, 0x0f, 0x10, 0xc0], "movupd xmm0, xmm0");