Repository navigation
[AUTOMATED] Write the Thumb stmia base back when the base is in the list - #1901
Merged
Merged
Conversation
The 16-bit Thumb stmia used ldmia's writeback rule, which skips the
writeback when Rn is in the register list. STM (T1) always adds
4 * BitCount to the base, so after `stmia r0!,{r0,r1}` kuna kept r0 at its
entry value and a function returning it printed as void. stmia now always
writes back and disassembles with the `!`; ldmia is unchanged.
Found by comparing kuna's lift with Unicorn instruction by instruction on
Cortex-M firmware: all seven stmia forms with the base in the list differed
on the base register and now match. The ARM8_le compiler-oracle digest is
regenerated with slacomp, which reproduces the old digest on the old sources.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
sjkim1127
force-pushed
the
fix/thumb-stmia-writeback
branch
from
November 23, 2026 11:23
0f4f8c8 to
f0ebfb5
Compare
docs/baseline-stages.json synthesized: main's 5152 + this PR's 4 = 5156. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
The architecture defines the stored base only when it is the lowest listed register and leaves it UNKNOWN otherwise; the lift stores the entry value, which is what QEMU stores. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
Contributor
|
[AUTOMATED] Pushed two commits on top of f0ebfb5:
The SLEIGH change itself is unchanged. |
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b # Conflicts: # decompiler/crates/kuna-base/src/xml.rs
Merged
15 of 35 tasks
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.
[AUTOMATED]
On Thumb, kuna treats
stmia rN!,{...}as leavingrNunchanged whenrNis in the register list. The instruction always adds 4 bytes per register to the base, so a function that returns the base after the store loses its result.stmiagets its own body that always writes back, so the function above now ends inreturn (int)a0 + 8;. It disassembles asstmia r0!,{r0,r1}, which is the only form the T1 encoding has.ldmiakeeps the shared rule that skips the writeback when the base is loaded, which is the architecture's rule for loads.slacompreproduces the old digest on the old sources.tests/stages/kuna-thumb-stmia-writeback.xmlhas a function with the base in the list and one without it. 3 of its 4 assertions fail without the fix. Compared one instruction at a time against Unicorn over Cortex-M firmware, all 7stmiaforms with the base in the list differed on the base register and now match. The datatest corpus is unchanged, and decompiling that 6 MB firmware takes the same time.🤖 Generated with Claude Code
Model:
anthropic/claude-opus-5-5