From 4265854d41dad2102384d20d27f97a7fec8cfae9 Mon Sep 17 00:00:00 2001 From: garnt Date: Mon, 13 May 2024 10:25:05 -0400 Subject: [PATCH] Added test_arch_systemz_detail(), pr fixes. --- capstone-rs/src/instruction.rs | 2 -- capstone-rs/src/test.rs | 59 ++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/capstone-rs/src/instruction.rs b/capstone-rs/src/instruction.rs index b6856ed..c9a578c 100644 --- a/capstone-rs/src/instruction.rs +++ b/capstone-rs/src/instruction.rs @@ -413,8 +413,6 @@ impl<'a> InsnDetail<'a> { $detail($insn_detail(unsafe { &self.0.__bindgen_anon_1.$arch })) } )* - #[allow(unreachable_patterns)] - _ => panic!("Unsupported detail arch"), } } } diff --git a/capstone-rs/src/test.rs b/capstone-rs/src/test.rs index 9b2d5ab..3569b86 100644 --- a/capstone-rs/src/test.rs +++ b/capstone-rs/src/test.rs @@ -2491,6 +2491,65 @@ fn test_arch_systemz() { ); } +#[test] +fn test_arch_systemz_detail() { + use crate::arch::sysz::SysZOperand::*; + use crate::arch::sysz::SysZReg::*; + use crate::arch::sysz::*; + use capstone_sys::sysz_op_mem; + + test_arch_mode_endian_insns_detail( + &mut Capstone::new() + .sysz() + .mode(sysz::ArchMode::Default) + .build() + .unwrap(), + Arch::SYSZ, + Mode::Default, + None, + &[], + &[ + // br %r7 + DII::new("br", b"\x07\xf7", &[Reg(RegId(SYSZ_REG_7 as RegIdInt))]), + // ear %r7, %a8 + DII::new( + "ear", + b"\xb2\x4f\x00\x78", + &[ + Reg(RegId(SYSZ_REG_7 as RegIdInt)), + Reg(RegId(SYSZ_REG_A8 as RegIdInt)), + ], + ), + // adb %f0, 0 + DII::new( + "adb", + b"\xed\x00\x00\x00\x00\x1a", + &[Reg(RegId(SYSZ_REG_F0 as RegIdInt)), Imm(0)], + ), + // afi %r0, -0x80000000 + DII::new( + "afi", + b"\xc2\x09\x80\x00\x00\x00", + &[Reg(RegId(SYSZ_REG_0 as RegIdInt)), Imm(-0x80000000)], + ), + // a %r0, 0xfff(%r15, %r1) + DII::new( + "a", + b"\x5a\x0f\x1f\xff", + &[ + Reg(RegId(SYSZ_REG_0 as RegIdInt)), + Mem(SysZOpMem(sysz_op_mem { + base: SYSZ_REG_1 as u8, + index: SYSZ_REG_15 as u8, + disp: 0xfff, + length: 0, + })), + ], + ), + ], + ); +} + #[test] fn test_arch_tms320c64x_detail() { use crate::arch::tms320c64x::{