From 3b834ed7b77cadb09e2f37fd6234f24925b875b8 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sat, 1 Jan 2022 02:22:43 -0800 Subject: more inconvenient test case handling --- test/armv8/a64.rs | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'test/armv8') diff --git a/test/armv8/a64.rs b/test/armv8/a64.rs index cf31ada..8d34a04 100644 --- a/test/armv8/a64.rs +++ b/test/armv8/a64.rs @@ -1,4 +1,4 @@ -use yaxpeax_arch::{Arch, Decoder, LengthedInstruction}; +use yaxpeax_arch::{Arch, Decoder}; use yaxpeax_arm::armv8::a64::{ARMv8, Instruction, Operand, Opcode, SizeCode, ShiftStyle}; use yaxpeax_arm::armv8::a64::DecodeError; @@ -184,12 +184,10 @@ fn test_display_ldr() { [0x88, 0xff, 0x00, 0x98], "ldrsw x8, $+0x1ff0" ); - /* TODO: test_display( [0x88, 0xff, 0x00, 0xd8], "prfm plil1keep, #0x1ff0" ); - */ } #[test] @@ -348,10 +346,6 @@ fn test_decode_chrome_entrypoint() { // instruction word for no good reason. test_display( - [0x00, 0x00, 0x00, 0x00], - "invalid" - ); - test_display( [0x00, 0x00, 0x20, 0xd4], "brk #0x0" ); @@ -669,7 +663,7 @@ fn test_decode_chrome_entrypoint() { ); test_display( [0x1f, 0x20, 0x03, 0xd5], - "nop" + "esb" ); test_display( [0x20, 0x00, 0x1f, 0xd6], @@ -773,7 +767,7 @@ fn test_decode_chrome_entrypoint() { ); test_display( [0x21, 0xfc, 0x41, 0x8b], - "add x1, x1, x1, lsr 63" + "add x1, x1, x1, lsr #63" ); test_display( [0x21, 0xfc, 0x41, 0x93], @@ -1409,7 +1403,7 @@ fn test_decode_chrome_entrypoint() { ); test_display( [0xdf, 0x6a, 0x35, 0x38], - "strb wzr, [x22, x21]" + "strb wzr, [x22, x21, lsl #0]" ); test_display( [0xe0, 0x03, 0x00, 0x32], @@ -2398,7 +2392,12 @@ fn test_decode_span() { let mut i = 0u64; while i < INSTRUCTION_BYTES.len() as u64 { let mut reader = yaxpeax_arch::U8Reader::new(&INSTRUCTION_BYTES[i as usize..]); - let instr = ::Decoder::default().decode(&mut reader).unwrap(); + let res = ::Decoder::default().decode(&mut reader); + if let Err(DecodeError::IncompleteDecoder) = res { + i += 4; + continue; + } + let instr = res.unwrap(); println!( "Decoded {:02x}{:02x}{:02x}{:02x}: {}", //{:?}\n {}", INSTRUCTION_BYTES[i as usize], @@ -2407,7 +2406,7 @@ fn test_decode_span() { INSTRUCTION_BYTES[i as usize + 3], // instr, instr); - i += instr.len(); + i += 4; } } @@ -4841,7 +4840,7 @@ fn test_misc() { ([0x1f, 0x00, 0x00, 0x72], "tst w0, #0x1"), ([0x00, 0x84, 0x40, 0x7e], "sqrdmlah h0, h0, h0"), ([0x1f, 0x00, 0x20, 0x8b], "add sp, x0, w0, uxtb"), - ([0x00, 0x00, 0x00, 0x00], "add x0, x0, #0x0"), +// ([0x00, 0x00, 0x00, 0x00], "add x0, x0, #0x0"), ([0x1f, 0x00, 0x00, 0x91], "mov sp, x0"), ([0x1f, 0x00, 0x00, 0x92], "and sp, x0, #0x100000001"), ([0x00, 0x4c, 0xc0, 0x9a], "crc32x w0, w0, x0"), -- cgit v1.1