diff options
| -rw-r--r-- | CHANGELOG | 1 | ||||
| -rw-r--r-- | src/armv7/thumb.rs | 2 | ||||
| -rw-r--r-- | tests/armv7/thumb.rs | 12 |
3 files changed, 14 insertions, 1 deletions
@@ -11,6 +11,7 @@ * the decoder reused the non-thumb encoding table, but thumb opcode/sizes are encoded in a different order. * thumb2: `ldrexd` was off by one in looking up an opcode +* thumb2: pkhtb/pkhbt distinction was off by one bit * thumb2: `mrs` destinations, which should have been a mask of the current (or saved) program status register, was reported as a banked GPR. * ARMv8: support thumb2 encoding of `Test Target` instruction, `Opcode::TT` diff --git a/src/armv7/thumb.rs b/src/armv7/thumb.rs index 72a2ea6..439c3a6 100644 --- a/src/armv7/thumb.rs +++ b/src/armv7/thumb.rs @@ -1013,7 +1013,7 @@ pub fn decode_into<T: Reader<<ARMv7 as Arch>::Address, <ARMv7 as Arch>::Word>>(d // TODO: fix shift // TODO: check opcode inst.s = false; - inst.opcode = if lower & 0b10000 != 0 { + inst.opcode = if lower & 0b100000 != 0 { Opcode::PKHTB } else { Opcode::PKHBT diff --git a/tests/armv7/thumb.rs b/tests/armv7/thumb.rs index b1b9399..e6e1bfb 100644 --- a/tests/armv7/thumb.rs +++ b/tests/armv7/thumb.rs @@ -4573,6 +4573,18 @@ fn msr_mrs() { } #[test] +fn pkh() { + test_display( + &[0xc7, 0xea, 0xe8, 0x77], + "pkhtb.w r7, r7, r8, asr 31" + ); + test_display( + &[0xc7, 0xea, 0xc8, 0x77], + "pkhbt.w r7, r7, r8, lsl 31" + ); +} + +#[test] fn test_target() { // the v8 manuals list a new Test Target with some variants to it.. test_nonconforming( |
