aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/long_mode/mod.rs45
-rw-r--r--test/protected_mode/mod.rs37
2 files changed, 48 insertions, 34 deletions
diff --git a/test/long_mode/mod.rs b/test/long_mode/mod.rs
index 50c4dc2..9c3039d 100644
--- a/test/long_mode/mod.rs
+++ b/test/long_mode/mod.rs
@@ -629,6 +629,7 @@ mod cvt {
testcase!(&[0x4f, 0x0f, 0x2c, 0xcf], "cvttps2pi mm1, xmm15"),
testcase!(&[0x4f, 0x0f, 0x2a, 0xcf], "cvtpi2ps xmm9, mm7"),
testcase!(&[0x4f, 0x0f, 0x2a, 0x00], "cvtpi2ps xmm8, qword [r8]"),
+ testcase!(&[0x0f, 0x2a, 0x00], "cvtpi2ps xmm0, qword [rax]"),
testcase!(&[0x4f, 0x66, 0x0f, 0x2a, 0xcf], "cvtpi2pd xmm1, mm7"),
testcase!(&[0x66, 0x4f, 0x0f, 0x2a, 0xcf], "cvtpi2pd xmm9, mm7"),
testcase!(&[0x4f, 0xf3, 0x0f, 0x2a, 0xcf], "cvtsi2ss xmm1, edi"),
@@ -639,7 +640,7 @@ mod cvt {
testcase!(&[0xf2, 0x4f, 0x0f, 0x2a, 0x00], "cvtsi2sd xmm8, qword [r8]"),
testcase!(&[0x4f, 0xf3, 0x0f, 0x2a, 0x00], "cvtsi2ss xmm0, dword [rax]"),
testcase!(&[0xf3, 0x4f, 0x0f, 0x2a, 0x00], "cvtsi2ss xmm8, qword [r8]"),
- testcase!(&[0x4f, 0x66, 0x0f, 0x2a, 0x00], "cvtpi2pd xmm0, dword [rax]"),
+ testcase!(&[0x4f, 0x66, 0x0f, 0x2a, 0x00], "cvtpi2pd xmm0, qword [rax]"),
testcase!(&[0x66, 0x4f, 0x0f, 0x2a, 0x00], "cvtpi2pd xmm8, qword [r8]"),
];
@@ -1098,13 +1099,13 @@ mod sse4_1 {
testcase!(features { SSE4_1: true, AVX: false } &[0x66, 0x0f, 0x38, 0x20, 0x06], "pmovsxbw xmm0, qword [rsi]"),
testcase!(invalid: &[0x0f, 0x38, 0x20, 0x06]),
- testcase!(features { SSE4_1: true, AVX: false } &[0x66, 0x0f, 0x38, 0x21, 0x06], "pmovsxbd xmm0, qword [rsi]"),
+ testcase!(features { SSE4_1: true, AVX: false } &[0x66, 0x0f, 0x38, 0x21, 0x06], "pmovsxbd xmm0, dword [rsi]"),
testcase!(invalid: &[0x0f, 0x38, 0x21, 0x06]),
testcase!(features { SSE4_1: true, AVX: false } &[0x66, 0x0f, 0x38, 0x22, 0x06], "pmovsxbq xmm0, word [rsi]"),
testcase!(invalid: &[0x0f, 0x38, 0x22, 0x06]),
testcase!(features { SSE4_1: true, AVX: false } &[0x66, 0x0f, 0x38, 0x23, 0x06], "pmovsxwd xmm0, qword [rsi]"),
testcase!(invalid: &[0x0f, 0x38, 0x23, 0x06]),
- testcase!(features { SSE4_1: true, AVX: false } &[0x66, 0x0f, 0x38, 0x24, 0x06], "pmovsxwq xmm0, qword [rsi]"),
+ testcase!(features { SSE4_1: true, AVX: false } &[0x66, 0x0f, 0x38, 0x24, 0x06], "pmovsxwq xmm0, dword [rsi]"),
testcase!(invalid: &[0x0f, 0x38, 0x24, 0x06]),
testcase!(features { SSE4_1: true, AVX: false } &[0x66, 0x0f, 0x38, 0x25, 0x06], "pmovsxdq xmm0, qword [rsi]"),
testcase!(invalid: &[0x0f, 0x38, 0x25, 0x06]),
@@ -1127,7 +1128,7 @@ mod sse4_1 {
testcase!(invalid: &[0x0f, 0x38, 0x32, 0x06]),
testcase!(features { SSE4_1: true, AVX: false } &[0x66, 0x0f, 0x38, 0x33, 0x06], "pmovzxwd xmm0, qword [rsi]"),
testcase!(invalid: &[0x0f, 0x38, 0x33, 0x06]),
- testcase!(features { SSE4_1: true, AVX: false } &[0x66, 0x0f, 0x38, 0x34, 0x06], "pmovzxwq xmm0, qword [rsi]"),
+ testcase!(features { SSE4_1: true, AVX: false } &[0x66, 0x0f, 0x38, 0x34, 0x06], "pmovzxwq xmm0, dword [rsi]"),
testcase!(invalid: &[0x0f, 0x38, 0x34, 0x06]),
testcase!(features { SSE4_1: true, AVX: false } &[0x66, 0x0f, 0x38, 0x35, 0x06], "pmovzxdq xmm0, qword [rsi]"),
testcase!(invalid: &[0x0f, 0x38, 0x35, 0x06]),
@@ -1159,9 +1160,9 @@ mod sse4_1 {
testcase!(invalid: &[0x0f, 0x3a, 0x08, 0x06]),
testcase!(features { SSE4_1: true, AVX: false } &[0x66, 0x0f, 0x3a, 0x09, 0x06, 0x31], "roundpd xmm0, xmmword [rsi], 0x31"),
testcase!(invalid: &[0x0f, 0x3a, 0x09, 0x06]),
- testcase!(features { SSE4_1: true, AVX: false } &[0x66, 0x0f, 0x3a, 0x0a, 0x06, 0x31], "roundss xmm0, xmmword [rsi], 0x31"),
+ testcase!(features { SSE4_1: true, AVX: false } &[0x66, 0x0f, 0x3a, 0x0a, 0x06, 0x31], "roundss xmm0, dword [rsi], 0x31"),
testcase!(invalid: &[0x0f, 0x3a, 0x0a, 0x06]),
- testcase!(features { SSE4_1: true, AVX: false } &[0x66, 0x0f, 0x3a, 0x0b, 0x06, 0x31], "roundsd xmm0, xmmword [rsi], 0x31"),
+ testcase!(features { SSE4_1: true, AVX: false } &[0x66, 0x0f, 0x3a, 0x0b, 0x06, 0x31], "roundsd xmm0, qword [rsi], 0x31"),
testcase!(invalid: &[0x0f, 0x3a, 0x0b, 0x06]),
testcase!(features { SSE4_1: true, AVX: false } &[0x66, 0x0f, 0x3a, 0x0e, 0x06, 0x31], "pblendw xmm0, xmmword [rsi], 0x31"),
@@ -1306,15 +1307,15 @@ mod _0f01 {
testcase!(&[0x0f, 0x01, 0xfe], "invlpgb rax, edx, ecx"),
testcase!(&[0x0f, 0x01, 0xff], "tlbsync"),
testcase!(&[0x2e, 0x67, 0x65, 0x2e, 0x46, 0x0f, 0x01, 0xff], "tlbsync"),
- testcase!(&[0x4f, 0x0f, 0x01, 0xe0], "smsw r8w"),
- testcase!(&[0x0f, 0x01, 0xe0], "smsw ax"),
- testcase!(&[0x0f, 0x01, 0xe1], "smsw cx"),
- testcase!(&[0x0f, 0x01, 0xe2], "smsw dx"),
- testcase!(&[0x0f, 0x01, 0xe3], "smsw bx"),
- testcase!(&[0x0f, 0x01, 0xe4], "smsw sp"),
- testcase!(&[0x0f, 0x01, 0xe5], "smsw bp"),
- testcase!(&[0x0f, 0x01, 0xe6], "smsw si"),
- testcase!(&[0x0f, 0x01, 0xe7], "smsw di"),
+ testcase!(&[0x4f, 0x0f, 0x01, 0xe0], "smsw r8"),
+ testcase!(&[0x0f, 0x01, 0xe0], "smsw eax"),
+ testcase!(&[0x0f, 0x01, 0xe1], "smsw ecx"),
+ testcase!(&[0x0f, 0x01, 0xe2], "smsw edx"),
+ testcase!(&[0x0f, 0x01, 0xe3], "smsw ebx"),
+ testcase!(&[0x0f, 0x01, 0xe4], "smsw esp"),
+ testcase!(&[0x0f, 0x01, 0xe5], "smsw ebp"),
+ testcase!(&[0x0f, 0x01, 0xe6], "smsw esi"),
+ testcase!(&[0x0f, 0x01, 0xe7], "smsw edi"),
testcase!(invalid: &[0x0f, 0x01, 0xe8]),
testcase!(invalid: &[0x0f, 0x01, 0xe8]),
testcase!(invalid: &[0x0f, 0x01, 0xe9]),
@@ -1425,7 +1426,8 @@ mod system {
testcase!(&[0x66, 0x4f, 0x0f, 0xb2, 0x00], "lss r8, mword [r8]"),
testcase!(&[0x67, 0x4f, 0x0f, 0xb2, 0x00], "lss r8, mword [r8d]"),
testcase!(&[0x4f, 0x0f, 0xb2, 0x00], "lss r8, mword [r8]"),
- testcase!(&[0x0f, 0xb2, 0x00], "lss rax, dword [rax]"),
+ testcase!(&[0x0f, 0xb2, 0x00], "lss eax, far [rax]"),
+ testcase!(&[0x66, 0x0f, 0xb2, 0x00], "lss ax, dword [rax]"),
testcase!(invalid: &[0x45, 0x0f, 0x22, 0xc8]),
testcase!(invalid: &[0x45, 0x0f, 0x20, 0xc8]),
testcase!(&[0x40, 0x0f, 0x22, 0xd0], "mov cr2, rax"),
@@ -1527,7 +1529,7 @@ mod sse {
testcase!(&[0x4f, 0x0f, 0x59, 0x01], "mulps xmm8, xmmword [r9]"),
testcase!(&[0xf3, 0x4f, 0x0f, 0x59, 0x01], "mulss xmm8, dword [r9]"),
testcase!(&[0x4f, 0x0f, 0x5a, 0x01], "cvtps2pd xmm8, qword [r9]"),
- testcase!(&[0xf3, 0x4f, 0x0f, 0x5a, 0x01], "cvtss2sd xmm8, qword [r9]"),
+ testcase!(&[0xf3, 0x4f, 0x0f, 0x5a, 0x01], "cvtss2sd xmm8, dword [r9]"),
testcase!(&[0x4f, 0x0f, 0x5b, 0x01], "cvtdq2ps xmm8, xmmword [r9]"),
testcase!(&[0xf3, 0x4f, 0x0f, 0x5b, 0x01], "cvttps2dq xmm8, xmmword [r9]"),
testcase!(&[0x67, 0x4f, 0x0f, 0x5b, 0x01], "cvtdq2ps xmm8, xmmword [r9d]"),
@@ -1557,7 +1559,7 @@ mod sse {
),
testcase!(&[0xf3, 0x0f, 0x70, 0xc0, 0x4e], "pshufhw xmm0, xmm0, 0x4e"),
testcase!(&[0xf3, 0x0f, 0x7e, 0xc1], "movq xmm0, xmm1"),
- testcase!(&[0xf3, 0x4f, 0x0f, 0x7e, 0xc1], "movd r9, mm0"), // use of rex.w demotes to movd r/mm
+ testcase!(&[0xf3, 0x4f, 0x0f, 0x7e, 0xc1], "movd r9, mm0"),
testcase!(&[0xf3, 0x40, 0x0f, 0x7e, 0xc1], "movq xmm0, xmm1"),
testcase!(&[0xf3, 0x41, 0x0f, 0x7e, 0xc1], "movq xmm0, xmm9"),
testcase!(&[0xf3, 0x42, 0x0f, 0x7e, 0xc1], "movq xmm0, xmm1"),
@@ -1982,7 +1984,7 @@ mod misc {
testcase!(&[0x66, 0x0f, 0xae, 0xf7], "tpause edi"),
testcase!(&[0xf3, 0x0f, 0xae, 0xf1], "umonitor rcx"),
testcase!(&[0xf2, 0x0f, 0xae, 0xf1], "umwait ecx"),
- testcase!(&[0xf2, 0x4f, 0x0f, 0xae, 0xf1], "umwait r9"),
+ testcase!(&[0xf2, 0x4f, 0x0f, 0xae, 0xf1], "umwait r9d"),
testcase!(&[0x66, 0x0f, 0x38, 0x80, 0x2f], "invept rbp, xmmword [rdi]"),
testcase!(&[0x66, 0x49, 0x0f, 0x38, 0x80, 0x2f], "invept rbp, xmmword [r15]"),
testcase!(invalid: &[0x0f, 0x38, 0x80, 0x2f]),
@@ -1996,7 +1998,7 @@ mod misc {
testcase!(invalid: &[0x0f, 0x38, 0x82, 0x2f]),
testcase!(invalid: &[0x43, 0x0f, 0x38, 0x82, 0x2f]),
testcase!(&[0x66, 0x0f, 0xae, 0xf1], "tpause ecx"),
- testcase!(&[0x66, 0x4f, 0x0f, 0xae, 0xf1], "tpause r9"),
+ testcase!(&[0x66, 0x4f, 0x0f, 0xae, 0xf1], "tpause r9d"),
testcase!(&[0xc4, 0b000_00011, 0b0_1111_101, 0x1d, 0b11_001_010, 0x77], "vcvtps2ph xmm10, ymm9, 0x77"),
];
@@ -2032,7 +2034,6 @@ mod evex {
testcase!(&[0x62, 0x12, 0x7d, 0x06, 0xa0, 0x14, 0x0f], "vpscatterdd dword [r15 + xmm25 * 1], k6, xmm10"),
testcase!(&[0x62, 0x12, 0x7d, 0x26, 0xa0, 0x14, 0x0f], "vpscatterdd dword [r15 + ymm25 * 1], k6, ymm10"),
testcase!(&[0x62, 0x12, 0x7d, 0x46, 0xa0, 0x14, 0x0f], "vpscatterdd dword [r15 + zmm25 * 1], k6, zmm10"),
-
testcase!(&[0x62, 0x12, 0xfd, 0x46, 0xa0, 0x14, 0x0f], "vpscatterdq qword [r15 + zmm25 * 1], k6, zmm10"),
testcase!(&[0x62, 0x12, 0x7d, 0x46, 0xa1, 0x14, 0x0f], "vpscatterqd dword [r15 + zmm25 * 1], k6, zmm10"),
testcase!(&[0x62, 0x12, 0xfd, 0x46, 0xa1, 0x14, 0x0f], "vpscatterqq qword [r15 + zmm25 * 1], k6, zmm10"),
@@ -3582,7 +3583,7 @@ mod rdpid {
use crate::long_mode::{TestCase, run_test};
const CASES: &'static [TestCase] = &[
- testcase!(&[0xf3, 0x0f, 0xc7, 0xfd], "rdpid ebp"),
+ testcase!(&[0xf3, 0x0f, 0xc7, 0xfd], "rdpid rbp"),
];
#[test]
diff --git a/test/protected_mode/mod.rs b/test/protected_mode/mod.rs
index f0450b1..a82c3bc 100644
--- a/test/protected_mode/mod.rs
+++ b/test/protected_mode/mod.rs
@@ -660,13 +660,13 @@ fn test_sse4_1() {
test_instr(&[0x66, 0x0f, 0x38, 0x20, 0x06], "pmovsxbw xmm0, qword [esi]");
test_invalid(&[0x0f, 0x38, 0x20, 0x06]);
- test_instr(&[0x66, 0x0f, 0x38, 0x21, 0x06], "pmovsxbd xmm0, qword [esi]");
+ test_instr(&[0x66, 0x0f, 0x38, 0x21, 0x06], "pmovsxbd xmm0, dword [esi]");
test_invalid(&[0x0f, 0x38, 0x21, 0x06]);
test_instr(&[0x66, 0x0f, 0x38, 0x22, 0x06], "pmovsxbq xmm0, word [esi]");
test_invalid(&[0x0f, 0x38, 0x22, 0x06]);
test_instr(&[0x66, 0x0f, 0x38, 0x23, 0x06], "pmovsxwd xmm0, qword [esi]");
test_invalid(&[0x0f, 0x38, 0x23, 0x06]);
- test_instr(&[0x66, 0x0f, 0x38, 0x24, 0x06], "pmovsxwq xmm0, qword [esi]");
+ test_instr(&[0x66, 0x0f, 0x38, 0x24, 0x06], "pmovsxwq xmm0, dword [esi]");
test_invalid(&[0x0f, 0x38, 0x24, 0x06]);
test_instr(&[0x66, 0x0f, 0x38, 0x25, 0x06], "pmovsxdq xmm0, qword [esi]");
test_invalid(&[0x0f, 0x38, 0x25, 0x06]);
@@ -721,9 +721,9 @@ fn test_sse4_1() {
test_invalid(&[0x0f, 0x3a, 0x08, 0x06]);
test_instr(&[0x66, 0x0f, 0x3a, 0x09, 0x06, 0x31], "roundpd xmm0, xmmword [esi], 0x31");
test_invalid(&[0x0f, 0x3a, 0x09, 0x06]);
- test_instr(&[0x66, 0x0f, 0x3a, 0x0a, 0x06, 0x31], "roundss xmm0, xmmword [esi], 0x31");
+ test_instr(&[0x66, 0x0f, 0x3a, 0x0a, 0x06, 0x31], "roundss xmm0, dword [esi], 0x31");
test_invalid(&[0x0f, 0x3a, 0x0a, 0x06]);
- test_instr(&[0x66, 0x0f, 0x3a, 0x0b, 0x06, 0x31], "roundsd xmm0, xmmword [esi], 0x31");
+ test_instr(&[0x66, 0x0f, 0x3a, 0x0b, 0x06, 0x31], "roundsd xmm0, qword [esi], 0x31");
test_invalid(&[0x0f, 0x3a, 0x0b, 0x06]);
test_instr(&[0x66, 0x0f, 0x3a, 0x0e, 0x06, 0x31], "pblendw xmm0, xmmword [esi], 0x31");
@@ -860,14 +860,14 @@ fn test_0f01() {
// test_display(&[0x0f, 0x01, 0xfe], "invlpgb rax, edx, ecx");
// test_display(&[0x0f, 0x01, 0xff], "tlbsync");
// test_display(&[0x2e, 0x67, 0x65, 0x2e, 0x46, 0x0f, 0x01, 0xff], "tlbsync");
- test_display(&[0x0f, 0x01, 0xe0], "smsw ax");
- test_display(&[0x0f, 0x01, 0xe1], "smsw cx");
- test_display(&[0x0f, 0x01, 0xe2], "smsw dx");
- test_display(&[0x0f, 0x01, 0xe3], "smsw bx");
- test_display(&[0x0f, 0x01, 0xe4], "smsw sp");
- test_display(&[0x0f, 0x01, 0xe5], "smsw bp");
- test_display(&[0x0f, 0x01, 0xe6], "smsw si");
- test_display(&[0x0f, 0x01, 0xe7], "smsw di");
+ test_display(&[0x0f, 0x01, 0xe0], "smsw eax");
+ test_display(&[0x0f, 0x01, 0xe1], "smsw ecx");
+ test_display(&[0x0f, 0x01, 0xe2], "smsw edx");
+ test_display(&[0x0f, 0x01, 0xe3], "smsw ebx");
+ test_display(&[0x0f, 0x01, 0xe4], "smsw esp");
+ test_display(&[0x0f, 0x01, 0xe5], "smsw ebp");
+ test_display(&[0x0f, 0x01, 0xe6], "smsw esi");
+ test_display(&[0x0f, 0x01, 0xe7], "smsw edi");
test_invalid(&[0x0f, 0x01, 0xe8]);
test_invalid(&[0x0f, 0x01, 0xe8]);
test_invalid(&[0x0f, 0x01, 0xe9]);
@@ -944,6 +944,19 @@ fn test_0fae() {
fn test_system() {
test_display(&[0x63, 0xc1], "arpl cx, ax");
test_display(&[0x63, 0x04, 0xba], "arpl word [edx + edi * 4], ax");
+ test_display(&[0x66, 0x0f, 0xb2, 0x00], "lss ax, word [eax]");
+ test_display(&[0x67, 0x0f, 0xb2, 0x00], "lss eax, far [bx + si * 1]");
+ test_display(&[0x0f, 0xb2, 0x00], "lss eax, far [eax]");
+ test_display(&[0x66, 0x0f, 0xb2, 0x00], "lss ax, word [eax]");
+ test_invalid(&[0x0f, 0x22, 0xc8]);
+ test_invalid(&[0x0f, 0x20, 0xc8]);
+ test_display(&[0x0f, 0x22, 0xd0], "mov cr2, eax");
+ test_invalid(&[0x0f, 0x22, 0xcf]);
+ test_display(&[0x0f, 0x22, 0xd7], "mov cr2, edi");
+ test_display(&[0x0f, 0x20, 0xd0], "mov eax, cr2");
+
+ test_display(&[0x0f, 0x23, 0xc8], "mov dr1, eax");
+ test_display(&[0x0f, 0x21, 0xc8], "mov eax, dr1");
test_display(&[0x0f, 0x06], "clts");
}