aboutsummaryrefslogtreecommitdiff
path: root/test/protected_mode/mod.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2021-03-22 23:08:54 -0700
committeriximeow <me@iximeow.net>2021-03-22 23:08:54 -0700
commit0fff2a6aa0832b1cabf381e0c970f0fd47223224 (patch)
tree7001c283a195c49e702eb8557ac8798763358404 /test/protected_mode/mod.rs
parent9e392d3d965ba5f9bcc7d5ceee7c5db6bb2a6fb5 (diff)
port long-mode decoder updates to protected-mode
Diffstat (limited to 'test/protected_mode/mod.rs')
-rw-r--r--test/protected_mode/mod.rs48
1 files changed, 23 insertions, 25 deletions
diff --git a/test/protected_mode/mod.rs b/test/protected_mode/mod.rs
index 98fc8b3..a29b795 100644
--- a/test/protected_mode/mod.rs
+++ b/test/protected_mode/mod.rs
@@ -189,7 +189,6 @@ fn test_aesni() {
test_instr(&[0x66, 0x0f, 0x38, 0xde, 0x0f], "aesdec xmm1, [edi]");
test_instr(&[0x67, 0x66, 0x0f, 0x38, 0xde, 0x0f], "aesdec xmm1, [bx]");
- test_invalid(&[0x66, 0x67, 0x0f, 0x38, 0xde, 0x0f]);
test_instr(&[0x66, 0x0f, 0x38, 0xdf, 0x0f], "aesdeclast xmm1, [edi]");
test_instr(&[0x67, 0x66, 0x0f, 0x38, 0xdf, 0x0f], "aesdeclast xmm1, [bx]");
@@ -377,7 +376,6 @@ fn test_sse2() {
test_instr(&[0x66, 0x0f, 0xc4, 0x03, 0x08], "pinsrw xmm0, [ebx], 0x8");
// test_instr(&[0x66, 0x0f, 0xc5, 0xc3, 0x08], "pextrw eax, xmm3, 0x8");
-// test_instr(&[0x66, 0x4f, 0x0f, 0xc5, 0xc3, 0x08], "pextrw eax, xmm11, 0x8");
// test_instr_invalid(&[0x66, 0x0f, 0xc5, 0x03, 0x08]);
// test_instr_invalid(&[0x66, 0x0f, 0xc5, 0x40, 0x08]);
// test_instr_invalid(&[0x66, 0x0f, 0xc5, 0x80, 0x08]);
@@ -1066,7 +1064,7 @@ fn test_prefixes() {
test_display(&[0xf0, 0x31, 0x00], "lock xor [eax], eax");
test_display(&[0xf0, 0x80, 0x30, 0x00], "lock xor [eax], 0x0");
test_display(&[0xf0, 0x0f, 0xbb, 0x17], "lock btc [edi], edx");
- test_display(&[0x66, 0x2e, 0xf2, 0xf0, 0x0f, 0xbb, 0x13], "lock btc [ebx], dx");
+ test_display(&[0x66, 0x2e, 0xf2, 0xf0, 0x0f, 0xbb, 0x13], "lock btc cs:[ebx], dx");
test_invalid(&[0xf0, 0xc7, 0x00, 0x00, 0x00, 0x00]);
test_display(&[0x0f, 0xc1, 0xcc], "xadd esp, ecx");
test_display(&[0x66, 0x0f, 0xc1, 0xcc], "xadd sp, cx");
@@ -1447,7 +1445,7 @@ fn test_vex() {
test_instr(&[0xc5, 0xe1, 0x55, 0x03], "vandnps xmm0, xmm3, [ebx]");
test_instr(&[0xc5, 0xe0, 0x56, 0x03], "vorpd xmm0, xmm3, [ebx]");
test_instr(&[0xc5, 0xe1, 0x56, 0x03], "vorps xmm0, xmm3, [ebx]");
- test_instr(&[0xc4, 0xa2, 0x15, 0x3e, 0x14, 0xb9], "vpmaxuw ymm2, ymm13, [ecx + edi * 4]");
+ test_instr(&[0xc4, 0xe2, 0x15, 0x3e, 0x14, 0xb9], "vpmaxuw ymm2, ymm5, [ecx + edi * 4]");
}
#[test]
@@ -1494,7 +1492,7 @@ fn prefixed_0f() {
test_display(&[0x0f, 0x1d, 0x20], "nop [eax]");
test_display(&[0x0f, 0x1e, 0x20], "nop [eax]");
test_display(&[0x0f, 0x1f, 0x20], "nop [eax]");
- test_display(&[0x0f, 0x20, 0xc8], "mov eax, cr0");
+ test_display(&[0x0f, 0x20, 0xc0], "mov eax, cr0");
test_invalid(&[0x0f, 0x20, 0xc8]);
test_display(&[0x0f, 0x21, 0xc8], "mov eax, dr1");
test_display(&[0x0f, 0x22, 0xc0], "mov cr0, eax");
@@ -1581,7 +1579,7 @@ fn prefixed_660f() {
#[test]
fn prefixed_f20f() {
test_invalid(&[0xf2, 0x0f, 0x16, 0xcf]);
- test_invalid(&[0x40, 0x66, 0xf2, 0x66, 0x4d, 0x0f, 0x16, 0xcf]);
+ test_invalid(&[0x66, 0xf2, 0x66, 0x0f, 0x16, 0xcf]);
}
#[test]
@@ -2119,27 +2117,27 @@ fn test_mishegos_finds() {
// impossible instruction if operands could be read: lock is illegal here.
// test_display(&[f06565f2640f16], "???");
// test_display(&[0x0f, 0x38, 0xf6, 0x8c, 0x98, 0x4d, 0x33, 0xf5, 0xd3, ], "wrssd");
- test_display(&[0x26, 0x36, 0x0f, 0x0f, 0x70, 0xfb, 0x0c], "pi2fw mm6, [eax - 0x5]");
+ test_display(&[0x26, 0x36, 0x0f, 0x0f, 0x70, 0xfb, 0x0c], "pi2fw mm6, ss:[eax - 0x5]");
test_display(&[0x0f, 0xc7, 0x0f], "cmpxchg8b [edi]");
- test_display(&[0x66, 0x3e, 0x26, 0x2e, 0x2e, 0x0f, 0x38, 0x2a, 0x2b, ], "movntdqa xmm5, [ebx]");
- test_display(&[0x66, 0x2e, 0x67, 0x0f, 0x3a, 0x0d, 0xb8, 0xf0, 0x2f, 0x7c, 0xf0, 0x63, ], "blendpd xmm7, [ax - 0xf83d010], 0x63");
- test_display(&[0x66, 0x66, 0x64, 0x3e, 0x0f, 0x38, 0x23, 0x9d, 0x69, 0x0f, 0xa8, 0x2d, ], "pmovsxwd xmm3, fs:[ebp + 0x2da80f69]");
- test_display(&[0x2e, 0x66, 0x26, 0x64, 0x0f, 0x3a, 0x21, 0x0b, 0xb1, ], "insertps xmm1, fs:[ecx], -0x4f");
- test_display(&[0x66, 0x26, 0x0f, 0x3a, 0x42, 0x96, 0x74, 0x29, 0x96, 0xf9, 0x6a], "mpsadbw xmm10, [esi - 0x669d68c], 0x6a");
- test_display(&[0x67, 0x26, 0x66, 0x65, 0x0f, 0x38, 0x3f, 0x9d, 0xcc, 0x03, 0xb3, 0xfa], "pmaxud xmm3, gs:[ebp - 0x54cfc34]");
- test_display(&[0x36, 0x36, 0x2e, 0x0f, 0x38, 0xf9, 0x55, 0x3e, ], "movdiri [ebp + 0x3e], edx");
+ test_display(&[0x66, 0x3e, 0x26, 0x2e, 0x2e, 0x0f, 0x38, 0x2a, 0x2b], "movntdqa xmm5, cs:[ebx]");
+ test_display(&[0x66, 0x2e, 0x67, 0x0f, 0x3a, 0x0d, 0xb8, 0xf0, 0x2f, 0x7c], "blendpd xmm7, cs:[bx + si + 0x2ff0], 0x7c");
+ test_display(&[0x66, 0x66, 0x64, 0x3e, 0x0f, 0x38, 0x23, 0x9d, 0x69, 0x0f, 0xa8, 0x2d], "pmovsxwd xmm3, [ebp + 0x2da80f69]");
+ test_display(&[0x2e, 0x66, 0x26, 0x64, 0x0f, 0x3a, 0x21, 0x0b, 0xb1], "insertps xmm1, fs:[ebx], -0x4f");
+ test_display(&[0x66, 0x26, 0x0f, 0x3a, 0x42, 0x96, 0x74, 0x29, 0x96, 0xf9, 0x6a], "mpsadbw xmm2, es:[esi - 0x669d68c], 0x6a");
+ test_display(&[0x67, 0x26, 0x66, 0x65, 0x0f, 0x38, 0x3f, 0x9d, 0xcc, 0x03], "pmaxud xmm3, gs:[di + 0x3cc]");
+ test_display(&[0x36, 0x36, 0x2e, 0x0f, 0x38, 0xf9, 0x55, 0x3e], "movdiri cs:[ebp + 0x3e], edx");
test_invalid(&[0x66, 0x2e, 0x64, 0x66, 0x0f, 0x38, 0xf8, 0xe2]);
test_display(&[0x67, 0x66, 0x65, 0x3e, 0x0f, 0x6d, 0xd1], "punpckhqdq xmm2, xmm1");
- test_display(&[0x2e, 0x66, 0x0f, 0x3a, 0x0d, 0x40, 0x2d, 0x57], "blendpd xmm0, [eax + 0x2d], 0x57");
- test_display(&[0xf2, 0x3e, 0x26, 0x67, 0x0f, 0xf0, 0xa0, 0x1b, 0x5f, 0xcd, 0xd7], "lddqu xmm4, [ax - 0x2832a0e5]");
+ test_display(&[0x2e, 0x66, 0x0f, 0x3a, 0x0d, 0x40, 0x2d, 0x57], "blendpd xmm0, cs:[eax + 0x2d], 0x57");
+ test_display(&[0xf2, 0x3e, 0x26, 0x67, 0x0f, 0xf0, 0xa0, 0x1b, 0x5f], "lddqu xmm4, es:[bx + si + 0x5f1b]");
test_display(&[0x2e, 0x3e, 0x66, 0x3e, 0x0f, 0x3a, 0x41, 0x30, 0x48], "dppd xmm6, [eax], 0x48");
- test_display(&[0x2e, 0x36, 0x47, 0x0f, 0x18, 0xe7], "nop r15d");
+ test_display(&[0x2e, 0x36, 0x0f, 0x18, 0xe7], "nop edi");
test_display(&[0x65, 0xf0, 0x87, 0x0f], "lock xchg gs:[edi], ecx");
test_display(&[0x66, 0x0f, 0x3a, 0x44, 0x88, 0xb3, 0xad, 0x26, 0x35, 0x75], "pclmulqdq xmm1, [eax + 0x3526adb3], 0x75");
test_display(&[0x0f, 0xff, 0x6b, 0xac], "ud0 ebp, [ebx - 0x54]");
- test_display(&[0xf2, 0xf2, 0x2e, 0x36, 0x0f, 0x38, 0xf8, 0x83, 0x09, 0x1c, 0x9d, 0x3f], "enqcmd eax, [ebx + 0x3f9d1c09]");
+ test_display(&[0xf2, 0xf2, 0x2e, 0x36, 0x0f, 0x38, 0xf8, 0x83, 0x09, 0x1c, 0x9d, 0x3f], "enqcmd eax, ss:[ebx + 0x3f9d1c09]");
test_display(&[0x3e, 0x64, 0xf3, 0x64, 0x0f, 0x38, 0xf8, 0x72, 0x54], "enqcmds esi, fs:[edx + 0x54]");
test_invalid(&[0xf3, 0x0f, 0x38, 0xf8, 0xf3]);
@@ -2208,8 +2206,8 @@ fn test_3dnow() {
test_display(&[0x0f, 0x0f, 0xe0, 0x8a], "pfnacc mm4, mm0");
test_display(&[0x0f, 0x0f, 0x38, 0x8e], "pfpnacc mm7, [eax]");
test_display(&[0x65, 0x67, 0x65, 0x65, 0x0f, 0x0e], "femms");
- test_display(&[0x3e, 0xf3, 0x2e, 0xf2, 0x0f, 0x0f, 0x64, 0x93, 0x93, 0xa4], "pfmax mm4, [ebx + edx * 4 - 0x6d]");
- test_display(&[0x26, 0x36, 0x0f, 0x0f, 0x70, 0xfb, 0x0c], "pi2fw mm6, [eax - 0x5]");
+ test_display(&[0x3e, 0xf3, 0x2e, 0xf2, 0x0f, 0x0f, 0x64, 0x93, 0x93, 0xa4], "pfmax mm4, cs:[ebx + edx * 4 - 0x6d]");
+ test_display(&[0x26, 0x36, 0x0f, 0x0f, 0x70, 0xfb, 0x0c], "pi2fw mm6, ss:[eax - 0x5]");
test_display(&[0x66, 0x0f, 0x0f, 0xc6, 0xb7], "pmulhrw mm0, mm6");
test_display(&[0x0f, 0x0f, 0xc6, 0xb7], "pmulhrw mm0, mm6");
}
@@ -2217,8 +2215,8 @@ fn test_3dnow() {
// first appeared in tremont
#[test]
fn test_direct_stores() {
- test_display(&[0x36, 0x36, 0x2e, 0x0f, 0x38, 0xf9, 0x55, 0x3e, ], "movdiri [ebp + 0x3e], edx");
- test_display(&[0x36, 0x26, 0x66, 0x0f, 0x38, 0xf8, 0xad, 0x0b, 0x08, 0x29, 0x07], "movdir64b ebp, [ebp + 0x729080b]");
+ test_display(&[0x36, 0x36, 0x2e, 0x0f, 0x38, 0xf9, 0x55, 0x3e, ], "movdiri cs:[ebp + 0x3e], edx");
+ test_invalid(&[0x36, 0x26, 0x66, 0x0f, 0x38, 0xf8, 0xad, 0x0b, 0x08, 0x29, 0x07]);
}
#[test]
@@ -2243,15 +2241,15 @@ fn test_uintr() {
// started shipping in sapphire rapids
#[test]
fn test_enqcmd() {
- test_display(&[0xf2, 0xf2, 0x2e, 0x36, 0x0f, 0x38, 0xf8, 0x83, 0x09, 0x1c, 0x9d, 0x3f], "enqcmd eax, [ebx + 0x3f9d1c09]");
+ test_display(&[0xf2, 0xf2, 0x2e, 0x36, 0x0f, 0x38, 0xf8, 0x83, 0x09, 0x1c, 0x9d, 0x3f], "enqcmd eax, ss:[ebx + 0x3f9d1c09]");
test_display(&[0x3e, 0x64, 0xf3, 0x64, 0x0f, 0x38, 0xf8, 0x72, 0x54], "enqcmds esi, fs:[edx + 0x54]");
}
#[test]
fn test_gfni() {
test_display(&[0x3e, 0x64, 0x64, 0x66, 0x0f, 0x3a, 0xcf, 0xba, 0x13, 0x23, 0x04, 0xba, 0x6b], "gf2p8affineinvqb xmm7, fs:[edx - 0x45fbdced], 0x6b");
- test_display(&[0x66, 0x36, 0x0f, 0x3a, 0xce, 0x8c, 0x56, 0x9e, 0x82, 0xd1, 0xbe, 0xad], "gf2p8affineqb xmm1, [esi + edx * 2 - 0x412e7d62], 0xad");
- test_display(&[0x66, 0x0f, 0x38, 0xcf, 0x1c, 0x54], "gf2p8mulb xmm11, [esp + edx * 2]");
+ test_display(&[0x66, 0x36, 0x0f, 0x3a, 0xce, 0x8c, 0x56, 0x9e, 0x82, 0xd1, 0xbe, 0xad], "gf2p8affineqb xmm1, ss:[esi + edx * 2 - 0x412e7d62], 0xad");
+ test_display(&[0x66, 0x0f, 0x38, 0xcf, 0x1c, 0x54], "gf2p8mulb xmm3, [esp + edx * 2]");
}
#[test]