aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMitchell Johnson <ehntoo@ehntoo.org>2022-09-04 17:33:39 -0400
committeriximeow <git@iximeow.net>2022-09-29 15:50:31 -0700
commit189cbcfdad097363e66f41daf4d6a76acbf3661c (patch)
tree9bc36b467dad5344b53e4b683d9d57ab81b2850d /tests
parentd9765358159886ce3be0031e409dec9443ea7e17 (diff)
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/armv7/thumb.rs13
1 files changed, 13 insertions, 0 deletions
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],