AArch32: STR/STRT had missing offset when rt/rd is PC #6588
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
STR
andSTRT
instructions for AArch32 (ARM:LE:32:v8
).According to the manual,
STR (immediate)
: Calculates an address from a base register value and an immediate offset, and stores a word from a register to memory.STRT
: Store Register Unprivileged stores a word from a register to memory.However, we noticed the output was incorrect when rd/rt is PC.
e.g, for AArch32 with,
Instruction:
0xffff0ed4, strle pc,[lr],#-0xfff
initial_registers:
{ "lr": 0x1ad1f844, "pc": 0x10000000, "NG": 0x1, "OV": 0x0 }
We get:
Hardware:
{ "lr": 0x1ad1e845, 0x1AD1F844: 0x8, 0x1AD1F845: 0x0, 0x1AD1F846: 0x0, 0x1AD1F847: 0x10 }
Patched Spec:
{ "lr": 0x1ad1e845, 0x1AD1F844: 0x8, 0x1AD1F845: 0x0, 0x1AD1F846: 0x0, 0x1AD1F847: 0x10 }
Existing Spec:
{ "lr": 0x1ad1e845, 0x1AD1F844: 0x0, 0x1AD1F845: 0x0, 0x1AD1F846: 0x0, 0x1AD1F847: 0x10 }
and,
Instruction:
0xffff2ed4, strtle pc,[lr],#-0xfff
initial_registers:
{ "lr": 0x4122325b, "pc": 0x10000000, "NG": 0x1, "OV": 0x0 }
We get:
Hardware:
{ "lr": 0x4122225c, 0x4122325B: 0x8, 0x4122325C: 0x0, 0x4122325D: 0x0, 0x4122325E: 0x10 }
Patched Spec:
{ "lr": 0x4122225c, 0x4122325B: 0x8, 0x4122325C: 0x0, 0x4122325D: 0x0, 0x4122325E: 0x10 }
Existing Spec:
{ "lr": 0x4122225c, 0x4122325B: 0x0, 0x4122325C: 0x0, 0x4122325D: 0x0, 0x4122325E: 0x10 }
In Thumb mode (
ARM:LE:32:v8T
), if rd/rt is PC, it results inUNPREDICTABLE
behaviour and so is the case for other variants likeSTRB
. However, in the cases above this is permissible.Note: The patched spec does not introduce any disassembly changes to the best of our knowledge.