AArch32: (Thumb32) BranchWritePC does not clear bit-0 #6545
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As part of a research project testing the accuracy of the SLEIGH specifications compared to real hardware, we observed an unexpected behaviour in the
add
&mov
instruction topc
for Thumb (ARM:LE:32:v8T
).According to the manual, BranchWritePC in Thumb clears bit-0 to 0. However, we noticed the output was incorrect.
e.g, for Thumb with,
Instruction:
0xc746, mov pc,r8
initial_registers:
{ "r8": 0x5165fa67 }
We get:
Hardware:
{ "pc": 0x5165fa66 }
Patched Spec:
{ "pc": 0x5165fa66 }
Existing Spec:
{ "pc": 0x5165fa67 }
and,
Instruction:
0xc744, add pc,r8
initial_registers:
{ "r8": 0x42728a67, "pc": 0x10000000 }
We get:
Hardware:
{ "pc": 0x52728a6a }
Patched Spec:
{ "pc": 0x52728a6a }
Existing Spec:
{ "pc": 0x52728a6b }
Note: The patched spec does not introduce any disassembly changes to the best of our knowledge.