Skip to content

harm: Unprivileged load and store instructions#61

Merged
monoid merged 1 commit into
masterfrom
feat/unprivileged
Jul 11, 2026
Merged

harm: Unprivileged load and store instructions#61
monoid merged 1 commit into
masterfrom
feat/unprivileged

Conversation

@monoid

@monoid monoid commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Add the unprivileged (translated) load/store variants: LDTR, LDTRB, LDTRH, LDTRSB, LDTRSH, LDTRSW, STTR, STTRB, STTRH, each in its own module.

Summary by CodeRabbit

  • New Features

    • Added support for AArch64 unprivileged load instructions: LDTR, LDTRB, LDTRH, LDTRSB, LDTRSH, and LDTRSW.
    • Added support for unprivileged store instructions: STTR, STTRB, and STTRH.
    • Added constructors and operand accessors for the new instructions.
    • Improved encoding support for unscaled immediate-offset load/store instructions.
  • Tests

    • Added comprehensive encoding and assembly-format tests, including register, stack-pointer, boundary-offset, and invalid-offset cases.

Add the unprivileged (translated) load/store variants:
`LDTR`, `LDTRB`, `LDTRH`, `LDTRSB`, `LDTRSH`, `LDTRSW`,
`STTR`, `STTRB`, `STTRH`, each in its own module.
@monoid monoid self-assigned this Jul 11, 2026
@monoid monoid added enhancement New feature or request harm The `harm` dynamic assembler labels Jul 11, 2026
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 13109426-c98c-4229-9b95-b577045034c1

📥 Commits

Reviewing files that changed from the base of the PR and between cbca1ea and 51ec936.

📒 Files selected for processing (21)
  • harm/src/instructions/ldst.rs
  • harm/src/instructions/ldst/ldur.rs
  • harm/src/instructions/ldst/ldurb.rs
  • harm/src/instructions/ldst/ldurh.rs
  • harm/src/instructions/ldst/ldursb.rs
  • harm/src/instructions/ldst/ldursh.rs
  • harm/src/instructions/ldst/ldursw.rs
  • harm/src/instructions/ldst/macros.rs
  • harm/src/instructions/ldst/stur.rs
  • harm/src/instructions/ldst/sturb.rs
  • harm/src/instructions/ldst/sturh.rs
  • harm/src/instructions/ldst/unprivileged.rs
  • harm/src/instructions/ldst/unprivileged/ldtr.rs
  • harm/src/instructions/ldst/unprivileged/ldtrb.rs
  • harm/src/instructions/ldst/unprivileged/ldtrh.rs
  • harm/src/instructions/ldst/unprivileged/ldtrsb.rs
  • harm/src/instructions/ldst/unprivileged/ldtrsh.rs
  • harm/src/instructions/ldst/unprivileged/ldtrsw.rs
  • harm/src/instructions/ldst/unprivileged/sttr.rs
  • harm/src/instructions/ldst/unprivileged/sttrb.rs
  • harm/src/instructions/ldst/unprivileged/sttrh.rs

📝 Walkthrough

Walkthrough

The change parameterizes unscaled-offset mnemonic generation, updates existing LDUR/STUR definitions, and adds publicly re-exported unprivileged LDTR and STTR instruction modules with generic constructors and encoding tests.

Changes

Unprivileged load/store instructions

Layer / File(s) Summary
Parameterize unscaled-offset mnemonic suffixes
harm/src/instructions/ldst/macros.rs, harm/src/instructions/ldst/ldur*.rs, harm/src/instructions/ldst/stur*.rs
The shared macro now accepts a suffix, and existing unscaled load/store definitions pass ldst_unscaled.
Register unprivileged instruction modules
harm/src/instructions/ldst.rs, harm/src/instructions/ldst/unprivileged.rs
The unprivileged module is declared, its child instruction modules are re-exported, and UnscaledOffset is imported for child modules.
Implement unprivileged loads
harm/src/instructions/ldst/unprivileged/ldtr*.rs
LDTR variants add generic instruction types, accessors, sealed construction traits, public helpers, encoding rules, and instruction tests.
Implement unprivileged stores
harm/src/instructions/ldst/unprivileged/sttr*.rs
STTR variants add generic instruction types, accessors, sealed construction traits, public helpers, encoding rules, and assembly or encoding tests.

Estimated code review effort: 4 (Complex) | ~45 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding unprivileged load and store instructions to harm.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/unprivileged

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@monoid
monoid merged commit 302ead5 into master Jul 11, 2026
2 checks passed
@monoid
monoid deleted the feat/unprivileged branch July 11, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request harm The `harm` dynamic assembler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant