Repository navigation
jit: implement LDR pre-/post-index writeback and scale imm12 by access size - #110
Open
bluetoe-99 wants to merge 3 commits into
Open
bluetoe-99 wants to merge 3 commits into
bluetoe-99 wants to merge 3 commits into
Conversation
bluetoe-99
force-pushed
the
feature/tier1-ldr-prepost-index
branch
2 times, most recently
from
October 29, 2026 19:21
4900c88 to
877a93a
Compare
translate_ldr ignored the addressing-mode bits: every immediate-offset load executed as a plain load with no base update, and the unsigned imm12 offset was scaled by the destination width instead of the access size. Imm9 group: imm9 is sign-extended and unscaled; post-index loads at the base address and pre-index at base + imm9, both updating Rn = base + imm9. LDRAA/LDRAB scale the offset by 8 and update Rn only in the pre-index form (pointer authentication is still not applied). Imm12 group: scale by the access size from bits 31-30 (1/2/4/8). The Rn update is computed into a scratch register from the original base before the Rt store and applied after it, so Rt == Rn resolves to the updated base, matching the reference engine's choice for this CONSTRAINED UNPREDICTABLE case. Register-offset entries keep their existing lowering; that group's Rm modelling is a separate issue. Signed-off-by: bluetoe-99 <102478736+bluetoe-99@users.noreply.github.com>
Sixteen tests cover Rt == Rn in both pre- and post-index form, LDRAA/LDRAB with and without writeback, and imm12 byte, halfword and word scaling. Every form runs with distinct non-zero base and destination registers and a sentinel destination, so the writeback value and the loaded value can never coincide by accident. Signed-off-by: bluetoe-99 <102478736+bluetoe-99@users.noreply.github.com>
The driver checked Ballistic's status before the oracle's, so seeds where both engines fault (e.g. a read ending past the guest page) were counted as Ballistic errors even though the reference oracle refused to run them. Checking the oracle first makes the skip symmetric with the existing unknown-instruction rule. Signed-off-by: bluetoe-99 <102478736+bluetoe-99@users.noreply.github.com>
bluetoe-99
force-pushed
the
feature/tier1-ldr-prepost-index
branch
from
October 29, 2026 19:46
877a93a to
38a2bc3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
translate_ldrignored the addressing-mode bits: every immediate-offset load ran as a plain load with no base update, and the unsigned offset was scaled by the destination width instead of the access size.Now:
fuzzer: skip seeds the oracle cannot execute before counting Ballistic errors
The driver checked Ballistic's status before the oracle's. Seeds where both engines fault (e.g. reads ending past the guest page) were counted as errors even though the oracle refused to run them. Checking the oracle first makes the skip symmetric with the existing unknown-instruction rule.
tests
16 unit tests (Rt==Rn pre/post, LDRAA/LDRAB pre/post, imm12 byte/halfword/word scaling). Each form runs with distinct non-zero base and destination registers and a sentinel destination, so the writeback value and the loaded value can never accidentally come out equal.
Fuzz (full 60389-seed corpus, same seeds.bin for both runs):
de07fcaa: 465 passed | 38 failed | 28171 skipped | 6 errorsEvery mismatch seed this branch reports was replayed through main's build: all 26 failures and all 5 non-baseline error seeds fail identically on unmodified main (they sit after the driver's 6-error stop in main's run). All 16 unique mismatch seeds main reports are fixed; 1 of main's 6 errors is fixed (395FFC00) and 4 become oracle skips. No seed that main passes is newly failing or newly erroring. The remaining 397FFC00 error:
guest_readhas no size argument and always reads 8 bytes, follow-up.