aboutsummaryrefslogtreecommitdiff
path: root/test/protected_mode
diff options
context:
space:
mode:
Diffstat (limited to 'test/protected_mode')
-rw-r--r--test/protected_mode/mod.rs64
-rw-r--r--test/protected_mode/operand.rs4
2 files changed, 66 insertions, 2 deletions
diff --git a/test/protected_mode/mod.rs b/test/protected_mode/mod.rs
index ab3cdc8..9fc603d 100644
--- a/test/protected_mode/mod.rs
+++ b/test/protected_mode/mod.rs
@@ -1035,3 +1035,67 @@ fn only_32bit() {
test_display(&[0x67, 0xa1, 0xc0, 0xb0], "mov eax, [0xb0c0]");
test_display(&[0x66, 0x67, 0xa1, 0xc0, 0xb0], "mov ax, [0xb0c0]");
}
+
+#[test]
+fn test_adx() {
+ test_display(&[0x66, 0x0f, 0x38, 0xf6, 0xc1], "adcx eax, ecx");
+ test_display(&[0x66, 0x0f, 0x38, 0xf6, 0x01], "adcx eax, [ecx]");
+ test_display(&[0xf3, 0x0f, 0x38, 0xf6, 0xc1], "adox eax, ecx");
+ test_display(&[0xf3, 0x0f, 0x38, 0xf6, 0x01], "adox eax, [ecx]");
+}
+
+#[test]
+fn test_prefetchw() {
+ test_display(&[0x0f, 0x0d, 0x08], "prefetchw [eax]");
+}
+
+#[test]
+fn test_lzcnt() {
+ test_display(&[0x66, 0xf3, 0x0f, 0xbd, 0xc1], "lzcnt ax, cx");
+ test_display(&[0xf3, 0x0f, 0xbd, 0xc1], "lzcnt eax, ecx");
+}
+
+#[test]
+fn test_svm() {
+ test_display(&[0x0f, 0x01, 0xdf], "invlpga eax, ecx");
+ test_display(&[0x0f, 0x01, 0xde], "skinit eax");
+ test_display(&[0x0f, 0x01, 0xdd], "clgi");
+ test_display(&[0x0f, 0x01, 0xdc], "stgi");
+ test_display(&[0x0f, 0x01, 0xdb], "vmsave eax");
+ test_display(&[0x0f, 0x01, 0xda], "vmload eax");
+ test_display(&[0x0f, 0x01, 0xd9], "vmmcall");
+ test_display(&[0x0f, 0x01, 0xd8], "vmrun eax");
+}
+
+#[test]
+fn test_movbe() {
+ test_display(&[0x0f, 0x38, 0xf0, 0x06], "movbe eax, [esi]");
+}
+
+#[test]
+fn test_tsx() {
+ test_display(&[0xc6, 0xf8, 0x10], "xabort 0x10");
+ test_display(&[0xc7, 0xf8, 0x10, 0x12, 0x34, 0x56, 0x78], "xbegin 0x78563412");
+ test_display(&[0x66, 0xc7, 0xf8, 0x10, 0x12, 0x34], "xbegin 0x3412");
+ test_display(&[0x0f, 0x01, 0xd5], "xend");
+ test_display(&[0x0f, 0x01, 0xd6], "xtest");
+}
+
+#[test]
+fn test_rand() {
+ test_display(&[0x0f, 0xc7, 0xfd], "rdseed ebp");
+ test_display(&[0x66, 0x0f, 0xc7, 0xfd], "rdseed bp");
+ test_display(&[0x0f, 0xc7, 0xf5], "rdrand ebp");
+ test_display(&[0x66, 0x0f, 0xc7, 0xf5], "rdrand bp");
+}
+
+#[test]
+fn test_sha() {
+ test_display(&[0x0f, 0x3a, 0xcc, 0x12, 0x40], "sha1rnds4 xmm2, [edx], 0x40");
+ test_display(&[0x0f, 0x38, 0xc8, 0x12], "sha1nexte xmm2, [edx]");
+ test_display(&[0x0f, 0x38, 0xc9, 0x12], "sha1msg1 xmm2, [edx]");
+ test_display(&[0x0f, 0x38, 0xca, 0x12], "sha1msg2 xmm2, [edx]");
+ test_display(&[0x0f, 0x38, 0xcb, 0x12], "sha256rnds2 xmm2, [edx]");
+ test_display(&[0x0f, 0x38, 0xcc, 0x12], "sha256msg1 xmm2, [edx]");
+ test_display(&[0x0f, 0x38, 0xcd, 0x12], "sha256msg2 xmm2, [edx]");
+}
diff --git a/test/protected_mode/operand.rs b/test/protected_mode/operand.rs
index 08a24be..8fda181 100644
--- a/test/protected_mode/operand.rs
+++ b/test/protected_mode/operand.rs
@@ -1,5 +1,5 @@
use yaxpeax_arch::{Decoder, LengthedInstruction};
-use yaxpeax_x86::long_mode::{DecodeError, InstDecoder, Opcode};
+use yaxpeax_x86::protected_mode::{DecodeError, InstDecoder, Opcode, Operand, RegSpec};
#[test]
fn register_widths() {
@@ -12,5 +12,5 @@ fn register_widths() {
#[test]
fn memory_widths() {
- assert_eq!(Operand::RegDeref(RegSpec::rsp()).width(), 4);
+ assert_eq!(Operand::RegDeref(RegSpec::esp()).width(), 4);
}