AArch32: ldrexd addr src register aliased as first dest register causing second word load at the value of first load #6590
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
ldrexd
instruction for AArch32 (ARM:LE:32:v8
).According to the manual, the expected behaviour is to derive an address from a base register value, load a 64-bit doubleword from memory and write it to two registers. However, when the source register and the first destination register are aliased, it causes the second word to load at an incorrect address, i.e, the value retrieved from the first load.
e.g, for AArch32 with,
Instruction:
0x9f0fb0b1, ldrexdlt r0,r1,[r0]
initial_memory:
{ "0x9C631430": [ 0x44, 0x4e, 0x44, 0x96, 0x6c, 0x6b, 0x3a, 0x5e ] }
initial_registers:
{ "r0": 0x9c631430, "NG": 0x1, "OV": 0x0 }
We get:
Hardware:
{ "r0": 0x96444e44, "r1": 0x5e3a6b6c }
Patched Spec:
{ "r0": 0x96444e44, "r1": 0x5e3a6b6c }
Existing Spec:
{ "r0": 0x96444e44, "r1": 0x75fbb439 }
However, existing Thumb mode (
ARM:LE:32:v8T
) semantics are correct.Note: The patched spec does not introduce any disassembly changes to the best of our knowledge.