Skip to content

riscv: fix mstatus/sstatus helpers and field mask#396

Merged
romancardenas merged 1 commit intorust-embedded:masterfrom
elliott10:master
Apr 21, 2026
Merged

riscv: fix mstatus/sstatus helpers and field mask#396
romancardenas merged 1 commit intorust-embedded:masterfrom
elliott10:master

Conversation

@elliott10
Copy link
Copy Markdown
Contributor

riscv: complete mstatus and sstatus status helpers

Align the mstatus and sstatus helpers with the privileged spec.

  • add missing base-field helpers for UBE, VS, UXL and SXL/SBE/MBE where applicable
  • model XS and SD as read-only summary fields instead of writable fields
  • keep set_uie/set_upie as compatibility helpers for legacy N-extension users
  • fix the CSR masks to preserve all legal status bits
  • update tests to cover the new helpers and read-only field behavior

@elliott10 elliott10 requested a review from a team as a code owner April 15, 2026 13:38
@romancardenas
Copy link
Copy Markdown
Contributor

I will need some time to review this PR. Can you share with me the link to the ISA specification you used for these modifications? I usually use this: https://docs.riscv.org/reference/isa/_attachments/riscv-privileged.pdf

There is a new release (from February) and looks like there is a few more fields

@elliott10
Copy link
Copy Markdown
Contributor Author

I will need some time to review this PR. Can you share with me the link to the ISA specification you used for these modifications? I usually use this: https://docs.riscv.org/reference/isa/_attachments/riscv-privileged.pdf

There is a new release (from February) and looks like there is a few more fields

I referred to this ISA Spec: https://docs.riscv.org/reference/isa/priv/supervisor.html#sstatus

If there is anything I have missed, I am willing to keep improving it :)

Copy link
Copy Markdown
Contributor

@romancardenas romancardenas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!! Please, address the changes in CHANGELOG.md and the minor docs formatting comment.

Comment thread riscv/src/register/mstatus.rs Outdated
Comment thread riscv/CHANGELOG.md Outdated
@romancardenas romancardenas self-requested a review April 17, 2026 14:44
Copy link
Copy Markdown
Contributor

@romancardenas romancardenas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I approved the PR by mistake. Address the changes before merging

@elliott10
Copy link
Copy Markdown
Contributor Author

Sorry, I approved the PR by mistake. Address the changes before merging

Ok, I've made the changes.
And, I have merged all the modifications into one commit.

Copy link
Copy Markdown
Contributor

@romancardenas romancardenas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@elliott10 elliott10 requested a review from romancardenas April 21, 2026 10:02
@romancardenas romancardenas added this pull request to the merge queue Apr 21, 2026
Merged via the queue into rust-embedded:master with commit 8b66000 Apr 21, 2026
165 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants