From 189cbcfdad097363e66f41daf4d6a76acbf3661c Mon Sep 17 00:00:00 2001 From: Mitchell Johnson Date: Sun, 4 Sep 2022 17:33:39 -0400 Subject: Fix 32-bit Thumb unconditional branch decoding T4 encodings of unconditional branches were not being interpreted correctly (#6), and 32-bit bl/blx instructions were similarly incorrect. Correct the bits selected for op1 and op2 and handle the slightly-unusual i1/i2 sign bit xor for these instructions. --- tests/armv7/thumb.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/armv7/thumb.rs') diff --git a/tests/armv7/thumb.rs b/tests/armv7/thumb.rs index 9182f6e..be5434f 100644 --- a/tests/armv7/thumb.rs +++ b/tests/armv7/thumb.rs @@ -723,6 +723,19 @@ fn test_decode_bcc_cases() { ); } #[test] +fn test_decode_32b_branch_cases() { + // encoding t4 + test_display( + &[0xf3, 0xf7, 0x7c, 0xbe], + "b.w $-0xc308" + ); + // encoding t4 + test_display( + &[0x0c, 0xf0, 0x84, 0xb9], + "b.w $+0xc308" + ); +} +#[test] fn test_decode_bkpt_cases() { test_display( &[0x00, 0xbe], -- cgit v1.1