diff options
author | iximeow <me@iximeow.net> | 2022-01-01 02:22:43 -0800 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2022-01-01 02:22:43 -0800 |
commit | 3b834ed7b77cadb09e2f37fd6234f24925b875b8 (patch) | |
tree | 038808bb976ad5102f3cbe93ad10597c615cf9d7 /test/armv8/a64.rs | |
parent | eb867d51ed8ad3b45d710f4ae3eb2fbb52605cb6 (diff) |
more inconvenient test case handling
Diffstat (limited to 'test/armv8/a64.rs')
-rw-r--r-- | test/armv8/a64.rs | 25 |
1 files changed, 12 insertions, 13 deletions
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 = <ARMv8 as Arch>::Decoder::default().decode(&mut reader).unwrap(); + let res = <ARMv8 as Arch>::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"), |