fix(cpu): decode wide extend-and-add (UXTAH/UXTAB/SXTAH/SXTAB)#331
Merged
Conversation
Follow-up to the wide register-extend decode: that change only handled the
plain extends (Rn=0xF). The extend-and-add variants {S,U}XTA{B,H}.W
(Rn != 0xF, e.g. UXTAH = 0xFA1n) still fell through to Unknown32 and were
skipped, leaving the destination register stale.
clang emits `uxtah r6, r3, r0` (FA13 F680) for `4 + (val & 0xFFFF)` — a udslib
RequestFileTransfer (0x38) handler uses exactly this for its `4 + path_len`
length check. With the insn skipped, r6 kept a stale value and the check
wrongly rejected valid requests (NRC 0x13). Broadens the decode to the whole
extend family and adds Rn to the executor (add Rn when Rn != 0xF). Adds a
UXTAH regression case; full labwired-core lib suite green (1342).
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.
Summary
Follow-up to the wide register-extend decode. That change covered only the
plain extends (
{S,U}XT{B,H}.W,Rn=0xF). The extend-and-add variants{S,U}XTA{B,H}.W(Rn != 0xF, e.g.UXTAH=0xFA1n) still fell through toUnknown32and were silently skipped, leaving the destination register stale.clang emits
uxtah r6, r3, r0(FA13 F680) for4 + (val & 0xFFFF). A udslibRequestFileTransfer(0x38) handler uses exactly this for its4 + path_lenlength check — with the instruction skipped,
r6kept a stale value and thecheck wrongly rejected valid requests (NRC
0x13). (A debugprintf"fixed"it by perturbing register allocation — the tell that this was an emulator
instruction gap, not firmware.)
Fix
Broaden the wide-extend decode to the whole family (
0xFA00..0xFA5F), captureRn, and in the executor addRnwhenRn != 0xF(the extend-and-add form).Test
Adds a
UXTAHcase (extend-and-add with a stale-register overwrite check) tothe wide-extend regression test. Full
labwired-corelib suite green (1399).