diff options
-rw-r--r-- | src/lib.rs | 177 | ||||
-rw-r--r-- | tests/test.rs | 265 |
2 files changed, 286 insertions, 156 deletions
@@ -1,4 +1,4 @@ -use yaxpeax_arch::{Arch, AddressDiff, Decoder, LengthedInstruction, NoColors, YaxColors}; +use yaxpeax_arch::{Arch, AddressDiff, Decoder, LengthedInstruction}; use yaxpeax_arch::AddressBase; use bitvec::prelude::*; @@ -333,8 +333,6 @@ pub enum Opcode { Tf_nz_or, Tf_z_or_andcm, Tf_nz_or_andcm, - Dep_z_imm, - Dep_imm, Dep_z, Extr, Shrp, @@ -347,11 +345,11 @@ pub enum Opcode { Mix1_l, Psad1, Mux1, - Pshr2_u_var, + Pshr2_u, Pmpyshr2_u, - Pshr2_var, + Pshr2, Pmpyshr2, - Pshl1_var, + Pshl1, Pshr2_u_fixed, Pshr2_fixed, Popcnt, @@ -368,9 +366,9 @@ pub enum Opcode { Pmpy2_l, Pshl2_fixed, Mux2, - Pshr4_u_var, - Pshr4_var, - Pshl4_var, + Pshr4_u, + Pshr4, + Pshl4, Mpy4, Mpyshl4, Pshr4_u_fixed, @@ -381,9 +379,9 @@ pub enum Opcode { Mix4_r, Mix4_l, Pshl4_fixed, - Shr_u_var, - Shr_var, - Shl_var, + Shr_u, + Shr, + Shl, Break_b, Cover, @@ -493,6 +491,9 @@ pub enum Opcode { Xma_l, Xma_hu, Xma_h, + Xmpy_l, + Xmpy_hu, + Xmpy_h, Fselect, Cmp4_eq, @@ -561,7 +562,6 @@ impl fmt::Display for Opcode { Opcode::AddPlusOne => { write!(f, "addplusone") } Opcode::Sub => { write!(f, "sub") } Opcode::SubMinusOne => { write!(f, "subminusone") } - Opcode::Sub => { write!(f, "sub") } Opcode::And => { write!(f, "and") } Opcode::Andcm => { write!(f, "andcm") } Opcode::Or => { write!(f, "or") } @@ -857,8 +857,6 @@ impl fmt::Display for Opcode { Opcode::Tf_nz_or => { write!(f, "tf.nz.or") } Opcode::Tf_z_or_andcm => { write!(f, "tf.z.or.andcm") } Opcode::Tf_nz_or_andcm => { write!(f, "tf.nz.or.andcm") } - Opcode::Dep_z_imm => { write!(f, "dep.z.imm") } - Opcode::Dep_imm => { write!(f, "dep.imm") } Opcode::Dep_z => { write!(f, "dep.z") } Opcode::Extr => { write!(f, "extr") } Opcode::Shrp => { write!(f, "shrp") } @@ -871,11 +869,11 @@ impl fmt::Display for Opcode { Opcode::Mix1_l => { write!(f, "mix1.l") } Opcode::Psad1 => { write!(f, "psad1") } Opcode::Mux1 => { write!(f, "mux1") } - Opcode::Pshr2_u_var => { write!(f, "pshr2.u.var") } + Opcode::Pshr2_u => { write!(f, "pshr2.u") } Opcode::Pmpyshr2_u => { write!(f, "pmpyshr2.u") } - Opcode::Pshr2_var => { write!(f, "pshr2.var") } + Opcode::Pshr2 => { write!(f, "pshr2") } Opcode::Pmpyshr2 => { write!(f, "pmpyshr2") } - Opcode::Pshl1_var => { write!(f, "pshl1.var") } + Opcode::Pshl1 => { write!(f, "pshl1") } Opcode::Pshr2_u_fixed => { write!(f, "pshr2.u.fixed") } Opcode::Pshr2_fixed => { write!(f, "pshr2.fixed") } Opcode::Popcnt => { write!(f, "popcnt") } @@ -892,9 +890,9 @@ impl fmt::Display for Opcode { Opcode::Pmpy2_l => { write!(f, "pmpy2.l") } Opcode::Pshl2_fixed => { write!(f, "pshl2.fixed") } Opcode::Mux2 => { write!(f, "mux2") } - Opcode::Pshr4_u_var => { write!(f, "pshr4.u.var") } - Opcode::Pshr4_var => { write!(f, "pshr4.var") } - Opcode::Pshl4_var => { write!(f, "pshl4.var") } + Opcode::Pshr4_u => { write!(f, "pshr4.u") } + Opcode::Pshr4 => { write!(f, "pshr4") } + Opcode::Pshl4 => { write!(f, "pshl4") } Opcode::Mpy4 => { write!(f, "mpy4") } Opcode::Mpyshl4 => { write!(f, "mpyshl4") } Opcode::Pshr4_u_fixed => { write!(f, "pshr4.u.fixed") } @@ -905,9 +903,9 @@ impl fmt::Display for Opcode { Opcode::Mix4_r => { write!(f, "mix4.r") } Opcode::Mix4_l => { write!(f, "mix4.l") } Opcode::Pshl4_fixed => { write!(f, "pshl4.fixed") } - Opcode::Shr_u_var => { write!(f, "shr.u.var") } - Opcode::Shr_var => { write!(f, "shr.var") } - Opcode::Shl_var => { write!(f, "shl.var") } + Opcode::Shr_u => { write!(f, "shr.u") } + Opcode::Shr => { write!(f, "shr") } + Opcode::Shl => { write!(f, "shl") } Opcode::Break_b => { write!(f, "break.b") } Opcode::Cover => { write!(f, "cover") } @@ -1017,6 +1015,9 @@ impl fmt::Display for Opcode { Opcode::Xma_l => { write!(f, "xma.l") } Opcode::Xma_hu => { write!(f, "xma.hu") } Opcode::Xma_h => { write!(f, "xma.h") } + Opcode::Xmpy_l => { write!(f, "xmpy.l") } + Opcode::Xmpy_hu => { write!(f, "xmpy.hu") } + Opcode::Xmpy_h => { write!(f, "xmpy.h") } Opcode::Fselect => { write!(f, "fselect") } Opcode::Cmp4_eq => { write!(f, "cmp4.eq") }, @@ -1096,18 +1097,33 @@ impl fmt::Display for Instruction { self.operands[4].as_unsigned_imm(), ); } else if let Opcode::Br_cond = self.opcode { - return write!(f, "br{}{}{}{} {}{}", - if self.predicate != 0 { ".cond" } else { "" }, - ["", ".spnt", ".dptk", ".dpnt"][self.operands[2].as_unsigned_imm() as usize], - [".few", ".many"][self.operands[1].as_unsigned_imm() as usize], - ["", ".clr"][self.operands[3].as_unsigned_imm() as usize], - if let Operand::ImmI64(_) = self.operands[0] { - "$+" - } else { - "" - }, - self.operands[0], - ) + if self.predicate == 0 && self.operands[2].as_unsigned_imm() == 0 { + // if `qp == 0` and `bwh == .sptk`, this is an unconditional branch pseudo-op + return write!(f, "br{}{} {}{}", + [".few", ".many"][self.operands[1].as_unsigned_imm() as usize], + ["", ".clr"][self.operands[3].as_unsigned_imm() as usize], + if let Operand::ImmI64(_) = self.operands[0] { + "$+" + } else { + "" + }, + self.operands[0], + ) + } else { + // otherwise show the bwh field + return write!(f, "br{}{}{}{} {}{}", + if self.predicate != 0 { ".cond" } else { "" }, + [".sptk", ".spnt", ".dptk", ".dpnt"][self.operands[2].as_unsigned_imm() as usize], + [".few", ".many"][self.operands[1].as_unsigned_imm() as usize], + ["", ".clr"][self.operands[3].as_unsigned_imm() as usize], + if let Operand::ImmI64(_) = self.operands[0] { + "$+" + } else { + "" + }, + self.operands[0], + ) + } } else if let Opcode::Br_call = self.opcode { return write!(f, "br.call{}{}{} {}={}{}", [".sptk", ".spnt", ".dptk", ".dpnt"][self.operands[3].as_unsigned_imm() as usize], @@ -1183,6 +1199,14 @@ impl fmt::Display for Instruction { self.operands[0], self.operands[1], ) + } else if self.opcode == Opcode::Dep_z { + if self.operands[2].as_unsigned_imm() == 64 - self.operands[3].as_unsigned_imm() { + return write!(f, "shl {}={},{}", + self.operands[0], + self.operands[1], + self.operands[2], + ) + } } else if self.opcode == Opcode::Extr { if self.operands[2].as_unsigned_imm() == 64 - self.operands[3].as_unsigned_imm() { return write!(f, "shr {}={},{}", @@ -1447,16 +1471,15 @@ pub enum Operand { ImmI64(i64), ImmU64(u64), Memory(GPRegister), -// Indirect(IndirectRegisterClass, GPRegister), PSR, // processor status register (see 3.3.2) PR, // predicate register (all 64 bits) IP, // is this an application register? distinct? -// ControlRegister(ControlRegister), ApplicationRegister(ApplicationRegister), BranchRegister(BranchRegister), } impl Operand { + #[allow(dead_code)] fn as_signed_imm(&self) -> i64 { if let Operand::ImmI64(i) = self { *i @@ -1599,7 +1622,7 @@ impl Decoder<InstructionBundle> for InstDecoder { &instruction_bytes[46..87], &instruction_bytes[87..128], ]; - let (instruction_types, stop_mask) = BUNDLE_TAGS[bundle_tag as usize].ok_or(DecodeError::BadBundle)?; + let (instruction_types, _) = BUNDLE_TAGS[bundle_tag as usize].ok_or(DecodeError::BadBundle)?; fn decode_l_instruction(word2: &BitSlice<Lsb0, u8>, word: &BitSlice<Lsb0, u8>) -> Instruction { let tag = word[37..41].load::<u8>(); @@ -1687,6 +1710,7 @@ impl Decoder<InstructionBundle> for InstDecoder { let (dest_boundary, mut operands) = read_f_operands(operand_encoding, word); // quoth `fma - Floating-point Multiply Add`, fma.* with `f2` set to register // `f0` is actually `fmpy` + // same `multiply-add` -> `multiply` applies for `xma` -> `xmpy` if operands[3] == Operand::FloatRegister(FloatRegister(0)) { if opcode == Opcode::Fma { if operands[2] == Operand::FloatRegister(FloatRegister(1)) { @@ -1715,6 +1739,15 @@ impl Decoder<InstructionBundle> for InstDecoder { opcode = Opcode::Fmpy_d; operands[3] = Operand::None; } + } else if opcode == Opcode::Xma_l { + opcode = Opcode::Xmpy_l; + operands[3] = Operand::None; + } else if opcode == Opcode::Xma_h { + opcode = Opcode::Xmpy_h; + operands[3] = Operand::None; + } else if opcode == Opcode::Xma_hu { + opcode = Opcode::Xmpy_hu; + operands[3] = Operand::None; } } Instruction { @@ -1752,7 +1785,6 @@ impl Decoder<InstructionBundle> for InstDecoder { }, InstructionType::A => { let (mut opcode, operand_encoding) = get_a_opcode_and_encoding(tag, word); - eprintln!("opcode, encoding: A({})/{:?}", opcode, operand_encoding); let (dest_boundary, mut operands) = read_a_operands(operand_encoding, word); if opcode == Opcode::Addl { if operands[2] == Operand::GPRegister(GPRegister(0)) { @@ -1804,7 +1836,7 @@ impl Decoder<InstructionBundle> for InstDecoder { Instruction { opcode, sf: None, - hint: None, + hint, predicate: word[0..6].load::<u8>(), dest_boundary, operands, @@ -1879,14 +1911,15 @@ fn read_l_operands(encoding: OperandEncodingX, word: &BitSlice<Lsb0, u8>, word2: let immc = word[22..27].load::<u64>(); let i = word[36] as u64; let imm41 = word2[0..41].load::<u64>(); - // TODO: might be right, i, c, and imm41 may be mixed up. + // TODO: might be right, i, c, and imm41 may be mixed up. inferred from testcases in + // `test_mlx_bundle` let imm = imm7b + (immd << 7) + (immc << 16) + - (i << 21) + - (ic << 22) + - (imm41 << 23); + (ic << 21) + + (imm41 << 22) + + (i << 63); two_op( Some(0), Operand::GPRegister(GPRegister(r1)), @@ -1898,10 +1931,10 @@ fn read_l_operands(encoding: OperandEncodingX, word: &BitSlice<Lsb0, u8>, word2: if btype != 0 { // unclear what happens. invalid instruction? } - let p = word[12]; + let _p = word[12]; let imm20b = word[13..33].load::<u64>(); - let wh = word[33..35].load::<u64>(); - let d = word[35]; + let _wh = word[33..35].load::<u64>(); + let _d = word[35]; let i = word[36]; let imm39 = word2[2..41].load::<u64>(); // TODO: this is certainly assembled incorrectly @@ -1910,10 +1943,10 @@ fn read_l_operands(encoding: OperandEncodingX, word: &BitSlice<Lsb0, u8>, word2: } X4 => { let b1 = word[6..9].load::<u8>(); - let p = word[12]; + let _p = word[12]; let imm20b = word[13..33].load::<u64>(); - let wh = word[33..35].load::<u64>(); - let d = word[35]; + let _wh = word[33..35].load::<u64>(); + let _d = word[35]; let i = word[36]; let imm39 = word2[2..41].load::<u64>(); // TODO: this is certainly assembled incorrectly @@ -2021,25 +2054,23 @@ fn read_b_operands(encoding: OperandEncodingB, word: &BitSlice<Lsb0, u8>) -> (Op } B6 => { let timm7a = word[6..13].load::<u32>(); - // TODO: missing some bits - // TODO: sign extend? let imm20b = word[13..33].load::<u32>(); let wh = word[3..5].load::<u8>(); let t2e = word[33..35].load::<u32>(); let tag = (t2e << 7) + timm7a; let ih = word[33..35].load::<u8>(); - let s = word[36] as u8; + let s = word[36] as u32; + let imm = (((s << 20) + imm20b) << 11) >> 11; four_op( Option::None, - Operand::ImmI64(imm20b as i64), + Operand::ImmI64(imm as i64), Operand::ImmU64(tag as u64), Operand::ImmU64(ih as u64), - Operand::ImmU64(s as u64), + Operand::ImmU64(wh as u64), ) } B7 => { let timm7a = word[6..13].load::<u32>(); - // TODO: missing some bits let b2 = word[13..16].load::<u8>(); let wh = word[3..5].load::<u8>(); let t2e = word[33..35].load::<u32>(); @@ -2385,8 +2416,8 @@ fn read_i_operands(encoding: OperandEncodingI, word: &BitSlice<Lsb0, u8>) -> (Op I12 => { let r1 = word[6..13].load::<u8>(); let r2 = word[13..20].load::<u8>(); - let cpos = word[20..26].load::<u8>(); - let len = word[27..33].load::<u8>(); + let cpos = 63 - word[20..26].load::<u8>(); + let len = word[27..33].load::<u8>() + 1; // `The len immediate is encoded as len minus 1 in the instruction.` four_op( Some(0), Operand::GPRegister(GPRegister(r1)), @@ -2399,8 +2430,8 @@ fn read_i_operands(encoding: OperandEncodingI, word: &BitSlice<Lsb0, u8>) -> (Op let r1 = word[6..13].load::<u8>(); let imm7b = word[13..20].load::<u8>(); let imm = (((word[36] as u8) << 7) + imm7b) as i8; - let cpos = word[20..26].load::<u8>(); - let len = word[27..33].load::<u8>(); + let cpos = 63 - word[20..26].load::<u8>(); + let len = word[27..33].load::<u8>() + 1; // `The len immediate is encoded as len minus 1 in the instruction.` four_op( Some(0), Operand::GPRegister(GPRegister(r1)), @@ -2413,8 +2444,8 @@ fn read_i_operands(encoding: OperandEncodingI, word: &BitSlice<Lsb0, u8>) -> (Op let r1 = word[6..13].load::<u8>(); let imm = word[36] as u8; let r3 = word[20..27].load::<u8>(); - let cpos = word[14..20].load::<u8>(); - let len = word[27..33].load::<u8>(); + let cpos = 63 - word[14..20].load::<u8>(); + let len = word[27..33].load::<u8>() + 1; // `The len immediate is encoded as len minus 1 in the instruction.` ( Some(0), [ @@ -2430,7 +2461,7 @@ fn read_i_operands(encoding: OperandEncodingI, word: &BitSlice<Lsb0, u8>) -> (Op let r1 = word[6..13].load::<u8>(); let r2 = word[13..20].load::<u8>(); let r3 = word[20..27].load::<u8>(); - let len = word[27..31].load::<u8>() + 1; + let len = word[27..31].load::<u8>() + 1; // `The len immediate is encoded as len minus 1 in the instruction.` let cpos = 63 - word[31..37].load::<u8>(); // not sure if this is accurate? makes the dep r14=r18 test pass... ( Some(0), @@ -3415,9 +3446,9 @@ fn get_i_opcode_and_encoding(tag: u8, word: &BitSlice<Lsb0, u8>) -> (Opcode, Ope if word[26] { match index { 0 => TABLE4_23[table4_23_index as usize], - 1 => (Dep_z_imm, I13), + 1 => (Dep_z, I13), 2 => (Purple, None), - 3 => (Dep_imm, I14), + 3 => (Dep, I14), _ => { unreachable!() }, } } else { @@ -3425,7 +3456,7 @@ fn get_i_opcode_and_encoding(tag: u8, word: &BitSlice<Lsb0, u8>) -> (Opcode, Ope 0 => TABLE4_23[table4_23_index as usize], 1 => (Dep_z, I12), 2 => (Purple, None), - 3 => (Dep_imm, I14), + 3 => (Dep, I14), _ => { unreachable!() }, } } @@ -3486,8 +3517,8 @@ fn get_i_opcode_and_encoding(tag: u8, word: &BitSlice<Lsb0, u8>) -> (Opcode, Ope // `Table 4-18 Multimedia Opcode 7 Size 2 2-bit Opcode Extensions` const TABLE4_18: [(Opcode, OperandEncodingI); 64] = [ - (Pshr2_u_var, I5), (Pmpyshr2_u, I1), (Pshr2_var, I5), (Pmpyshr2, I1), - (Pshl1_var, I7), (Pmpyshr2_u, I1), (Purple, None), (Pmpyshr2, I1), + (Pshr2_u, I5), (Pmpyshr2_u, I1), (Pshr2, I5), (Pmpyshr2, I1), + (Pshl1, I7), (Pmpyshr2_u, I1), (Purple, None), (Pmpyshr2, I1), (Purple, None), (Pmpyshr2_u, I1), (Purple, None), (Pmpyshr2, I1), (Purple, None), (Pmpyshr2_u, I1), (Purple, None), (Pmpyshr2, I1), (Purple, None), (Pshr2_u_fixed, I6), (Purple, None), (Pshr2_fixed, I6), @@ -3506,8 +3537,8 @@ fn get_i_opcode_and_encoding(tag: u8, word: &BitSlice<Lsb0, u8>) -> (Opcode, Ope // `Table 4-19 Multimedia Opcode 7 Size 4 2-bit Opcode Extensions` const TABLE4_19: [(Opcode, OperandEncodingI); 64] = [ - (Pshr4_u_var, I5), (Purple, None), (Pshr4_var, I5), (Purple, None), - (Pshl4_var, I7), (Purple, None), (Purple, None), (Purple, None), + (Pshr4_u, I5), (Purple, None), (Pshr4, I5), (Purple, None), + (Pshl4, I7), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Mpy4, I2), (Purple, None), (Mpyshl4, I2), (Pshr4_u_fixed, I6), (Purple, None), (Pshr4_fixed, I6), (Purple, None), @@ -3525,8 +3556,8 @@ fn get_i_opcode_and_encoding(tag: u8, word: &BitSlice<Lsb0, u8>) -> (Opcode, Ope ]; const TABLE4_20: [(Opcode, OperandEncodingI); 64] = [ - (Shr_u_var, I5), (Purple, None), (Shr_var, I5), (Purple, None), - (Shl_var, I7), (Purple, None), (Purple, None), (Purple, None), + (Shr_u, I5), (Purple, None), (Shr, I5), (Purple, None), + (Shl, I7), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), diff --git a/tests/test.rs b/tests/test.rs index 24a1937..729aed1 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -1,6 +1,122 @@ use yaxpeax_ia64::InstDecoder; use yaxpeax_arch::Decoder; +// from elf64-ia64-vms.c +// 0x0b, 0x78, 0x00, 0x02, 0x00, 0x24, 0x00, 0x41, 0x3c, 0x70, 0x27, 0xc0, 0x01, 0x08, 0x00, 0x84 +// [MMI] addl r15=0,r1;; +// ld8.acq r16=[r15],8 +// mov r14=r1;; +// 0x11, 0x08, 0x00, 0x1e, 0x18, 0x10, 0x60, 0x80, 0x04, 0x80, 0x03, 0x00, 0x60, 0x00, 0x80, 0x00 +// [MIB] ld8 r1=[r15] +// mov b6=r16 +// br.few b6;; +// 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0 +// [MLX] nop.m 0 +// brl.sptk.few tgt;; + +// from ia64 bash_4.2+dfsg-0.1+deb7u3_ia64: +// 0410 1c00 8045 024c 8009 0060 f013 1a60 +// 0510 4118 0021 0000 0000 6020 0023 c86f +// 0908 2144 1814 a000 4444 0820 0100 c000 +// 0100 0c50 2a04 1048 040a 40c0 0461 0084 +// 0158 80fb f027 0082 f5e5 4f60 04ed c79f +// 0918 0016 1810 0002 8030 2080 04e9 b79f +// 0818 0146 1810 4002 9030 2000 0000 0400 +// 1000 2806 9811 5002 2000 4200 50a5 ff58 + +#[test] +fn test_shr_shl_dep_ext() { + // encoding of immediates for dep/ext and their pseudo-ops (shl/shr) is weird. + // `pos` is recorded as `63 - the_actual_value`? `len` is encoded as the actual length minus + // one? + // + // there were enough quirks this warrants collecting them as a standalone test. + + let decoder = InstDecoder::default(); + + // dep + let expected = "[MMI] ld1 r17=[r17];; nop.m 0x0; dep r14=r18,r14,0x0,0x8"; + let data = [0x0a, 0x88, 0x00, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0xc0, 0x21, 0x71, 0xdc, 0x4f]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); + let expected = "[MII] nop.m 0x0; dep r14=r18,r14,0x8,0x8;; dep r14=r17,r14,0x10,0x8;;"; + let data = [0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0xe0, 0x90, 0x38, 0xee, 0x26, 0xc0, 0x11, 0x71, 0xdc, 0x4b]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); + let expected = "[MII] nop.m 0x0; dep r14=r16,r14,0x18,0x8; nop.i 0x0;;"; + let data = [0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xe0, 0x80, 0x38, 0xee, 0x24, 0x00, 0x00, 0x00, 0x04, 0x00]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); + let expected = "[MII] nop.m 0x0; dep r14=r18,r14,0x0,0x8; nop.i 0x0"; + let data = [0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xe0, 0x90, 0x38, 0xee, 0x27, 0x00, 0x00, 0x00, 0x04, 0x00]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); + let expected = "[MII] nop.m 0x0; dep r14=r18,r14,0x8,0x8;; dep r14=r17,r14,0x10,0x8;;"; + let data = [0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0xe0, 0x90, 0x38, 0xee, 0x26, 0xc0, 0x11, 0x71, 0xdc, 0x4b]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); + let expected = "[MII] nop.m 0x0; dep r14=r16,r14,0x18,0x8; nop.i 0x0;;"; + let data = [0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xe0, 0x80, 0x38, 0xee, 0x24, 0x00, 0x00, 0x00, 0x04, 0x00]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); + + // extr + let expected = "[MIB] nop.m 0x0; extr r36=r8,0x1f,0x1; nop.b 0x0"; + let data = [0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x40, 0xfa, 0x21, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x20]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); + let expected = "[MII] nop.m 0x0; extr r36=r36,0x6,0x1a;; shladd r36=r36,0x3,r14;;"; + let data = [0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x40, 0x6a, 0x90, 0x32, 0x29, 0x80, 0x44, 0x72, 0x48, 0x80]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); + let expected = "[MIB] nop.m 0x0; extr r17=r8,0x1f,0x1; nop.b 0x0"; + let data = [0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0xf9, 0x21, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x20]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); + + // shr + let expected = "[MII] nop.m 0x0; shr.u r36=r36,0x3a;; add r36=r36,r8;;"; + let data = [0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x40, 0xa2, 0x93, 0x0a, 0x29, 0x80, 0x44, 0x42, 0x00, 0x80]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); + let expected = "[MMI] addl r14=0x3dd4,r1; nop.m 0x0; shr.u r17=r17,0x3a"; + let data = [0x08, 0x70, 0x50, 0x03, 0x7b, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x20, 0x42, 0x8f, 0x14, 0x52]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); + let expected = "[MII] setf.sig f6=r16; shr r19=r16,0x3f; sub r17=r8,r17;;"; + let data = [0x01, 0x30, 0x40, 0x00, 0xe1, 0x18, 0x30, 0xf9, 0x43, 0x00, 0x29, 0x20, 0x82, 0x88, 0x14, 0x80]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); + let expected = "[MII] nop.m 0x0; shr r14=r14,0x12;; sub r14=r14,r19;;"; + let data = [0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0xe0, 0x28, 0x39, 0x5a, 0x29, 0xc0, 0xe1, 0x98, 0x14, 0x80]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); + let expected = "[MII] (p07) adds r14=-0x1,r49; (p07) and r49=0x7,r49;; (p07) shr.u r14=r14,0x3;;"; + let data = [0xe3, 0x70, 0xfc, 0x63, 0x3f, 0xe3, 0x11, 0x3b, 0xc4, 0x58, 0xc0, 0xc3, 0x61, 0x70, 0xf0, 0x52]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); + + // shl + let expected = "[MII] nop.m 0x0; shl r17=r14,0x5; sxt4 r19=r14;;"; + let data = [0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x71, 0xe8, 0xf4, 0x29, 0x60, 0x02, 0x70, 0x58, 0x00]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); + let expected = "[MII] nop.m 0x0; shl r19=r17,0x6;; sub r17=r19,r17;;"; + let data = [0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x30, 0x89, 0xe4, 0xf2, 0x29, 0x20, 0x32, 0x89, 0x14, 0x80]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); + let expected = "[MMI] shladd r14=r17,0x3,r14;; nop.m 0x0; shl r14=r14,0x6;;"; + let data = [0x0b, 0x70, 0x44, 0x1c, 0x12, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0xc0, 0xe1, 0xc8, 0xe5, 0x53]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); + + // shladd is special and not complicated like the above + let expected = "[MII] nop.m 0x0; extr r36=r36,0x6,0x1a;; shladd r36=r36,0x3,r14;;"; + let data = [0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x40, 0x6a, 0x90, 0x32, 0x29, 0x80, 0x44, 0x72, 0x48, 0x80]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); +} + #[test] fn test_addl_imm() { let decoder = InstDecoder::default(); @@ -10,6 +126,7 @@ fn test_addl_imm() { let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); } + #[test] fn test_mlx_bundle() { let decoder = InstDecoder::default(); @@ -18,59 +135,41 @@ fn test_mlx_bundle() { let data = [0x05, 0x10, 0x15, 0x0a, 0x80, 0xc5, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x84, 0xf7, 0xaf, 0x6f]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); -} -#[test] -fn test_a_bundle() { -// from elf64-ia64-vms.c -// [MMI] addl r15=0,r1;; -// ld8.acq r16=[r15],8 -// mov r14=r1;; -// let data = [0x0b, 0x78, 0x00, 0x02, 0x00, 0x24, 0x00, 0x41, 0x3c, 0x70, 0x27, 0xc0, 0x01, 0x08, 0x00, 0x84]; - //let data = [0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0]; - //let data = [0x04, 0x10, 0x1c, 0x00, 0x80, 0x45, 0x02, 0x4c, 0x80, 0x09, 0x00, 0x60, 0xf0, 0x13, 0x1a, 0x60]; - //let data = [0x05, 0x10, 0x41, 0x18, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x60, 0x20, 0x00, 0x23, 0xc8, 0x6f]; - //let decoder = InstDecoder::default(); - //let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + let expected = "[MLX] ld4 r16=[r14]; movl r14=0x431bde82d7b634db"; + let data = [0x04, 0x80, 0x00, 0x1c, 0x10, 0x90, 0xd7, 0x82, 0xde, 0x1b, 0x43, 0xc0, 0xb1, 0xd5, 0xa6, 0x61]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); } #[test] fn test_br_cosmetics() { let decoder = InstDecoder::default(); - let data = [0x11, 0x08, 0x00, 0x1e, 0x18, 0x10, 0x60, 0x80, 0x04, 0x80, 0x03, 0x00, 0x60, 0x00, 0x80, 0x00]; - let inst = decoder.decode(data[..].iter().cloned()).unwrap(); - let stringy = format!("{}", inst); -// assert_eq!(stringy, "[MIB] ld8 r1=[r15]; mov b6=r16; br.few b6;;"); - let data = [0x19, 0x50, 0x40, 0x19, 0x3f, 0x23, 0x80, 0x00, 0x00, 0x00, 0x48, 0x80, 0x00, 0x00, 0x84, 0x02]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); let stringy = format!("{}", inst); assert_eq!(stringy, "[MMB] adds r10=-0x30,r12; mov r8=0x0; br.ret.dptk.few b0;;"); -} - -// from elf64-ia64-vms.c -// 0x0b, 0x78, 0x00, 0x02, 0x00, 0x24, 0x00, 0x41, 0x3c, 0x70, 0x27, 0xc0, 0x01, 0x08, 0x00, 0x84 -// [MMI] addl r15=0,r1;; -// ld8.acq r16=[r15],8 -// mov r14=r1;; -// 0x11, 0x08, 0x00, 0x1e, 0x18, 0x10, 0x60, 0x80, 0x04, 0x80, 0x03, 0x00, 0x60, 0x00, 0x80, 0x00 -// [MIB] ld8 r1=[r15] -// mov b6=r16 -// br.few b6;; -// 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0 -// [MLX] nop.m 0 -// brl.sptk.few tgt;; + let expected = "[MMB] cmp.eq p6,p7=0x0,r32; adds r36=0x1,r32; (p06) br.cond.dpnt.few $+0x5d0;;"; + let data = [0x19, 0x30, 0x00, 0x40, 0x07, 0x39, 0x40, 0x0a, 0x80, 0x00, 0x42, 0x03, 0xd0, 0x05, 0x00, 0x43]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); + let expected = "[MIB] alloc r2=ar.pfs,3,0,0; nop.i 0x0; br.many $+-0x2a0;;"; + let data = [0x11, 0x10, 0x0c, 0x00, 0x80, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x68, 0xfd, 0xff, 0x48]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); + let expected = "[MIB] mov r41=r32; nop.i 0x0; br.call.sptk.many b0=$+-0x1745d0;;"; + let data = [0x11, 0x48, 0x01, 0x40, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x38, 0xba, 0xe8, 0x58]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); + let expected = "[MMB] nop.m 0x0; adds r12=0x10,r12; br.ret.sptk.many b0;;"; + let data = [0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0xc0, 0x80, 0x30, 0x00, 0x42, 0x80, 0x08, 0x00, 0x84, 0x00]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); -// from ia64 bash_4.2+dfsg-0.1+deb7u3_ia64: -// 0410 1c00 8045 024c 8009 0060 f013 1a60 -// 0510 4118 0021 0000 0000 6020 0023 c86f -// 0908 2144 1814 a000 4444 0820 0100 c000 -// 0100 0c50 2a04 1048 040a 40c0 0461 0084 -// 0158 80fb f027 0082 f5e5 4f60 04ed c79f -// 0918 0016 1810 0002 8030 2080 04e9 b79f -// 0818 0146 1810 4002 9030 2000 0000 0400 -// 1000 2806 9811 5002 2000 4200 50a5 ff58 + // TODO: need tests for `B6` and `B7` operand encodings, for `brp` and `brp.ret`. + // TODO: need tests for `X3` and `X4` operand encodings, for `brl` and `brl.call`. +} // from ia64 bash_4.2+dfsg-0.1+deb7u3_ia64 via binutils-ia64-linux-gnu=2.30-21ubuntu1~18.04.4 // bfd reports immediates in decimal in many places. all immediates are corrected to hex, as @@ -140,11 +239,11 @@ fn test_bash_tilde_expand_word() { let data = [0x11, 0x10, 0x0c, 0x00, 0x80, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x68, 0xfd, 0xff, 0x48]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] mov r41=r32; nop.i 0x0; br.call.sptk.many b0=;;"; + let expected = "[MIB] mov r41=r32; nop.i 0x0; br.call.sptk.many b0=$+-0x1745d0;;"; let data = [0x11, 0x48, 0x01, 0x40, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x38, 0xba, 0xe8, 0x58]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] mov r1=r40; mov r41=r8; br.call.sptk.many b0=;;"; + let expected = "[MIB] mov r1=r40; mov r41=r8; br.call.sptk.many b0=$+-0xa0700;;"; let data = [0x11, 0x08, 0x00, 0x50, 0x00, 0x21, 0x90, 0x02, 0x20, 0x00, 0x42, 0x00, 0x08, 0xf9, 0xf5, 0x58]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -156,7 +255,7 @@ fn test_bash_tilde_expand_word() { let data = [0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf0, 0x00, 0x3c, 0x28, 0x00, 0xe0, 0x00, 0x78, 0x18, 0xe6]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MMI] cmp4.eq p9,p8=47,r15;; (p06) mov r16=0x1; (p08) mov r14=0x1;;"; + let expected = "[MMI] cmp4.eq p9,p8=0x2f,r15;; (p06) mov r16=0x1; (p08) mov r14=0x1;;"; let data = [0x0b, 0x48, 0xbc, 0x1e, 0x88, 0xb9, 0x01, 0x09, 0x00, 0x00, 0x48, 0xc4, 0x11, 0x00, 0x00, 0x90]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -164,7 +263,7 @@ fn test_bash_tilde_expand_word() { let data = [0xe3, 0x80, 0x00, 0x00, 0x00, 0x61, 0xe2, 0x00, 0x00, 0x00, 0x42, 0xc0, 0xe1, 0x80, 0x30, 0x80]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] cmp4.eq p6,p7=0x0,r14; nop.i 0x0; (p06) br.cond.dpnt.few 400000000019b570 <tilde_expand_word@@Base+0x470>;;"; + let expected = "[MIB] cmp4.eq p6,p7=0x0,r14; nop.i 0x0; (p06) br.cond.dpnt.few $+0x320;;"; let data = [0x11, 0x30, 0x00, 0x1c, 0x87, 0x39, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x20, 0x03, 0x00, 0x43]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -188,7 +287,7 @@ fn test_bash_tilde_expand_word() { let data = [0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf0, 0x00, 0x3c, 0x28, 0x00, 0xe0, 0x00, 0x78, 0x18, 0xe6]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] nop.m 0x0; cmp4.eq.or.andcm p7,p6=47,r15; (p07) br.cond.dpnt.few 400000000019b310 <tilde_expand_word@@Base+0x210>;;"; + let expected = "[MIB] nop.m 0x0; cmp4.eq.or.andcm p7,p6=0x2f,r15; (p07) br.cond.dpnt.few $+0x60;;"; let data = [0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x78, 0x3d, 0x8c, 0xf3, 0x03, 0x60, 0x00, 0x00, 0x43]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -208,7 +307,7 @@ fn test_bash_tilde_expand_word() { let data = [0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf0, 0x00, 0x3c, 0x28, 0x00, 0xe0, 0x00, 0x78, 0x18, 0xe6]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] nop.m 0x0; cmp4.eq.or.andcm p7,p6=47,r15; (p06) br.cond.dptk.few 400000000019b2c0 <tilde_expand_word@@Base+0x1c0>"; + let expected = "[MIB] nop.m 0x0; cmp4.eq.or.andcm p7,p6=0x2f,r15; (p06) br.cond.dptk.few $+-0x40"; let data = [0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x78, 0x3d, 0x8c, 0x73, 0x03, 0xc0, 0xff, 0xff, 0x4a]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -228,7 +327,7 @@ fn test_bash_tilde_expand_word() { let data = [0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0x00, 0x38, 0x30, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] cmp.eq p6,p7=0x0,r8; nop.i 0x0; (p06) br.cond.dpnt.few 400000000019b470 <tilde_expand_word@@Base+0x370>;;"; + let expected = "[MIB] cmp.eq p6,p7=0x0,r8; nop.i 0x0; (p06) br.cond.dpnt.few $+0x120;;"; let data = [0x11, 0x30, 0x00, 0x10, 0x07, 0x39, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x20, 0x01, 0x00, 0x43]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -244,11 +343,11 @@ fn test_bash_tilde_expand_word() { let data = [0x08, 0x30, 0x00, 0x10, 0x07, 0x39, 0x10, 0x00, 0xa0, 0x00, 0x42, 0x40, 0x05, 0x08, 0x01, 0x84]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MMB] mov r43=r36; mov r37=r8; (p06) br.cond.dpnt.few 400000000019b470 <tilde_expand_word@@Base+0x370>;;"; + let expected = "[MMB] mov r43=r36; mov r37=r8; (p06) br.cond.dpnt.few $+0xe0;;"; let data = [0x19, 0x58, 0x01, 0x48, 0x00, 0x21, 0x50, 0x02, 0x20, 0x00, 0x42, 0x03, 0xe0, 0x00, 0x00, 0x43]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] mov r41=r8; nop.i 0x0; br.call.sptk.many b0=400000000019af40 <_rl_find_prev_mbchar@@Base+0x240>;;"; + let expected = "[MIB] mov r41=r8; nop.i 0x0; br.call.sptk.many b0=$+-0x460;;"; let data = [0x11, 0x48, 0x01, 0x10, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xa8, 0xfb, 0xff, 0x58]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -256,11 +355,11 @@ fn test_bash_tilde_expand_word() { let data = [0x09, 0x70, 0x40, 0x18, 0x00, 0x21, 0x10, 0x00, 0xa0, 0x00, 0x42, 0x20, 0x05, 0x18, 0x01, 0x84]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] st8 [r14]=r8; nop.i 0x0; br.call.sptk.many b0=40000000000fadc0 <xfree@@Base>;;"; + let expected = "[MIB] st8 [r14]=r8; nop.i 0x0; br.call.sptk.many b0=$+-0xa0600;;"; let data = [0x11, 0x00, 0x20, 0x1c, 0x98, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0xfa, 0xf5, 0x58]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] mov r1=r40; mov r41=r37; br.call.sptk.many b0=40000000000fadc0 <xfree@@Base>;;"; + let expected = "[MIB] mov r1=r40; mov r41=r37; br.call.sptk.many b0=$+-0xa0610;;"; let data = [0x11, 0x08, 0x00, 0x50, 0x00, 0x21, 0x90, 0x02, 0x94, 0x00, 0x42, 0x00, 0xf8, 0xf9, 0xf5, 0x58]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -276,11 +375,11 @@ fn test_bash_tilde_expand_word() { let data = [0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0xc0, 0x80, 0x30, 0x00, 0x42, 0x80, 0x08, 0x00, 0x84, 0x00]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] mov r41=r32; nop.i 0x0; br.call.sptk.many b0=4000000000026c20 <_init@@Base+0x1b00>;;"; + let expected = "[MIB] mov r41=r32; nop.i 0x0; br.call.sptk.many b0=$+-0x1747f0;;"; let data = [0x11, 0x48, 0x01, 0x40, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x18, 0xb8, 0xe8, 0x58]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] mov r1=r40; adds r41=0x1,r8; br.call.sptk.many b0=40000000000fab00 <xmalloc@@Base>;;"; + let expected = "[MIB] mov r1=r40; adds r41=0x1,r8; br.call.sptk.many b0=$+-0xa0920;;"; let data = [0x11, 0x08, 0x00, 0x50, 0x00, 0x21, 0x90, 0x0a, 0x20, 0x00, 0x42, 0x00, 0xe8, 0xf6, 0xf5, 0x58]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -288,7 +387,7 @@ fn test_bash_tilde_expand_word() { let data = [0x08, 0x08, 0x00, 0x50, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x20, 0x05, 0x40, 0x00, 0x84]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MMB] mov r42=r32; nop.m 0x0; br.call.sptk.many b0=40000000000267e0 <_init@@Base+0x16c0>;;"; + let expected = "[MMB] mov r42=r32; nop.m 0x0; br.call.sptk.many b0=$+-0x174c60;;"; let data = [0x19, 0x50, 0x01, 0x40, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xa8, 0xb3, 0xe8, 0x58]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -300,7 +399,7 @@ fn test_bash_tilde_expand_word() { let data = [0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0xc0, 0x80, 0x30, 0x00, 0x42, 0x80, 0x08, 0x00, 0x84, 0x00]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] mov r41=r35; nop.i 0x0; br.call.sptk.many b0=4000000000025e60 <_init@@Base+0xd40>;;"; + let expected = "[MIB] mov r41=r35; nop.i 0x0; br.call.sptk.many b0=$+-0x175610;;"; let data = [0x11, 0x48, 0x01, 0x46, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xf8, 0xa9, 0xe8, 0x58]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -308,11 +407,11 @@ fn test_bash_tilde_expand_word() { let data = [0x08, 0x70, 0x80, 0x10, 0x00, 0x21, 0x70, 0x00, 0x20, 0x0c, 0x72, 0x20, 0x00, 0x40, 0x01, 0x84]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MMB] mov r42=r33; mov r43=r36; (p07) br.cond.dpnt.few 400000000019b580 <tilde_expand_word@@Base+0x480>;;"; + let expected = "[MMB] mov r42=r33; mov r43=r36; (p07) br.cond.dpnt.few $+0xf0;;"; let data = [0x19, 0x50, 0x01, 0x42, 0x00, 0x21, 0xb0, 0x02, 0x90, 0x00, 0xc2, 0x03, 0xf0, 0x00, 0x00, 0x43]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MBB] ld8 r41=[r14]; br.call.sptk.many b0=400000000019af40 <_rl_find_prev_mbchar@@Base+0x240>; nop.b 0x0;;"; + let expected = "[MBB] ld8 r41=[r14]; br.call.sptk.many b0=$+-0x560; nop.b 0x0;;"; let data = [0x13, 0x48, 0x01, 0x1c, 0x18, 0x10, 0x00, 0x54, 0xfd, 0x7f, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x20]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -324,11 +423,11 @@ fn test_bash_tilde_expand_word() { let data = [0x09, 0x70, 0x40, 0x18, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x20, 0x05, 0x18, 0x01, 0x84]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] st8 [r14]=r8; nop.i 0x0; br.call.sptk.many b0=40000000000fadc0 <xfree@@Base>;;"; + let expected = "[MIB] st8 [r14]=r8; nop.i 0x0; br.call.sptk.many b0=$+-0xa0710;;"; let data = [0x11, 0x00, 0x20, 0x1c, 0x98, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xf8, 0xf8, 0xf5, 0x58]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] mov r1=r40; nop.i 0x0; br.call.sptk.many b0=4000000000027140 <_init@@Base+0x2020>;;"; + let expected = "[MIB] mov r1=r40; nop.i 0x0; br.call.sptk.many b0=$+-0x1743a0;;"; let data = [0x11, 0x08, 0x00, 0x50, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x68, 0xbc, 0xe8, 0x58]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -348,7 +447,7 @@ fn test_bash_tilde_expand_word() { let data = [0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0xc0, 0x80, 0x30, 0x00, 0x42, 0x80, 0x08, 0x00, 0x84, 0x00]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] mov r34=0x1; nop.i 0x0; br.call.sptk.many b0=400000000006dd80 <sh_get_home_dir@@Base>;;"; + let expected = "[MIB] mov r34=0x1; nop.i 0x0; br.call.sptk.many b0=$+-0x12d7b0;;"; let data = [0x11, 0x10, 0x05, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x58, 0x28, 0xed, 0x58]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -360,11 +459,11 @@ fn test_bash_tilde_expand_word() { let data = [0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x30, 0x05, 0x80, 0x03, 0x80, 0x01, 0x61, 0x00, 0x84]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] alloc r2=ar.pfs,3,0,0; nop.i 0x0; br.many 400000000019af40 <_rl_find_prev_mbchar@@Base+0x240>"; + let expected = "[MIB] alloc r2=ar.pfs,3,0,0; nop.i 0x0; br.many $+-0x620"; let data = [0x10, 0x10, 0x0c, 0x00, 0x80, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xe8, 0xf9, 0xff, 0x48]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] mov r14=r0; mov r36=0x1; br.few 400000000019b320 <tilde_expand_word@@Base+0x220>;;"; + let expected = "[MIB] mov r14=r0; mov r36=0x1; br.few $+-0x250;;"; let data = [0x11, 0x70, 0x00, 0x00, 0x00, 0x21, 0x40, 0x0a, 0x00, 0x00, 0x48, 0x00, 0xb0, 0xfd, 0xff, 0x48]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -376,7 +475,7 @@ fn test_bash_tilde_expand_word() { let data = [0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0x00, 0x38, 0x30, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] cmp.eq p6,p7=0x0,r8; nop.i 0x0; (p06) br.cond.dpnt.few 400000000019b650 <tilde_expand_word@@Base+0x550>;;"; + let expected = "[MIB] cmp.eq p6,p7=0x0,r8; nop.i 0x0; (p06) br.cond.dpnt.few $+0xb0;;"; let data = [0x11, 0x30, 0x00, 0x10, 0x07, 0x39, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0xb0, 0x00, 0x00, 0x43]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -392,11 +491,11 @@ fn test_bash_tilde_expand_word() { let data = [0x08, 0x30, 0x00, 0x10, 0x07, 0x39, 0x10, 0x00, 0xa0, 0x00, 0x42, 0xa0, 0x04, 0x40, 0x00, 0x84]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MMB] mov r43=r36; mov r42=r33; (p06) br.cond.dpnt.few 400000000019b650 <tilde_expand_word@@Base+0x550>;;"; + let expected = "[MMB] mov r43=r36; mov r42=r33; (p06) br.cond.dpnt.few $+0x70;;"; let data = [0x19, 0x58, 0x01, 0x48, 0x00, 0x21, 0xa0, 0x02, 0x84, 0x00, 0x42, 0x03, 0x70, 0x00, 0x00, 0x43]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] mov r41=r8; nop.i 0x0; br.call.sptk.many b0=400000000019af40 <_rl_find_prev_mbchar@@Base+0x240>;;"; + let expected = "[MIB] mov r41=r8; nop.i 0x0; br.call.sptk.many b0=$+-0x6b0;;"; let data = [0x11, 0x48, 0x01, 0x10, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x58, 0xf9, 0xff, 0x58]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -404,7 +503,7 @@ fn test_bash_tilde_expand_word() { let data = [0x09, 0x70, 0x40, 0x18, 0x00, 0x21, 0x10, 0x00, 0xa0, 0x00, 0x42, 0x20, 0x05, 0x28, 0x01, 0x84]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] st8 [r14]=r8; nop.i 0x0; br.call.sptk.many b0=40000000000fadc0 <xfree@@Base>;;"; + let expected = "[MIB] st8 [r14]=r8; nop.i 0x0; br.call.sptk.many b0=$+-0xa0850;;"; let data = [0x11, 0x00, 0x20, 0x1c, 0x98, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xb8, 0xf7, 0xf5, 0x58]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -416,15 +515,15 @@ fn test_bash_tilde_expand_word() { let data = [0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0x00, 0x38, 0x30, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] nop.m 0x0; cmp.eq p7,p6=0x0,r8; (p06) br.cond.sptk.few 400000000019b4c0 <tilde_expand_word@@Base+0x3c0>"; + let expected = "[MIB] nop.m 0x0; cmp.eq p7,p6=0x0,r8; (p06) br.cond.sptk.few $+-0x180"; let data = [0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x20, 0x0c, 0x72, 0x03, 0x80, 0xfe, 0xff, 0x48]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] mov r41=r33; nop.i 0x0; br.call.sptk.many b0=4000000000026c20 <_init@@Base+0x1b00>;;"; + let expected = "[MIB] mov r41=r33; nop.i 0x0; br.call.sptk.many b0=$+-0x174a30;;"; let data = [0x11, 0x48, 0x01, 0x42, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xd8, 0xb5, 0xe8, 0x58]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] mov r1=r40; adds r41=0x1,r8; br.call.sptk.many b0=40000000000fab00 <xmalloc@@Base>;;"; + let expected = "[MIB] mov r1=r40; adds r41=0x1,r8; br.call.sptk.many b0=$+-0xa0b60;;"; let data = [0x11, 0x08, 0x00, 0x50, 0x00, 0x21, 0x90, 0x0a, 0x20, 0x00, 0x42, 0x00, 0xa8, 0xf4, 0xf5, 0x58]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -432,7 +531,7 @@ fn test_bash_tilde_expand_word() { let data = [0x08, 0x50, 0x01, 0x42, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x40, 0x01, 0x84]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MMB] mov r41=r8; nop.m 0x0; br.call.sptk.many b0=40000000000267e0 <_init@@Base+0x16c0>;;"; + let expected = "[MMB] mov r41=r8; nop.m 0x0; br.call.sptk.many b0=$+-0x174ea0;;"; let data = [0x19, 0x48, 0x01, 0x10, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x68, 0xb1, 0xe8, 0x58]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -440,11 +539,11 @@ fn test_bash_tilde_expand_word() { let data = [0x09, 0x70, 0x40, 0x18, 0x00, 0x21, 0x10, 0x00, 0xa0, 0x00, 0x42, 0x20, 0x05, 0x18, 0x01, 0x84]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] st8 [r14]=r8; nop.i 0x0; br.call.sptk.many b0=40000000000fadc0 <xfree@@Base>;;"; + let expected = "[MIB] st8 [r14]=r8; nop.i 0x0; br.call.sptk.many b0=$+-0xa08e0;;"; let data = [0x11, 0x00, 0x20, 0x1c, 0x98, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x28, 0xf7, 0xf5, 0x58]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] mov r1=r40; nop.i 0x0; br.call.sptk.many b0=4000000000027140 <_init@@Base+0x2020>;;"; + let expected = "[MIB] mov r1=r40; nop.i 0x0; br.call.sptk.many b0=$+-0x174570;;"; let data = [0x11, 0x08, 0x00, 0x50, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x98, 0xba, 0xe8, 0x58]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -452,7 +551,7 @@ fn test_bash_tilde_expand_word() { let data = [0x09, 0x70, 0x40, 0x18, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x40, 0x01, 0x84]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] ld8 r8=[r14]; nop.i 0x0; br.few 400000000019b510 <tilde_expand_word@@Base+0x410>;;"; + let expected = "[MIB] ld8 r8=[r14]; nop.i 0x0; br.few $+-0x1c0;;"; let data = [0x11, 0x40, 0x00, 0x1c, 0x18, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x40, 0xfe, 0xff, 0x48]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -750,11 +849,11 @@ fn test_bash_rl_insert_close() { let data = [0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x40, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MMI] setf.sig f7=r14; nop.m 0x0; and r8=63,r8;;"; + let expected = "[MMI] setf.sig f7=r14; nop.m 0x0; and r8=0x3f,r8;;"; let data = [0x09, 0x38, 0x38, 0x00, 0xe1, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xf1, 0x43, 0xb0, 0x80]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MII] setf.sig f6=r16; shr r19=r16,63; sub r17=r8,r17;;"; + let expected = "[MII] setf.sig f6=r16; shr r19=r16,0x3f; sub r17=r8,r17;;"; let data = [0x01, 0x30, 0x40, 0x00, 0xe1, 0x18, 0x30, 0xf9, 0x43, 0x00, 0x29, 0x20, 0x82, 0x88, 0x14, 0x80]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -770,11 +869,11 @@ fn test_bash_rl_insert_close() { let data = [0x0b, 0x00, 0x98, 0x48, 0x98, 0x11, 0xe0, 0x30, 0x00, 0xc2, 0x21, 0x00, 0x00, 0x00, 0x04, 0x00]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MII] nop.m 0x0; shr r14=r14,18;; sub r14=r14,r19;;"; + let expected = "[MII] nop.m 0x0; shr r14=r14,0x12;; sub r14=r14,r19;;"; let data = [0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0xe0, 0x28, 0x39, 0x5a, 0x29, 0xc0, 0xe1, 0x98, 0x14, 0x80]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MII] nop.m 0x0; shl r17=r14,5; sxt4 r19=r14;;"; + let expected = "[MII] nop.m 0x0; shl r17=r14,0x5; sxt4 r19=r14;;"; let data = [0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x71, 0xe8, 0xf4, 0x29, 0x60, 0x02, 0x70, 0x58, 0x00]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -782,11 +881,11 @@ fn test_bash_rl_insert_close() { let data = [0x09, 0x88, 0x44, 0x1c, 0x05, 0x20, 0x80, 0x98, 0x3c, 0x30, 0x2b, 0x00, 0x00, 0x00, 0x04, 0x00]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MII] nop.m 0x0; shl r19=r17,6;; sub r17=r19,r17;;"; + let expected = "[MII] nop.m 0x0; shl r19=r17,0x6;; sub r17=r19,r17;;"; let data = [0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x30, 0x89, 0xe4, 0xf2, 0x29, 0x20, 0x32, 0x89, 0x14, 0x80]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MMI] shladd r14=r17,3,r14;; nop.m 0x0; shl r14=r14,6;;"; + let expected = "[MMI] shladd r14=r17,0x3,r14;; nop.m 0x0; shl r14=r14,0x6;;"; let data = [0x0b, 0x70, 0x44, 0x1c, 0x12, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0xc0, 0xe1, 0xc8, 0xe5, 0x53]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -810,7 +909,7 @@ fn test_bash_rl_insert_close() { let data = [0x09, 0x88, 0x01, 0x00, 0x00, 0x21, 0x20, 0x03, 0x00, 0x00, 0x42, 0x60, 0x06, 0x61, 0x00, 0x84]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] nop.m 0x0; nop.i 0x0; br.call.sptk.many b0=4000000000026360 <_init@@Base+0x1240>;;"; + let expected = "[MIB] nop.m 0x0; nop.i 0x0; br.call.sptk.many b0=$+-0x175fa0;;"; let data = [0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x68, 0xa0, 0xe8, 0x58]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); @@ -830,11 +929,11 @@ fn test_bash_rl_insert_close() { let data = [0x18, 0x60, 0x40, 0x18, 0x01, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x80, 0x08, 0x00, 0x84, 0x00]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] nop.m 0x0; mov r42=40; br.few 400000000019bf60 <rl_insert_close@@Base+0x1a0>;;"; + let expected = "[MIB] nop.m 0x0; mov r42=0x28; br.few $+-0x3f0;;"; let data = [0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0xa0, 0x42, 0x01, 0x00, 0x48, 0x00, 0x10, 0xfc, 0xff, 0x48]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); - let expected = "[MIB] nop.m 0x0; mov r42=91; br.few 400000000019bf60 <rl_insert_close@@Base+0x1a0>;;"; + let expected = "[MIB] nop.m 0x0; mov r42=0x5b; br.few $+-0x400;;"; let data = [0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0xa0, 0xda, 0x02, 0x00, 0x48, 0x00, 0x00, 0xfc, 0xff, 0x48]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); |