diff options
| author | iximeow <me@iximeow.net> | 2021-03-21 02:48:11 -0700 | 
|---|---|---|
| committer | iximeow <me@iximeow.net> | 2021-03-21 02:48:11 -0700 | 
| commit | 5223427b217cc567deb55ea420b8da58aea64d68 (patch) | |
| tree | 4b8256c45706e3ea94dd7234616a69e79ae45bff /test/long_mode | |
| parent | 0a3811ec18d2154f050aaf6e611a3d65f467c0cc (diff) | |
complete CET support, add UINTR, add missing VORP{S,D}, other cleanup
Diffstat (limited to 'test/long_mode')
| -rw-r--r-- | test/long_mode/display.rs | 2 | ||||
| -rw-r--r-- | test/long_mode/mod.rs | 30 | 
2 files changed, 27 insertions, 5 deletions
diff --git a/test/long_mode/display.rs b/test/long_mode/display.rs index 7017270..2d1a540 100644 --- a/test/long_mode/display.rs +++ b/test/long_mode/display.rs @@ -1,7 +1,7 @@  use std::fmt::Write;  use yaxpeax_arch::{AddressBase, Decoder, LengthedInstruction}; -use yaxpeax_x86::long_mode::{DisplayStyle, InstDecoder, Opcode}; +use yaxpeax_x86::long_mode::{DisplayStyle, InstDecoder};  fn test_display(data: &[u8], expected: &'static str) {      test_display_under(&InstDecoder::default(), data, expected); diff --git a/test/long_mode/mod.rs b/test/long_mode/mod.rs index 130a7ab..fff10a2 100644 --- a/test/long_mode/mod.rs +++ b/test/long_mode/mod.rs @@ -5,7 +5,7 @@ mod display;  use std::fmt::Write;  use yaxpeax_arch::{AddressBase, Decoder, LengthedInstruction}; -use yaxpeax_x86::long_mode::{InstDecoder, Opcode}; +use yaxpeax_x86::long_mode::InstDecoder;  fn test_invalid(data: &[u8]) {      test_invalid_under(&InstDecoder::default(), data); @@ -904,10 +904,10 @@ fn test_0f01() {      test_invalid(&[0x0f, 0x01, 0xe9]);      test_invalid(&[0x0f, 0x01, 0xea]);      test_invalid(&[0x0f, 0x01, 0xeb]); -    test_invalid(&[0x0f, 0x01, 0xec]); -    test_invalid(&[0x0f, 0x01, 0xed]);      test_display(&[0x0f, 0x01, 0xee], "rdpkru");      test_display(&[0x0f, 0x01, 0xef], "wrpkru"); +    test_invalid(&[0xf2, 0x0f, 0x01, 0xee]); +    test_invalid(&[0xf2, 0x0f, 0x01, 0xef]);      test_display(&[0x4f, 0x0f, 0x01, 0xf0], "lmsw r8w");      test_display(&[0x0f, 0x01, 0xf0], "lmsw ax");      test_display(&[0x0f, 0x01, 0xf1], "lmsw cx"); @@ -1548,6 +1548,8 @@ fn test_vex() {      test_instr(&[0xc5, 0xe1, 0x54, 0x03], "vandps xmm0, xmm3, [rbx]");      test_instr(&[0xc5, 0xe0, 0x55, 0x03], "vandnpd xmm0, xmm3, [rbx]");      test_instr(&[0xc5, 0xe1, 0x55, 0x03], "vandnps xmm0, xmm3, [rbx]"); +    test_instr(&[0xc5, 0xe0, 0x56, 0x03], "vorpd xmm0, xmm3, [rbx]"); +    test_instr(&[0xc5, 0xe1, 0x56, 0x03], "vorps xmm0, xmm3, [rbx]");  }  #[test] @@ -1801,7 +1803,6 @@ fn test_sha() {  fn test_vmx() {      test_display(&[0x0f, 0xc7, 0x3f], "vmptrst [rdi]");      test_display(&[0x0f, 0xc7, 0x37], "vmptrld [rdi]"); -    test_display(&[0xf3, 0x0f, 0xc7, 0xf7], "rdrand edi");      test_display(&[0xf3, 0x0f, 0xc7, 0x37], "vmxon [rdi]");      test_display(&[0x66, 0x0f, 0xc7, 0xf7], "rdrand di");      test_display(&[0x66, 0x0f, 0xc7, 0x37], "vmclear [rdi]"); @@ -2274,10 +2275,17 @@ fn test_cet() {      // clrssbsy f3 0f ae /6      // endbr64 f3 0f ae fa      // endbr32 f3 0f ae fb +    test_display(&[0xf3, 0x4f, 0x0f, 0xae, 0xe9], "incssp r9"); +    test_display(&[0xf3, 0x0f, 0xae, 0xe9], "incssp ecx");      test_display(&[0x3e, 0x4f, 0x0f, 0x38, 0xf6, 0x23], "wrss [r11], r12");      test_display(&[0x66, 0x0f, 0x38, 0xf5, 0x47, 0xe9], "wruss [rdi - 0x17], eax");      test_invalid(&[0x0f, 0x38, 0xf5, 0x47, 0xe9]);      test_invalid(&[0x66, 0x3e, 0x65, 0x3e, 0x0f, 0x38, 0xf5, 0xf0]); +    test_display(&[0xf3, 0x0f, 0x01, 0xe8], "setssbsy"); +    test_display(&[0xf3, 0x0f, 0x01, 0xea], "saveprevssp"); +    test_display(&[0xf3, 0x0f, 0x01, 0x29], "rstorssp [rcx]"); +    test_display(&[0xf3, 0x66, 0x0f, 0x01, 0x29], "rstorssp [rcx]"); +    test_display(&[0xf3, 0x0f, 0xae, 0x30], "clrssbsy [rax]");  }  #[test] @@ -2329,6 +2337,20 @@ fn test_key_locker() {      test_display(&[0xf3, 0x0f, 0x38, 0xfb, 0xde], "encodekey256 ebx, esi");  } +// these uinter test cases come from llvm: +// https://reviews.llvm.org/differential/changeset/?ref=2226860 +#[test] +fn test_uintr() { +    test_display(&[0xf3, 0x0f, 0x01, 0xec], "uiret"); +    test_display(&[0xf3, 0x0f, 0x01, 0xed], "testui"); +    test_display(&[0xf3, 0x0f, 0x01, 0xee], "clui"); +    test_display(&[0xf3, 0x0f, 0x01, 0xef], "stui"); +    test_display(&[0xf3, 0x0f, 0xc7, 0xf0], "senduipi rax"); +    test_display(&[0xf3, 0x0f, 0xc7, 0xf2], "senduipi rdx"); +    test_display(&[0xf3, 0x41, 0x0f, 0xc7, 0xf0], "senduipi r8"); +    test_display(&[0xf3, 0x41, 0x0f, 0xc7, 0xf5], "senduipi r13"); +} +  // started shipping in sapphire rapids  #[test]  fn test_enqcmd() {  | 
