diff options
| author | iximeow <me@iximeow.net> | 2026-04-19 16:34:46 +0000 |
|---|---|---|
| committer | iximeow <me@iximeow.net> | 2026-04-19 16:34:46 +0000 |
| commit | 3bcd17033a96852e7bb40c211d8c42e529d6780b (patch) | |
| tree | bff116394dfddf8803e801e282d8f3c260dc6e91 /test/long_mode | |
| parent | d4999e6bb0cb4ea4d8530b1c3ece1143c6bf9740 (diff) | |
a few more straggler instructions
Diffstat (limited to 'test/long_mode')
| -rw-r--r-- | test/long_mode/behavior.rs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/long_mode/behavior.rs b/test/long_mode/behavior.rs index dd3d270..dc10b03 100644 --- a/test/long_mode/behavior.rs +++ b/test/long_mode/behavior.rs @@ -1520,6 +1520,52 @@ mod kvm { } } + // use the generic test harness for a handful of instructions that don't get covered in the + // general enumeration above + #[test] + fn behavior_verify_kvm_misc() { + use yaxpeax_arch::{Decoder, U8Reader}; + use yaxpeax_x86::long_mode::{Instruction, Opcode}; + + let mut vm = create_test_vm(); + vm.set_single_step(true).expect("can enable single-step"); + + // TODO: happen to be testing on a zen 5 system, so i picked a zen 5 decoder. + let decoder = long_mode::uarch::amd::zen5(); + let mut buf = Instruction::default(); + let initial_regs = vm.get_regs().unwrap(); + + static MISC_INSTS: &'static [&'static [u8]] = &[ + // cmppd xmm0, xmmword [rcx], 0x75 + &[0x66, 0x0f, 0xc2, 0x01, 0x75], + // cmpps xmm0, xmmword [rcx], 0x75 + &[0x0f, 0xc2, 0x01, 0x75], + // shufpd xmm0, xmmword [rcx], 0x75 + &[0x66, 0x0f, 0xc6, 0x01, 0x75], + // shufps xmm0, xmmword [rcx], 0x75 + &[0x0f, 0xc6, 0x01, 0x75], + // lzcnt eax, dword [rcx] + &[0xf3, 0x0f, 0xbd, 0x01], + // adcx eax, dword [rcx] + &[0x66, 0x0f, 0x38, 0xf6, 0x01], + // adox eax, dword [rcx] + &[0xf3, 0x0f, 0x38, 0xf6, 0x01], + ]; + for bytes in MISC_INSTS.iter() { + let mut reader = U8Reader::new(&bytes); + if decoder.decode_into(&mut buf, &mut reader).is_ok() { + eprint!("checking behavior of {:02x}", bytes[0]); + for b in &bytes[1..] { + eprint!(" {:02x}", b); + } + eprint!("\n"); + + vm.set_regs(&initial_regs).unwrap(); + check_behavior(&mut vm, bytes).expect("behavior check is ok"); + } + } + } + use yaxpeax_x86::long_mode::Opcode; use yaxpeax_x86::long_mode::Operand; fn not_generic(instr: &Instruction) -> bool { |
