From 78764919783e828988391eeda9840bf7a354d36b Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 11 Oct 2020 22:40:22 -0700 Subject: get more operand encodings in place, square away tests shl/shr pseudo-ops were annoying, now they're fixed --- tests/test.rs | 265 ++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 182 insertions(+), 83 deletions(-) (limited to 'tests') 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 ;;"; + 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 ;;"; + 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 "; + 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 ;;"; + 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 ;;"; + 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 ;;"; + 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 ;;"; + 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 ;;"; + 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 ;;"; + 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 ;;"; + 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 ;;"; + 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 ;;"; + 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 ;;"; + 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 ;;"; + 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 ;;"; + 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 "; + 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 ;;"; + 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 ;;"; + 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 ;;"; + 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 ;;"; + 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 ;;"; + 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); -- cgit v1.1