aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2020-08-09 12:56:57 -0700
committeriximeow <me@iximeow.net>2020-08-09 13:01:53 -0700
commita00851d965cecf8bc31b3a9e668c34648e816060 (patch)
tree73c47f80914543c03aad186856b93c8ddcb07685
parent621e2a038fd055d18808a5019ac03d335ab635aa (diff)
update protected mode tests
-rw-r--r--test/protected_mode/mod.rs778
1 files changed, 769 insertions, 9 deletions
diff --git a/test/protected_mode/mod.rs b/test/protected_mode/mod.rs
index 3443565..e37c1e6 100644
--- a/test/protected_mode/mod.rs
+++ b/test/protected_mode/mod.rs
@@ -4,7 +4,7 @@ mod operand;
use std::fmt::Write;
use yaxpeax_arch::{AddressBase, Decoder, LengthedInstruction};
-use yaxpeax_x86::protected_mode::{DecodeError, InstDecoder, Opcode};
+use yaxpeax_x86::protected_mode::{InstDecoder, Opcode};
fn test_invalid(data: &[u8]) {
test_invalid_under(&InstDecoder::default(), data);
@@ -51,6 +51,17 @@ fn test_display_under(decoder: &InstDecoder, data: &[u8], expected: &'static str
#[test]
fn test_mmx() {
+ test_display(&[0x4f, 0x0f, 0xf7, 0xc1], "maskmovq mm0, mm1");
+ test_display(&[0x0f, 0xf7, 0xc1], "maskmovq mm0, mm1");
+ test_invalid(&[0x0f, 0xf7, 0x01]);
+
+ test_display(&[0x0f, 0xe7, 0x03], "movntq [ebx], mm0");
+ test_invalid(&[0x0f, 0xe7, 0xc3]);
+
+ test_display(&[0x66, 0x0f, 0xc3, 0x03], "movnti [ebx], eax");
+ test_display(&[0x0f, 0xc3, 0x03], "movnti [ebx], eax");
+ test_invalid(&[0x0f, 0xc3, 0xc3]);
+
test_display(&[0x0f, 0x7e, 0xcf], "movd edi, mm1");
test_display(&[0x0f, 0x7f, 0xcf], "movq mm7, mm1");
test_display(&[0x0f, 0x7f, 0x0f], "movq [edi], mm1");
@@ -60,6 +71,52 @@ fn test_mmx() {
test_display(&[0x0f, 0xd1, 0x00], "psrlw mm0, [eax]");
test_invalid(&[0x0f, 0xd7, 0x00]);
test_display(&[0x0f, 0xd7, 0xcf], "pmovmskb ecx, mm7");
+ test_display(&[0x0f, 0x3a, 0x0f, 0xc1, 0x23], "palignr mm0, mm1, 0x23");
+ test_display(&[0x0f, 0xf9, 0xc2], "psubw mm0, mm2");
+ test_display(&[0x0f, 0xfd, 0xd2], "paddw mm2, mm2");
+ test_display(&[0x0f, 0x6f, 0xe9], "movq mm5, mm1");
+ test_display(&[0x0f, 0xe5, 0x3d, 0xaa, 0xbb, 0xcc, 0x77], "pmulhw mm7, [eip + 0x77ccbbaa]");
+
+ test_display(&[0x0f, 0x38, 0x00, 0xda], "pshufb mm3, mm2");
+
+ test_display(&[0x0f, 0x74, 0xc2], "pcmpeqb mm0, mm2");
+ test_display(&[0x0f, 0x75, 0xc2], "pcmpeqw mm0, mm2");
+ test_display(&[0x0f, 0x76, 0xc2], "pcmpeqd mm0, mm2");
+
+ test_display(&[0x0f, 0xc5, 0xd1, 0x00], "pextrw edx, mm1, 0x0");
+
+ test_display(&[0x0f, 0xd8, 0xc2], "psubusb mm0, mm2");
+ test_display(&[0x0f, 0xd9, 0xc2], "psubusw mm0, mm2");
+ test_display(&[0x0f, 0xda, 0xc2], "pminub mm0, mm2");
+ test_display(&[0x0f, 0xdb, 0xc2], "pand mm0, mm2");
+ test_display(&[0x0f, 0xdc, 0xc2], "paddusb mm0, mm2");
+ test_display(&[0x0f, 0xdd, 0xc2], "paddusw mm0, mm2");
+ test_display(&[0x0f, 0xde, 0xc2], "pmaxub mm0, mm2");
+ test_display(&[0x0f, 0xdf, 0xc2], "pandn mm0, mm2");
+
+ test_display(&[0x0f, 0xe8, 0xc2], "psubsb mm0, mm2");
+ test_display(&[0x0f, 0xe9, 0xc2], "psubsw mm0, mm2");
+ test_display(&[0x0f, 0xea, 0xc2], "pminsw mm0, mm2");
+ test_display(&[0x0f, 0xeb, 0xc2], "por mm0, mm2");
+ test_display(&[0x0f, 0xec, 0xc2], "paddsb mm0, mm2");
+ test_display(&[0x0f, 0xed, 0xc2], "paddsw mm0, mm2");
+ test_display(&[0x0f, 0xee, 0xc2], "pmaxsw mm0, mm2");
+ test_display(&[0x0f, 0xef, 0xc2], "pxor mm0, mm2");
+
+ test_invalid(&[0x0f, 0xf0, 0xc2]);
+ test_display(&[0x0f, 0xf1, 0xc2], "psllw mm0, mm2");
+ test_display(&[0x0f, 0xf2, 0xc2], "pslld mm0, mm2");
+ test_display(&[0x0f, 0xf3, 0xc2], "psllq mm0, mm2");
+ test_display(&[0x0f, 0xf4, 0xc2], "pmuludq mm0, mm2");
+ test_display(&[0x0f, 0xf5, 0xc2], "pmaddwd mm0, mm2");
+ test_display(&[0x0f, 0xf6, 0xc2], "psadbw mm0, mm2");
+ test_display(&[0x0f, 0xf8, 0xc2], "psubb mm0, mm2");
+ test_display(&[0x0f, 0xf9, 0xc2], "psubw mm0, mm2");
+ test_display(&[0x0f, 0xfa, 0xc2], "psubd mm0, mm2");
+ test_display(&[0x0f, 0xfb, 0xc2], "psubq mm0, mm2");
+ test_display(&[0x0f, 0xfc, 0xc2], "paddb mm0, mm2");
+ test_display(&[0x0f, 0xfd, 0xc2], "paddw mm0, mm2");
+ test_display(&[0x0f, 0xfe, 0xc2], "paddd mm0, mm2");
}
#[test]
@@ -450,6 +507,224 @@ fn test_sse3() {
}
#[test]
+fn test_sse4_2() {
+ fn test_instr(bytes: &[u8], text: &'static str) {
+ test_display_under(&InstDecoder::minimal().with_sse4_2(), bytes, text);
+ test_invalid_under(&InstDecoder::minimal(), bytes);
+ // avx doesn't imply older instructions are necessarily valid
+ test_invalid_under(&InstDecoder::minimal().with_avx(), bytes);
+ }
+
+ #[allow(unused)]
+ fn test_instr_invalid(bytes: &[u8]) {
+ test_invalid_under(&InstDecoder::minimal().with_sse4_2(), bytes);
+ test_invalid_under(&InstDecoder::default(), bytes);
+ }
+
+ test_instr(&[0x66, 0x0f, 0x38, 0x37, 0x03], "pcmpgtq xmm0, [rbx]");
+ test_instr(&[0x66, 0x0f, 0x38, 0x37, 0xc3], "pcmpgtq xmm0, xmm3");
+
+ test_instr(&[0xf2, 0x0f, 0x38, 0xf0, 0x06], "crc32 eax, [rsi]");
+ test_instr(&[0xf2, 0x0f, 0x38, 0xf0, 0xc6], "crc32 eax, dh");
+ test_instr(&[0xf2, 0x0f, 0x38, 0xf1, 0x06], "crc32 eax, [rsi]");
+ test_instr(&[0xf2, 0x0f, 0x38, 0xf1, 0xc6], "crc32 eax, esi");
+ test_instr(&[0x66, 0xf2, 0x0f, 0x38, 0xf1, 0xc6], "crc32 eax, si");
+ test_instr(&[0x66, 0xf2, 0x48, 0x0f, 0x38, 0xf1, 0xc6], "crc32 rax, rsi");
+
+ test_instr(&[0x66, 0x0f, 0x3a, 0x60, 0xc6, 0x54], "pcmpestrm xmm0, xmm6, 0x54");
+ test_instr(&[0x66, 0x0f, 0x3a, 0x60, 0x06, 0x54], "pcmpestrm xmm0, [rsi], 0x54");
+ test_instr(&[0x66, 0x0f, 0x3a, 0x61, 0xc6, 0x54], "pcmpestri xmm0, xmm6, 0x54");
+ test_instr(&[0x66, 0x0f, 0x3a, 0x61, 0x06, 0x54], "pcmpestri xmm0, [rsi], 0x54");
+ test_instr(&[0x66, 0x0f, 0x3a, 0x62, 0xc6, 0x54], "pcmpistrm xmm0, xmm6, 0x54");
+ test_instr(&[0x66, 0x0f, 0x3a, 0x62, 0x06, 0x54], "pcmpistrm xmm0, [rsi], 0x54");
+ test_instr(&[0x66, 0x0f, 0x3a, 0x63, 0xc6, 0x54], "pcmpistri xmm0, xmm6, 0x54");
+ test_instr(&[0x66, 0x0f, 0x3a, 0x63, 0x06, 0x54], "pcmpistri xmm0, [rsi], 0x54");
+}
+
+#[test]
+fn test_sse4_1() {
+ fn test_instr(bytes: &[u8], text: &'static str) {
+ test_display_under(&InstDecoder::minimal().with_sse4_1(), bytes, text);
+ test_invalid_under(&InstDecoder::minimal(), bytes);
+ // avx doesn't imply older instructions are necessarily valid
+ test_invalid_under(&InstDecoder::minimal().with_avx(), bytes);
+ // sse4_2 doesn't imply older instructions are necessarily valid
+ test_invalid_under(&InstDecoder::minimal().with_sse4_2(), bytes);
+ }
+
+ #[allow(unused)]
+ fn test_instr_invalid(bytes: &[u8]) {
+ test_invalid_under(&InstDecoder::minimal().with_sse4_1(), bytes);
+ test_invalid_under(&InstDecoder::default(), bytes);
+ }
+
+ test_instr(&[0x66, 0x0f, 0x38, 0x0c, 0x06], "blendps xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x0c, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x0d, 0x06], "blendpd xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x0d, 0x06]);
+
+ test_instr(&[0x66, 0x0f, 0x38, 0x10, 0x06], "pblendvb xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x10, 0x06]);
+
+ test_instr(&[0x66, 0x0f, 0x38, 0x14, 0x06], "blendvps xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x14, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x15, 0x06], "blendvpd xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x15, 0x06]);
+
+ test_instr(&[0x66, 0x0f, 0x38, 0x17, 0x06], "ptest xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x17, 0x06]);
+
+ test_instr(&[0x66, 0x0f, 0x38, 0x20, 0x06], "pmovsxbw xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x20, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x21, 0x06], "pmovsxbd xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x21, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x22, 0x06], "pmovsxbq xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x22, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x23, 0x06], "pmovsxwd xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x23, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x24, 0x06], "pmovsxwq xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x24, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x25, 0x06], "pmovsxdq xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x25, 0x06]);
+
+ test_instr(&[0x66, 0x0f, 0x38, 0x28, 0x06], "pmuldq xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x28, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x29, 0x06], "pcmpeqq xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x29, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x2a, 0x06], "movntdqa xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x2a, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x2b, 0x06], "packusdw xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x2b, 0x06]);
+
+ test_instr(&[0x66, 0x0f, 0x38, 0x30, 0x06], "pmovzxbw xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x30, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x31, 0x06], "pmovzxbd xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x31, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x32, 0x06], "pmovzxbq xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x32, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x33, 0x06], "pmovzxwd xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x33, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x34, 0x06], "pmovzxwq xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x34, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x35, 0x06], "pmovzxdq xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x35, 0x06]);
+
+ test_instr(&[0x66, 0x0f, 0x38, 0x38, 0x06], "pminsb xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x38, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x39, 0x06], "pminsd xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x39, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x3a, 0x06], "pminuw xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x3a, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x3b, 0x06], "pminud xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x3b, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x3c, 0x06], "pmaxsb xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x3c, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x3d, 0x06], "pmaxsd xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x3d, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x3e, 0x06], "pmaxuw xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x3e, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x3f, 0x06], "pmaxud xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x3f, 0x06]);
+
+
+ test_instr(&[0x66, 0x0f, 0x38, 0x40, 0x06], "pmulld xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x40, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x38, 0x41, 0x06], "phminposuw xmm0, [rsi]");
+ test_invalid(&[0x0f, 0x38, 0x41, 0x06]);
+
+ test_instr(&[0x66, 0x0f, 0x3a, 0x08, 0x06, 0x31], "roundps xmm0, [rsi], 0x31");
+ test_invalid(&[0x0f, 0x3a, 0x08, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x3a, 0x09, 0x06, 0x31], "roundpd xmm0, [rsi], 0x31");
+ test_invalid(&[0x0f, 0x3a, 0x09, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x3a, 0x0a, 0x06, 0x31], "roundss xmm0, [rsi], 0x31");
+ test_invalid(&[0x0f, 0x3a, 0x0a, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x3a, 0x0b, 0x06, 0x31], "roundsd xmm0, [rsi], 0x31");
+ test_invalid(&[0x0f, 0x3a, 0x0b, 0x06]);
+
+ test_instr(&[0x66, 0x0f, 0x3a, 0x0e, 0x06, 0x31], "pblendw xmm0, [rsi], 0x31");
+ test_invalid(&[0x0f, 0x3a, 0x0e, 0x06]);
+
+ test_instr(&[0x66, 0x0f, 0x3a, 0x14, 0x06, 0x31], "pextrb xmm0, [rsi], 0x31");
+ test_invalid(&[0x0f, 0x3a, 0x14, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x3a, 0x15, 0x06, 0x31], "pextrw xmm0, [rsi], 0x31");
+ test_invalid(&[0x0f, 0x3a, 0x15, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x3a, 0x16, 0x06, 0x31], "pextrd xmm0, [rsi], 0x31");
+ test_invalid(&[0x0f, 0x3a, 0x16, 0x06]);
+ test_instr(&[0x66, 0x48, 0x0f, 0x3a, 0x16, 0x06, 0x31], "pextrq xmm0, [rsi], 0x31");
+ test_instr(&[0x66, 0x0f, 0x3a, 0x17, 0x06, 0x31], "extractps xmm0, [rsi], 0x31");
+ test_invalid(&[0x0f, 0x3a, 0x17, 0x06]);
+
+ test_instr(&[0x66, 0x0f, 0x3a, 0x20, 0x06, 0x31], "pinsrb xmm0, [rsi], 0x31");
+ test_invalid(&[0x0f, 0x3a, 0x20, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x3a, 0x21, 0x06, 0x31], "insertps xmm0, [rsi], 0x31");
+ test_invalid(&[0x0f, 0x3a, 0x21, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x3a, 0x22, 0x06, 0x31], "pinsrd xmm0, [rsi], 0x31");
+ test_invalid(&[0x0f, 0x3a, 0x22, 0x06]);
+ test_instr(&[0x66, 0x48, 0x0f, 0x3a, 0x22, 0x06, 0x31], "pinsrq xmm0, [rsi], 0x31");
+
+ test_instr(&[0x66, 0x0f, 0x3a, 0x40, 0x06, 0x31], "dpps xmm0, [rsi], 0x31");
+ test_invalid(&[0x0f, 0x3a, 0x40, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x3a, 0x41, 0x06, 0x31], "dppd xmm0, [rsi], 0x31");
+ test_invalid(&[0x0f, 0x3a, 0x41, 0x06]);
+ test_instr(&[0x66, 0x0f, 0x3a, 0x42, 0x06, 0x44], "mpsadbw xmm0, [rsi], 0x44");
+ test_invalid(&[0x0f, 0x3a, 0x42, 0x06]);
+}
+
+#[test]
+fn test_ssse3() {
+ fn test_instr(bytes: &[u8], text: &'static str) {
+ test_display_under(&InstDecoder::minimal().with_ssse3(), bytes, text);
+ test_invalid_under(&InstDecoder::minimal(), bytes);
+ // avx doesn't imply older instructions are necessarily valid
+ test_invalid_under(&InstDecoder::minimal().with_avx(), bytes);
+ // sse4 doesn't imply older instructions are necessarily valid
+ test_invalid_under(&InstDecoder::minimal().with_sse4_1(), bytes);
+ test_invalid_under(&InstDecoder::minimal().with_sse4_2(), bytes);
+ }
+
+ #[allow(unused)]
+ fn test_instr_invalid(bytes: &[u8]) {
+ test_invalid_under(&InstDecoder::minimal().with_ssse3(), bytes);
+ test_invalid_under(&InstDecoder::default(), bytes);
+ }
+ test_instr(&[0x66, 0x0f, 0x38, 0x00, 0xda], "pshufb xmm3, xmm2");
+ test_instr(&[0x66, 0x0f, 0x38, 0x00, 0x06], "pshufb xmm0, [rsi]");
+ test_instr(&[0x0f, 0x38, 0x00, 0x06], "pshufb mm0, [rsi]");
+ test_instr(&[0x66, 0x0f, 0x38, 0x01, 0x06], "phaddw xmm0, [rsi]");
+ test_instr(&[0x0f, 0x38, 0x01, 0x06], "phaddw mm0, [rsi]");
+ test_instr(&[0x66, 0x0f, 0x38, 0x02, 0x06], "phaddd xmm0, [rsi]");
+ test_instr(&[0x0f, 0x38, 0x02, 0x06], "phaddd mm0, [rsi]");
+ test_instr(&[0x66, 0x0f, 0x38, 0x03, 0x06], "phaddsw xmm0, [rsi]");
+ test_instr(&[0x0f, 0x38, 0x03, 0x06], "phaddsw mm0, [rsi]");
+ test_instr(&[0x66, 0x0f, 0x38, 0x04, 0x06], "pmaddubsw xmm0, [rsi]");
+ test_instr(&[0x0f, 0x38, 0x04, 0x06], "pmaddubsw mm0, [rsi]");
+ test_instr(&[0x66, 0x0f, 0x38, 0x05, 0x06], "phsubw xmm0, [rsi]");
+ test_instr(&[0x0f, 0x38, 0x05, 0x06], "phsubw mm0, [rsi]");
+ test_instr(&[0x66, 0x0f, 0x38, 0x06, 0x06], "phsubd xmm0, [rsi]");
+ test_instr(&[0x0f, 0x38, 0x06, 0x06], "phsubd mm0, [rsi]");
+ test_instr(&[0x66, 0x0f, 0x38, 0x07, 0x06], "phsubsw xmm0, [rsi]");
+ test_instr(&[0x0f, 0x38, 0x07, 0x06], "phsubsw mm0, [rsi]");
+ test_instr(&[0x66, 0x0f, 0x38, 0x08, 0x06], "psignb xmm0, [rsi]");
+ test_instr(&[0x0f, 0x38, 0x08, 0x06], "psignb mm0, [rsi]");
+ test_instr(&[0x66, 0x0f, 0x38, 0x09, 0x06], "psignw xmm0, [rsi]");
+ test_instr(&[0x0f, 0x38, 0x09, 0x06], "psignw mm0, [rsi]");
+ test_instr(&[0x66, 0x0f, 0x38, 0x0a, 0x06], "psignd xmm0, [rsi]");
+ test_instr(&[0x0f, 0x38, 0x0a, 0x06], "psignd mm0, [rsi]");
+ test_instr(&[0x66, 0x0f, 0x38, 0x0b, 0x06], "pmulhrsw xmm0, [rsi]");
+ test_instr(&[0x0f, 0x38, 0x0b, 0x06], "pmulhrsw mm0, [rsi]");
+
+ test_instr(&[0x66, 0x0f, 0x38, 0x1c, 0x06], "pabsb xmm0, [rsi]");
+ test_instr(&[0x0f, 0x38, 0x1c, 0x06], "pabsb mm0, [rsi]");
+ test_instr(&[0x66, 0x0f, 0x38, 0x1d, 0x06], "pabsw xmm0, [rsi]");
+ test_instr(&[0x0f, 0x38, 0x1d, 0x06], "pabsw mm0, [rsi]");
+ test_instr(&[0x66, 0x0f, 0x38, 0x1e, 0x06], "pabsd xmm0, [rsi]");
+ test_instr(&[0x0f, 0x38, 0x1e, 0x06], "pabsd mm0, [rsi]");
+
+ test_instr(&[0x66, 0x0f, 0x3a, 0x0f, 0x06, 0x30], "palignr xmm0, [rsi], 0x30");
+ test_instr(&[0x0f, 0x3a, 0x0f, 0x06, 0x30], "palignr mm0, [rsi], 0x30");
+}
+
+#[test]
fn test_0f01() {
// drawn heavily from "Table A-6. Opcode Extensions for One- and Two-byte Opcodes by Group
// Number"
@@ -646,9 +921,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(&[0xa0, 0x93, 0x62, 0xc4, 0x00], "mov al, [0xc46293]");
+ test_display(&[0x67, 0xa0, 0x93, 0x62], "mov al, [0xc293]");
test_display(&[0xa1, 0x93, 0x62, 0xc4, 0x00], "mov eax, [0xc46293]");
+ test_display(&[0x67, 0xa1, 0x93, 0x62], "mov eax, [0x6293]");
+ test_display(&[0xa2, 0x93, 0x62, 0xc4, 0x00], "mov [0xc46293], al");
+ test_display(&[0x67, 0xa2, 0x93, 0x62], "mov [0x6293], al");
+ test_display(&[0xa3, 0x93, 0x62, 0xc4, 0x00], "mov [0xc46293], eax");
+ test_display(&[0x67, 0xa3, 0x93, 0x62], "mov [0x6293], eax");
test_display(&[0xba, 0x01, 0x00, 0x00, 0x00], "mov edx, 0x1");
test_display(&[0xc7, 0x04, 0x24, 0x00, 0x00, 0x00, 0x00], "mov [esp], 0x0");
test_display(&[0x89, 0x44, 0x24, 0x08], "mov [esp + 0x8], eax");
@@ -666,6 +946,11 @@ fn test_mov() {
test_display(&[0x0f, 0xbe, 0x83, 0xb4, 0x00, 0x00, 0x00], "movsx eax, byte [ebx + 0xb4]");
test_display(&[0xf3, 0x0f, 0x6f, 0x07], "movdqu xmm0, [edi]");
test_display(&[0xf3, 0x0f, 0x7f, 0x45, 0x00], "movdqu [ebp], xmm0");
+
+ test_display(&[0x0f, 0x97, 0xc0], "seta al");
+ test_display(&[0x0f, 0x97, 0xc8], "seta al");
+ test_display(&[0x0f, 0x97, 0x00], "seta [eax]");
+ test_display(&[0x0f, 0x97, 0x08], "seta [eax]");
}
#[test]
@@ -678,9 +963,6 @@ fn test_prefixes() {
test_display(&[0x66, 0x31, 0xc0], "xor ax, ax");
test_display(&[0x66, 0x32, 0xc0], "xor al, al");
test_display(&[0x66, 0x32, 0xc5], "xor al, ch");
-
- // test that WAIT doesn't blow up, at least...
- assert_eq!(InstDecoder::default().decode([0x9b, 0xf8].iter().cloned()).err(), Some(DecodeError::IncompleteDecoder));
}
#[test]
@@ -696,8 +978,25 @@ fn test_control_flow() {
test_display(&[0x67, 0xff, 0xe0], "jmp eax");
test_invalid(&[0xff, 0xd8]);
test_display(&[0xff, 0x18], "callf [eax]");
+ 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");
}
+
+#[test]
+fn bad_instructions() {
+ // too long
+ test_invalid(&[
+ 0x2e, 0x2e, 0x2e, 0x2e,
+ 0x2e, 0x2e, 0x2e, 0x2e,
+ 0x2e, 0x2e, 0x2e, 0x2e,
+ 0x2e, 0x2e, 0x2e, 0x2e,
+ 0x33, 0xc0,
+ ]);
+}
+
#[test]
fn test_test_cmp() {
@@ -712,6 +1011,8 @@ fn test_push_pop() {
test_display(&[0x5b], "pop ebx");
test_display(&[0x5e], "pop esi");
test_display(&[0x68, 0x7f, 0x63, 0xc4, 0x00], "push 0xc4637f");
+ test_display(&[0x66, 0x8f, 0x00], "pop [rax]");
+ test_display(&[0x8f, 0x00], "pop [rax]");
}
#[test]
@@ -790,13 +1091,24 @@ fn test_bitwise() {
test_display_under(&InstDecoder::minimal(), &[0x0f, 0xbc, 0xd3], "bsf edx, ebx");
test_display(&[0x0f, 0xa3, 0xd0], "bt eax, edx");
test_display(&[0x0f, 0xab, 0xd0], "bts eax, edx");
+ test_display(&[0x0f, 0xb3, 0xd0], "btr eax, edx");
+ test_display(&[0x66, 0x0f, 0xb3, 0xc0], "btr ax, ax");
+ test_display(&[0xd2, 0xe0], "shl al, cl");
}
#[test]
fn test_misc() {
- // TODO
-// test_display(&[0xf2, 0x0f, 0x38, 0xf0, 0xc1], "crc32 eax, cl");
-// test_display(&[0xf2, 0x0f, 0x38, 0xf1, 0xc1], "crc32 eax, ecx");
+ test_display(&[0xf1], "int 0x1");
+ test_display(&[0xf5], "cmc");
+ test_display(&[0xc8, 0x01, 0x02, 0x03], "enter 0x201, 0x3");
+ test_display(&[0xc9], "leave");
+ test_display(&[0xca, 0x12, 0x34], "retf 0x3412");
+ test_display(&[0xcb], "retf");
+ test_display(&[0x66, 0xcf], "iret");
+ test_display(&[0xcf], "iretd");
+ test_display(&[0x66, 0x4f, 0xcf], "iretq");
+ test_display(&[0xf2, 0x0f, 0x38, 0xf0, 0xc1], "crc32 eax, cl");
+ test_display(&[0xf2, 0x0f, 0x38, 0xf1, 0xc1], "crc32 eax, ecx");
test_display(&[0xfe, 0x00], "inc [eax]"); // TODO: inc byte [eax]
test_display(&[0xfe, 0x08], "dec [eax]"); // TODO: dec byte [eax]
test_display(&[0xff, 0x00], "inc [eax]"); // TODO: inc dword [eax]
@@ -821,6 +1133,7 @@ fn test_misc() {
test_display(&[0x8d, 0xa4, 0xc7, 0x20, 0x00, 0x00, 0x12], "lea esp, [edi + eax * 8 + 0x12000020]");
test_display(&[0x33, 0xc0], "xor eax, eax");
test_display(&[0x8d, 0x53, 0x08], "lea edx, [ebx + 0x8]");
+ test_invalid(&[0x8d, 0xdd]);
test_display(&[0x31, 0xc9], "xor ecx, ecx");
test_display(&[0x29, 0xc8], "sub eax, ecx");
test_display(&[0x03, 0x0b], "add ecx, [ebx]");
@@ -966,6 +1279,38 @@ fn test_vex() {
test_instr(&[0xc4, 0xe3, 0x79, 0x14, 0x10, 0x0a], "vpextrb [eax], xmm2, 0xa");
test_instr_invalid(&[0xc4, 0xe3, 0xf9, 0x14, 0x00, 0xd0]);
test_instr_invalid(&[0xc4, 0xe3, 0xf9, 0x14, 0x00, 0x0a]);
+ test_instr(&[0xc5, 0xed, 0x71, 0xd0, 0x04], "vpsrlw ymm2, ymm0, 0x4");
+ test_instr(&[0xc5, 0xed, 0x73, 0xd4, 0x20], "vpsrlq ymm2, ymm4, 0x20");
+ test_instr(&[0xc4, 0xe3, 0xfd, 0x00, 0xc1, 0xa8], "vpermq ymm0, ymm1, 0xa8");
+ test_instr(&[0xc5, 0xfd, 0xea, 0xd1], "vpminsw ymm2, ymm0, ymm1");
+ test_instr(&[0xc5, 0xfd, 0xee, 0xd9], "vpmaxsw ymm3, ymm0, ymm1");
+ test_instr(&[0xc4, 0xe3, 0x7d, 0x19, 0xd1, 0x01], "vextractf128 xmm1, ymm2, 0x1");
+ test_instr(&[0xc4, 0xc3, 0x75, 0x38, 0x7c, 0x12, 0x05, 0x01], "vinserti128 ymm7, ymm1, [edx + edx * 1 + 0x5], 0x1");
+ test_instr(&[0xc4, 0xc3, 0x75, 0x42, 0x7c, 0x12, 0x05, 0x61], "vmpsadbw ymm7, ymm1, [edx + edx * 1 + 0x5], 0x61");
+ test_instr(&[0xc4, 0xc3, 0x75, 0x46, 0x7c, 0x12, 0x05, 0x61], "vperm2i128 ymm7, ymm1, [edx + edx * 1 + 0x5], 0x61");
+ test_instr(&[0xc4, 0xc3, 0x75, 0x4a, 0x7c, 0x12, 0x05, 0x61], "vblendvps ymm7, ymm1, [edx + edx * 1 + 0x5], ymm6");
+ test_instr(&[0xc4, 0xc3, 0x71, 0x4a, 0x7c, 0x12, 0x05, 0x61], "vblendvps xmm7, xmm1, [edx + edx * 1 + 0x5], xmm6");
+ test_instr(&[0xc4, 0xc3, 0x71, 0x4a, 0xdc, 0x61], "vblendvps xmm3, xmm1, xmm12, xmm6");
+ test_instr(&[0xc4, 0xc3, 0x75, 0x4b, 0x7c, 0x12, 0x05, 0x61], "vblendvpd ymm7, ymm1, [edx + edx * 1 + 0x5], ymm6");
+ test_instr(&[0xc4, 0xc3, 0x71, 0x4b, 0x7c, 0x12, 0x05, 0x61], "vblendvpd xmm7, xmm1, [edx + rdx * 1 + 0x5], xmm6");
+ test_instr(&[0xc4, 0xc3, 0x71, 0x4b, 0xdc, 0x61], "vblendvpd xmm3, xmm1, xmm12, xmm6");
+ test_instr(&[0xc4, 0xc3, 0x71, 0x4c, 0x7c, 0x12, 0x05, 0x61], "vpblendvb xmm7, xmm1, [edx + edx * 1 + 0x5], xmm6");
+
+ test_instr(&[0xc5, 0xc9, 0xf1, 0x0f], "vpsllw xmm1, xmm6, [edi]");
+ test_instr(&[0xc5, 0xc9, 0xf1, 0xcf], "vpsllw xmm1, xmm6, xmm7");
+ test_instr(&[0xc5, 0xcd, 0xf1, 0x0f], "vpsllw ymm1, ymm6, [edi]");
+ test_instr(&[0xc5, 0xcd, 0xf1, 0xcf], "vpsllw ymm1, ymm6, xmm7");
+ test_instr(&[0xc5, 0xc9, 0xf2, 0x0f], "vpslld xmm1, xmm6, [edi]");
+ test_instr(&[0xc5, 0xc9, 0xf2, 0xcf], "vpslld xmm1, xmm6, xmm7");
+ test_instr(&[0xc5, 0xcd, 0xf2, 0x0f], "vpslld ymm1, ymm6, [edi]");
+ test_instr(&[0xc5, 0xcd, 0xf2, 0xcf], "vpslld ymm1, ymm6, xmm7");
+ test_instr(&[0xc5, 0xc9, 0xf3, 0x0f], "vpsllq xmm1, xmm6, [edi]");
+ test_instr(&[0xc5, 0xc9, 0xf3, 0xcf], "vpsllq xmm1, xmm6, xmm7");
+ test_instr(&[0xc5, 0xcd, 0xf3, 0x0f], "vpsllq ymm1, ymm6, [edi]");
+ test_instr(&[0xc5, 0xcd, 0xf3, 0xcf], "vpsllq ymm1, ymm6, xmm7");
+
+ test_instr(&[0xc5, 0xf1, 0xc4, 0xd8, 0x78], "vpinsrw xmm3, xmm1, eax, 0x78");
+ test_instr(&[0xc5, 0xf1, 0xc4, 0x18, 0x78], "vpinsrw xmm3, xmm1, [eax], 0x78");
}
#[test]
@@ -1055,6 +1400,7 @@ fn prefixed_0f() {
test_display(&[0x0f, 0x6e, 0xc2], "movd mm0, edx");
test_display(&[0x0f, 0x6f, 0x00], "movq mm0, [eax]");
test_display(&[0x0f, 0x6f, 0xc2], "movq mm0, mm2");
+ test_display(&[0x0f, 0x6f, 0xfb], "movq mm7, mm3");
test_display(&[0x0f, 0x70, 0x00, 0x7f], "pshufw mm0, [eax], 0x7f");
test_invalid(&[0x0f, 0x71, 0x00, 0x7f]);
test_invalid(&[0x0f, 0x71, 0xc0, 0x7f]);
@@ -1078,6 +1424,9 @@ fn prefixed_0f() {
test_display(&[0x66, 0x0f, 0xa4, 0xcf, 0x11], "shld di, cx, 0x11");
test_display(&[0x0f, 0xa5, 0xc0], "shld eax, eax, cl");
test_display(&[0x0f, 0xa5, 0xc9], "shld ecx, ecx, cl");
+ test_display(&[0x0f, 0xac, 0xc0, 0x11], "shrd eax, eax, 0x11");
+ test_display(&[0x66, 0x0f, 0xac, 0xcf, 0x11], "shrd di, cx, 0x11");
+ test_display(&[0x0f, 0xad, 0xc9], "shrd ecx, ecx, cl");
}
#[test]
@@ -1140,6 +1489,12 @@ fn test_svm() {
test_display(&[0x0f, 0x01, 0xda], "vmload eax");
test_display(&[0x0f, 0x01, 0xd9], "vmmcall");
test_display(&[0x0f, 0x01, 0xd8], "vmrun eax");
+ test_display(&[0x0f, 0x78, 0xc4], "vmread esp, eax");
+ test_display(&[0x0f, 0x79, 0xc5], "vmwrite eax, ebp");
+ test_display(&[0x0f, 0x78, 0x0b], "vmread [ebx], ecx");
+ test_invalid(&[0x66, 0x0f, 0x78, 0x03]);
+ test_display(&[0x0f, 0x79, 0x0b], "vmwrite ecx, [ebx]");
+ test_invalid(&[0x66, 0x0f, 0x79, 0x03]);
}
#[test]
@@ -1174,3 +1529,408 @@ fn test_sha() {
test_display(&[0x0f, 0x38, 0xcc, 0x12], "sha256msg1 xmm2, [edx]");
test_display(&[0x0f, 0x38, 0xcd, 0x12], "sha256msg2 xmm2, [edx]");
}
+
+#[test]
+fn test_vmx() {
+ test_display(&[0x0f, 0xc7, 0x3f], "vmptrst [edi]");
+ test_display(&[0x0f, 0xc7, 0x37], "vmptrld [edi]");
+ test_display(&[0xf3, 0x0f, 0xc7, 0xf7], "rdrand edi");
+ test_display(&[0xf3, 0x0f, 0xc7, 0x37], "vmxon [edi]");
+ test_display(&[0x66, 0x0f, 0xc7, 0xf7], "rdrand di");
+ test_display(&[0x66, 0x0f, 0xc7, 0x37], "vmclear [edi]");
+
+ // this is actually vmx
+ // test_invalid(&[0x66, 0x0f, 0xc7, 0x03]);
+ test_display(&[0x66, 0x0f, 0xc7, 0x33], "vmclear [ebx]");
+ test_display(&[0xf3, 0x0f, 0xc7, 0x33], "vmxon [ebx]");
+}
+
+#[test]
+fn test_rdpid() {
+ test_display(&[0xf3, 0x0f, 0xc7, 0xfd], "rdpid ebp");
+}
+
+#[test]
+fn test_cmpxchg8b() {
+ test_display(&[0x0f, 0xc7, 0x0f], "cmpxchg8b [edi]");
+}
+
+#[test]
+fn test_x87() {
+// test_display(&[0xd8, 0x03], "fadd st, dword ptr [ebx]");
+ test_display(&[0xd8, 0x03], "fadd st(0), [ebx]");
+// test_display(&[0xd8, 0x0b], "fmul st, dword ptr [ebx]");
+ test_display(&[0xd8, 0x0b], "fmul st(0), [ebx]");
+// test_display(&[0xd8, 0x13], "fcom st, dword ptr [ebx]");
+ test_display(&[0xd8, 0x13], "fcom st(0), [ebx]");
+// test_display(&[0xd8, 0x1b], "fcomp st, dword ptr [ebx]");
+ test_display(&[0xd8, 0x1b], "fcomp st(0), [ebx]");
+// test_display(&[0xd8, 0x23], "fsub st, dword ptr [ebx]");
+ test_display(&[0xd8, 0x23], "fsub st(0), [ebx]");
+// test_display(&[0xd8, 0x2b], "fsubr st, dword ptr [ebx]");
+ test_display(&[0xd8, 0x2b], "fsubr st(0), [ebx]");
+// test_display(&[0xd8, 0x33], "fdiv st, dword ptr [ebx]");
+ test_display(&[0xd8, 0x33], "fdiv st(0), [ebx]");
+// test_display(&[0xd8, 0x3b], "fdivr st, dword ptr [ebx]");
+ test_display(&[0xd8, 0x3b], "fdivr st(0), [ebx]");
+// test_display(&[0xd8, 0xc3], "fadd st, st(3)");
+ test_display(&[0xd8, 0xc3], "fadd st(0), st(3)");
+// test_display(&[0xd8, 0xcb], "fmul st, st(3)");
+ test_display(&[0xd8, 0xcb], "fmul st(0), st(3)");
+// test_display(&[0xd8, 0xd3], "fcom st, st(3)");
+ test_display(&[0xd8, 0xd3], "fcom st(0), st(3)");
+// test_display(&[0xd8, 0xdb], "fcomp st, st(3)");
+ test_display(&[0xd8, 0xdb], "fcomp st(0), st(3)");
+// test_display(&[0xd8, 0xe3], "fsub st, st(3)");
+ test_display(&[0xd8, 0xe3], "fsub st(0), st(3)");
+// test_display(&[0xd8, 0xeb], "fsubr st, st(3)");
+ test_display(&[0xd8, 0xeb], "fsubr st(0), st(3)");
+// test_display(&[0xd8, 0xf3], "fdiv st, st(3)");
+ test_display(&[0xd8, 0xf3], "fdiv st(0), st(3)");
+// test_display(&[0xd8, 0xfb], "fdivr st, st(3)");
+ test_display(&[0xd8, 0xfb], "fdivr st(0), st(3)");
+// test_display(&[0xd9, 0x03], "fld st, dword ptr [ebx]");
+ test_display(&[0xd9, 0x03], "fld st(0), [ebx]");
+ test_invalid(&[0xd9, 0x08]);
+ test_invalid(&[0xd9, 0x09]);
+ test_invalid(&[0xd9, 0x0a]);
+ test_invalid(&[0xd9, 0x0b]);
+ test_invalid(&[0xd9, 0x0c]);
+ test_invalid(&[0xd9, 0x0d]);
+ test_invalid(&[0xd9, 0x0e]);
+ test_invalid(&[0xd9, 0x0f]);
+// test_display(&[0xd9, 0x13], "fst dword ptr [ebx], st");
+ test_display(&[0xd9, 0x13], "fst [ebx], st(0)");
+// test_display(&[0xd9, 0x1b], "fstp dword ptr [ebx], st");
+ test_display(&[0xd9, 0x1b], "fstp [ebx], st(0)");
+// test_display(&[0xd9, 0x23], "fldenv ptr [ebx]");
+ test_display(&[0xd9, 0x23], "fldenv [ebx]");
+// test_display(&[0xd9, 0x2b], "fldcw word ptr [ebx]");
+ test_display(&[0xd9, 0x2b], "fldcw [ebx]");
+// test_display(&[0xd9, 0x33], "fnstenv ptr [ebx]");
+ test_display(&[0xd9, 0x33], "fnstenv [ebx]");
+// test_display(&[0xd9, 0x3b], "fnstcw word ptr [ebx]");
+ test_display(&[0xd9, 0x3b], "fnstcw [ebx]");
+// test_display(&[0xd9, 0xc3], "fld st, st(3)");
+ test_display(&[0xd9, 0xc3], "fld st(0), st(3)");
+// test_display(&[0xd9, 0xcb], "fxch st, st(3)");
+ test_display(&[0xd9, 0xcb], "fxch st(0), st(3)");
+ test_display(&[0xd9, 0xd0], "fnop");
+ test_invalid(&[0xd9, 0xd1]);
+ test_invalid(&[0xd9, 0xd2]);
+ test_invalid(&[0xd9, 0xd3]);
+ test_invalid(&[0xd9, 0xd4]);
+ test_invalid(&[0xd9, 0xd5]);
+ test_invalid(&[0xd9, 0xd6]);
+ test_invalid(&[0xd9, 0xd7]);
+ // undocumented save for intel xed
+// test_display(&[0xd9, 0xdb], "fstpnce st(3), st");
+ test_display(&[0xd9, 0xdb], "fstpnce st(3), st(0)");
+ test_display(&[0xd9, 0xe0], "fchs");
+ test_display(&[0xd9, 0xe1], "fabs");
+ test_invalid(&[0xd9, 0xe2]);
+ test_invalid(&[0xd9, 0xe3]);
+ test_display(&[0xd9, 0xe4], "ftst");
+ test_display(&[0xd9, 0xe5], "fxam");
+ test_invalid(&[0xd9, 0xe6]);
+ test_invalid(&[0xd9, 0xe7]);
+ test_display(&[0xd9, 0xe8], "fld1");
+ test_display(&[0xd9, 0xe9], "fldl2t");
+ test_display(&[0xd9, 0xea], "fldl2e");
+ test_display(&[0xd9, 0xeb], "fldpi");
+ test_display(&[0xd9, 0xec], "fldlg2");
+ test_display(&[0xd9, 0xed], "fldln2");
+ test_display(&[0xd9, 0xee], "fldz");
+ test_invalid(&[0xd9, 0xef]);
+ test_display(&[0xd9, 0xf0], "f2xm1");
+ test_display(&[0xd9, 0xf1], "fyl2x");
+ test_display(&[0xd9, 0xf2], "fptan");
+ test_display(&[0xd9, 0xf3], "fpatan");
+ test_display(&[0xd9, 0xf4], "fxtract");
+ test_display(&[0xd9, 0xf5], "fprem1");
+ test_display(&[0xd9, 0xf6], "fdecstp");
+ test_display(&[0xd9, 0xf7], "fincstp");
+ test_display(&[0xd9, 0xf8], "fprem");
+ test_display(&[0xd9, 0xf9], "fyl2xp1");
+ test_display(&[0xd9, 0xfa], "fsqrt");
+ test_display(&[0xd9, 0xfb], "fsincos");
+ test_display(&[0xd9, 0xfc], "frndint");
+ test_display(&[0xd9, 0xfd], "fscale");
+ test_display(&[0xd9, 0xfe], "fsin");
+ test_display(&[0xd9, 0xff], "fcos");
+// test_display(&[0xda, 0x03], "fiadd st, dword ptr [ebx]");
+ test_display(&[0xda, 0x03], "fiadd st(0), [ebx]");
+// test_display(&[0xda, 0x0b], "fimul st, dword ptr [ebx]");
+ test_display(&[0xda, 0x0b], "fimul st(0), [ebx]");
+// test_display(&[0xda, 0x13], "ficom st, dword ptr [ebx]");
+ test_display(&[0xda, 0x13], "ficom st(0), [ebx]");
+// test_display(&[0xda, 0x1b], "ficomp st, dword ptr [ebx]");
+ test_display(&[0xda, 0x1b], "ficomp st(0), [ebx]");
+// test_display(&[0xda, 0x23], "fisub st, dword ptr [ebx]");
+ test_display(&[0xda, 0x23], "fisub st(0), [ebx]");
+// test_display(&[0xda, 0x2b], "fisubr st, dword ptr [ebx]");
+ test_display(&[0xda, 0x2b], "fisubr st(0), [ebx]");
+// test_display(&[0xda, 0x33], "fidiv st, dword ptr [ebx]");
+ test_display(&[0xda, 0x33], "fidiv st(0), [ebx]");
+// test_display(&[0xda, 0x3b], "fidivr st, dword ptr [ebx]");
+ test_display(&[0xda, 0x3b], "fidivr st(0), [ebx]");
+// test_display(&[0xda, 0xc3], "fcmovb st, st(3)");
+ test_display(&[0xda, 0xc3], "fcmovb st(0), st(3)");
+// test_display(&[0xda, 0xcb], "fcmove st, st(3)");
+ test_display(&[0xda, 0xcb], "fcmove st(0), st(3)");
+// test_display(&[0xda, 0xd3], "fcmovbe st, st(3)");
+ test_display(&[0xda, 0xd3], "fcmovbe st(0), st(3)");
+// test_display(&[0xda, 0xdb], "fcmovu st, st(3)");
+ test_display(&[0xda, 0xdb], "fcmovu st(0), st(3)");
+ test_invalid(&[0xda, 0xe0]);
+ test_invalid(&[0xda, 0xe1]);
+ test_invalid(&[0xda, 0xe2]);
+ test_invalid(&[0xda, 0xe3]);
+ test_invalid(&[0xda, 0xe4]);
+ test_invalid(&[0xda, 0xe5]);
+ test_invalid(&[0xda, 0xe6]);
+ test_invalid(&[0xda, 0xe7]);
+ test_invalid(&[0xda, 0xe8]);
+ test_display(&[0xda, 0xe9], "fucompp");
+ test_invalid(&[0xda, 0xea]);
+ test_invalid(&[0xda, 0xeb]);
+ test_invalid(&[0xda, 0xec]);
+ test_invalid(&[0xda, 0xed]);
+ test_invalid(&[0xda, 0xee]);
+ test_invalid(&[0xda, 0xef]);
+ test_invalid(&[0xda, 0xf0]);
+ test_invalid(&[0xda, 0xf1]);
+ test_invalid(&[0xda, 0xf2]);
+ test_invalid(&[0xda, 0xf3]);
+ test_invalid(&[0xda, 0xf4]);
+ test_invalid(&[0xda, 0xf5]);
+ test_invalid(&[0xda, 0xf6]);
+ test_invalid(&[0xda, 0xf7]);
+ test_invalid(&[0xda, 0xf8]);
+ test_invalid(&[0xda, 0xf9]);
+ test_invalid(&[0xda, 0xfa]);
+ test_invalid(&[0xda, 0xfb]);
+ test_invalid(&[0xda, 0xfc]);
+ test_invalid(&[0xda, 0xfd]);
+ test_invalid(&[0xda, 0xfe]);
+ test_invalid(&[0xda, 0xff]);
+// test_display(&[0xdb, 0x03], "fild st, dword ptr [ebx]");
+ test_display(&[0xdb, 0x03], "fild st(0), [ebx]");
+// test_display(&[0xdb, 0x0b], "fisttp dword ptr [ebx], st");
+ test_display(&[0xdb, 0x0b], "fisttp [ebx], st(0)");
+// test_display(&[0xdb, 0x13], "fist dword ptr [ebx], st");
+ test_display(&[0xdb, 0x13], "fist [ebx], st(0)");
+// test_display(&[0xdb, 0x1b], "fistp dword ptr [ebx], st");
+ test_display(&[0xdb, 0x1b], "fistp [ebx], st(0)");
+ test_invalid(&[0xdb, 0x20]);
+ test_invalid(&[0xdb, 0x21]);
+ test_invalid(&[0xdb, 0x22]);
+ test_invalid(&[0xdb, 0x23]);
+ test_invalid(&[0xdb, 0x24]);
+ test_invalid(&[0xdb, 0x25]);
+ test_invalid(&[0xdb, 0x26]);
+ test_invalid(&[0xdb, 0x27]);
+// test_display(&[0xdb, 0x2b], "fld st, ptr [ebx]");
+ test_display(&[0xdb, 0x2b], "fld st(0), [ebx]");
+ test_invalid(&[0xdb, 0x30]);
+ test_invalid(&[0xdb, 0x31]);
+ test_invalid(&[0xdb, 0x32]);
+ test_invalid(&[0xdb, 0x33]);
+ test_invalid(&[0xdb, 0x34]);
+ test_invalid(&[0xdb, 0x35]);
+ test_invalid(&[0xdb, 0x36]);
+ test_invalid(&[0xdb, 0x37]);
+// test_display(&[0xdb, 0x3b], "fstp ptr [ebx], st");
+ test_display(&[0xdb, 0x3b], "fstp [ebx], st(0)");
+// test_display(&[0xdb, 0xc3], "fcmovnb st, st(3)");
+ test_display(&[0xdb, 0xc3], "fcmovnb st(0), st(3)");
+// test_display(&[0xdb, 0xcb], "fcmovne st, st(3)");
+ test_display(&[0xdb, 0xcb], "fcmovne st(0), st(3)");
+// test_display(&[0xdb, 0xd3], "fcmovnbe st, st(3)");
+ test_display(&[0xdb, 0xd3], "fcmovnbe st(0), st(3)");
+// test_display(&[0xdb, 0xdb], "fcmovnu st, st(3)");
+ test_display(&[0xdb, 0xdb], "fcmovnu st(0), st(3)");
+ test_display(&[0xdb, 0xe0], "feni8087_nop");
+ test_display(&[0xdb, 0xe1], "fdisi8087_nop");
+ test_display(&[0xdb, 0xe2], "fnclex");
+ test_display(&[0xdb, 0xe3], "fninit");
+ test_display(&[0xdb, 0xe4], "fsetpm287_nop");
+ test_invalid(&[0xdb, 0xe5]);
+ test_invalid(&[0xdb, 0xe6]);
+ test_invalid(&[0xdb, 0xe7]);
+// test_display(&[0xdb, 0xeb], "fucomi st, st(3)");
+ test_display(&[0xdb, 0xeb], "fucomi st(0), st(3)");
+// test_display(&[0xdb, 0xf3], "fcomi st, st(3)");
+ test_display(&[0xdb, 0xf3], "fcomi st(0), st(3)");
+ test_invalid(&[0xdb, 0xf8]);
+ test_invalid(&[0xdb, 0xf9]);
+ test_invalid(&[0xdb, 0xfa]);
+ test_invalid(&[0xdb, 0xfb]);
+ test_invalid(&[0xdb, 0xfc]);
+ test_invalid(&[0xdb, 0xfd]);
+ test_invalid(&[0xdb, 0xfe]);
+ test_invalid(&[0xdb, 0xff]);
+// test_display(&[0xdc, 0x03], "fadd st, qword ptr [ebx]");
+ test_display(&[0xdc, 0x03], "fadd st(0), [ebx]");
+// test_display(&[0xdc, 0x0b], "fmul st, qword ptr [ebx]");
+ test_display(&[0xdc, 0x0b], "fmul st(0), [ebx]");
+// test_display(&[0xdc, 0x13], "fcom st, qword ptr [ebx]");
+ test_display(&[0xdc, 0x13], "fcom st(0), [ebx]");
+// test_display(&[0xdc, 0x1b], "fcomp st, qword ptr [ebx]");
+ test_display(&[0xdc, 0x1b], "fcomp st(0), [ebx]");
+// test_display(&[0xdc, 0x23], "fsub st, qword ptr [ebx]");
+ test_display(&[0xdc, 0x23], "fsub st(0), [ebx]");
+// test_display(&[0xdc, 0x2b], "fsubr st, qword ptr [ebx]");
+ test_display(&[0xdc, 0x2b], "fsubr st(0), [ebx]");
+// test_display(&[0xdc, 0x33], "fdiv st, qword ptr [ebx]");
+ test_display(&[0xdc, 0x33], "fdiv st(0), [ebx]");
+// test_display(&[0xdc, 0x3b], "fdivr st, qword ptr [ebx]");
+ test_display(&[0xdc, 0x3b], "fdivr st(0), [ebx]");
+// test_display(&[0xdc, 0xc3], "fadd st(3), st");
+ test_display(&[0xdc, 0xc3], "fadd st(3), st(0)");
+// test_display(&[0xdc, 0xcb], "fmul st(3), st");
+ test_display(&[0xdc, 0xcb], "fmul st(3), st(0)");
+// test_display(&[0xdc, 0xd3], "fcom st, st(3)");
+ test_display(&[0xdc, 0xd3], "fcom st(0), st(3)");
+// test_display(&[0xdc, 0xdb], "fcomp st, st(3)");
+ test_display(&[0xdc, 0xdb], "fcomp st(0), st(3)");
+// test_display(&[0xdc, 0xe3], "fsubr st(3), st");
+ test_display(&[0xdc, 0xe3], "fsubr st(3), st(0)");
+// test_display(&[0xdc, 0xeb], "fsub st(3), st");
+ test_display(&[0xdc, 0xeb], "fsub st(3), st(0)");
+// test_display(&[0xdc, 0xf3], "fdivr st(3), st");
+ test_display(&[0xdc, 0xf3], "fdivr st(3), st(0)");
+// test_display(&[0xdc, 0xfb], "fdiv st(3), st");
+ test_display(&[0xdc, 0xfb], "fdiv st(3), st(0)");
+// test_display(&[0xdd, 0x03], "fld st, qword ptr [ebx]");
+ test_display(&[0xdd, 0x03], "fld st(0), [ebx]");
+// test_display(&[0xdd, 0x0b], "fisttp qword ptr [ebx], st");
+ test_display(&[0xdd, 0x0b], "fisttp [ebx], st(0)");
+// test_display(&[0xdd, 0x13], "fst qword ptr [ebx], st");
+ test_display(&[0xdd, 0x13], "fst [ebx], st(0)");
+// test_display(&[0xdd, 0x1b], "fstp qword ptr [ebx], st");
+ test_display(&[0xdd, 0x1b], "fstp [ebx], st(0)");
+// test_display(&[0xdd, 0x23], "frstor ptr [ebx]");
+ test_display(&[0xdd, 0x23], "frstor [ebx]");
+ test_invalid(&[0xdd, 0x28]);
+ test_invalid(&[0xdd, 0x29]);
+ test_invalid(&[0xdd, 0x2a]);
+ test_invalid(&[0xdd, 0x2b]);
+ test_invalid(&[0xdd, 0x2c]);
+ test_invalid(&[0xdd, 0x2d]);
+ test_invalid(&[0xdd, 0x2e]);
+ test_invalid(&[0xdd, 0x2f]);
+// test_display(&[0xdd, 0x33], "fnsave ptr [ebx]");
+ test_display(&[0xdd, 0x33], "fnsave [ebx]");
+// test_display(&[0xdd, 0x3b], "fnstsw word ptr [ebx]");
+ test_display(&[0xdd, 0x3b], "fnstsw [ebx]");
+ test_display(&[0xdd, 0xc3], "ffree st(3)");
+// test_display(&[0xdd, 0xcb], "fxch st, st(3)");
+ test_display(&[0xdd, 0xcb], "fxch st(0), st(3)");
+// test_display(&[0xdd, 0xd3], "fst st(3), st");
+ test_display(&[0xdd, 0xd3], "fst st(3), st(0)");
+// test_display(&[0xdd, 0xdb], "fstp st(3), st");
+ test_display(&[0xdd, 0xdb], "fstp st(3), st(0)");
+// test_display(&[0xdd, 0xe3], "fucom st, st(3)");
+ test_display(&[0xdd, 0xe3], "fucom st(0), st(3)");
+// test_display(&[0xdd, 0xeb], "fucomp st, st(3)");
+ test_display(&[0xdd, 0xeb], "fucomp st(0), st(3)");
+ test_invalid(&[0xdd, 0xf0]);
+ test_invalid(&[0xdd, 0xf1]);
+ test_invalid(&[0xdd, 0xf2]);
+ test_invalid(&[0xdd, 0xf3]);
+ test_invalid(&[0xdd, 0xf4]);
+ test_invalid(&[0xdd, 0xf5]);
+ test_invalid(&[0xdd, 0xf6]);
+ test_invalid(&[0xdd, 0xf7]);
+ test_invalid(&[0xdd, 0xf8]);
+ test_invalid(&[0xdd, 0xf9]);
+ test_invalid(&[0xdd, 0xfa]);
+ test_invalid(&[0xdd, 0xfb]);
+ test_invalid(&[0xdd, 0xfc]);
+ test_invalid(&[0xdd, 0xfd]);
+ test_invalid(&[0xdd, 0xfe]);
+ test_invalid(&[0xdd, 0xff]);
+// test_display(&[0xde, 0x03], "fiadd st, word ptr [ebx]");
+ test_display(&[0xde, 0x03], "fiadd st(0), [ebx]");
+// test_display(&[0xde, 0x0b], "fimul st, word ptr [ebx]");
+ test_display(&[0xde, 0x0b], "fimul st(0), [ebx]");
+// test_display(&[0xde, 0x13], "ficom st, word ptr [ebx]");
+ test_display(&[0xde, 0x13], "ficom st(0), [ebx]");
+// test_display(&[0xde, 0x1b], "ficomp st, word ptr [ebx]");
+ test_display(&[0xde, 0x1b], "ficomp st(0), [ebx]");
+// test_display(&[0xde, 0x23], "fisub st, word ptr [ebx]");
+ test_display(&[0xde, 0x23], "fisub st(0), [ebx]");
+// test_display(&[0xde, 0x2b], "fisubr st, word ptr [ebx]");
+ test_display(&[0xde, 0x2b], "fisubr st(0), [ebx]");
+// test_display(&[0xde, 0x33], "fidiv st, word ptr [ebx]");
+ test_display(&[0xde, 0x33], "fidiv st(0), [ebx]");
+// test_display(&[0xde, 0x3b], "fidivr st, word ptr [ebx]");
+ test_display(&[0xde, 0x3b], "fidivr st(0), [ebx]");
+// test_display(&[0xde, 0xc3], "faddp st(3), st");
+ test_display(&[0xde, 0xc3], "faddp st(3), st(0)");
+// test_display(&[0xde, 0xcb], "fmulp st(3), st");
+ test_display(&[0xde, 0xcb], "fmulp st(3), st(0)");
+// test_display(&[0xde, 0xd3], "fcomp st, st(3)");
+ test_display(&[0xde, 0xd3], "fcomp st(0), st(3)");
+ test_invalid(&[0xde, 0xd8]);
+ test_display(&[0xde, 0xd9], "fcompp");
+ test_invalid(&[0xde, 0xda]);
+ test_invalid(&[0xde, 0xdb]);
+ test_invalid(&[0xde, 0xdc]);
+ test_invalid(&[0xde, 0xdd]);
+ test_invalid(&[0xde, 0xde]);
+ test_invalid(&[0xde, 0xdf]);
+// test_display(&[0xde, 0xe3], "fsubrp st(3), st");
+ test_display(&[0xde, 0xe3], "fsubrp st(3), st(0)");
+// test_display(&[0xde, 0xeb], "fsubp st(3), st");
+ test_display(&[0xde, 0xeb], "fsubp st(3), st(0)");
+// test_display(&[0xde, 0xf3], "fdivrp st(3), st");
+ test_display(&[0xde, 0xf3], "fdivrp st(3), st(0)");
+// test_display(&[0xde, 0xfb], "fdivp st(3), st");
+ test_display(&[0xde, 0xfb], "fdivp st(3), st(0)");
+// test_display(&[0xdf, 0x03], "fild st, word ptr [ebx]");
+ test_display(&[0xdf, 0x03], "fild st(0), [ebx]");
+// test_display(&[0xdf, 0x0b], "fisttp word ptr [ebx], st");
+ test_display(&[0xdf, 0x0b], "fisttp [ebx], st(0)");
+// test_display(&[0xdf, 0x13], "fist word ptr [ebx], st");
+ test_display(&[0xdf, 0x13], "fist [ebx], st(0)");
+// test_display(&[0xdf, 0x1b], "fistp word ptr [ebx], st");
+ test_display(&[0xdf, 0x1b], "fistp [ebx], st(0)");
+// test_display(&[0xdf, 0x23], "fbld st, ptr [ebx]");
+ test_display(&[0xdf, 0x23], "fbld st(0), [ebx]");
+// test_display(&[0xdf, 0x2b], "fild st, qword ptr [ebx]");
+ test_display(&[0xdf, 0x2b], "fild st(0), [ebx]");
+// test_display(&[0xdf, 0x33], "fbstp ptr [ebx], st");
+ test_display(&[0xdf, 0x33], "fbstp [ebx], st(0)");
+// test_display(&[0xdf, 0x3b], "fistp qword ptr [ebx], st");
+ test_display(&[0xdf, 0x3b], "fistp [ebx], st(0)");
+// test_display(&[0xdf, 0xc3], "ffreep st(3)");
+ test_display(&[0xdf, 0xc3], "ffreep st(3)");
+// test_display(&[0xdf, 0xcb], "fxch st, st(3)");
+ test_display(&[0xdf, 0xcb], "fxch st(0), st(3)");
+// test_display(&[0xdf, 0xd3], "fstp st(3), st");
+ test_display(&[0xdf, 0xd3], "fstp st(3), st(0)");
+// test_display(&[0xdf, 0xdb], "fstp st(3), st");
+ test_display(&[0xdf, 0xdb], "fstp st(3), st(0)");
+ test_display(&[0xdf, 0xe0], "fnstsw ax");
+ test_invalid(&[0xdf, 0xe1]);
+ test_invalid(&[0xdf, 0xe2]);
+ test_invalid(&[0xdf, 0xe3]);
+ test_invalid(&[0xdf, 0xe4]);
+ test_invalid(&[0xdf, 0xe5]);
+ test_invalid(&[0xdf, 0xe6]);
+ test_invalid(&[0xdf, 0xe7]);
+// test_display(&[0xdf, 0xeb], "fucomip st, st(3)");
+ test_display(&[0xdf, 0xeb], "fucomip st(0), st(3)");
+// test_display(&[0xdf, 0xf3], "fcomip st, st(3)");
+ test_display(&[0xdf, 0xf3], "fcomip st(0), st(3)");
+ test_invalid(&[0xdf, 0xf8]);
+ test_invalid(&[0xdf, 0xf9]);
+ test_invalid(&[0xdf, 0xfa]);
+ test_invalid(&[0xdf, 0xfb]);
+ test_invalid(&[0xdf, 0xfc]);
+ test_invalid(&[0xdf, 0xfd]);
+ test_invalid(&[0xdf, 0xfe]);
+ test_invalid(&[0xdf, 0xff]);
+}