Skip to content

Add xCAUSE interrupt and exception code field masks - #427

Merged
Andrew Waterman (aswaterman) merged 2 commits into
riscv:masterfrom
pulp-platform:add-mcause-scause-ucause-masks
Jul 30, 2026
Merged

Add xCAUSE interrupt and exception code field masks#427
Andrew Waterman (aswaterman) merged 2 commits into
riscv:masterfrom
pulp-platform:add-mcause-scause-ucause-masks

Conversation

@colluca

@colluca Luca Colagrande (colluca) commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds MCAUSE32/64_INT and MCAUSE32/64_EXCCODE masks for the mcause Interrupt and Exception Code fields, per the RISC-V privileged spec.
  • Adds XLEN-generic MCAUSE_INT/MCAUSE_EXCCODE aliases in the __riscv_xlen selection block, following the same pattern already used for MSTATUS_SD and SATP_MODE.
  • Adds SCAUSE_*/UCAUSE_* equivalents, since scause/ucause share the identical bit layout as mcause.

Define MCAUSE32/64_INT and MCAUSE32/64_EXCCODE for the Interrupt and
Exception Code fields of mcause, plus XLEN-generic aliases in the
__riscv_xlen selection block, following the same pattern used for
MSTATUS_SD and SATP_MODE. scause and ucause share the identical bit
layout per the privileged spec, so SCAUSE_* and UCAUSE_* are defined
as aliases of the MCAUSE_* masks.
@colluca Luca Colagrande (colluca) changed the title Add MCAUSE/SCAUSE/UCAUSE Interrupt and Exception Code field masks Add xCAUSE interrupt and exception code field masks Jul 29, 2026
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.78%. Comparing base (4644ba3) to head (c4958b5).
⚠️ Report is 18 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #427      +/-   ##
==========================================
- Coverage   97.08%   96.78%   -0.30%     
==========================================
  Files          14       14              
  Lines         926      933       +7     
==========================================
+ Hits          899      903       +4     
- Misses         27       30       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is no ucause CSR, so we should remove those macros, but the rest of this LGTM.

There is no ucause CSR in the privileged spec, so the UCAUSE32/64_INT
and UCAUSE32/64_EXCCODE masks (and the UCAUSE_INT/UCAUSE_EXCCODE
xlen-generic aliases) don't apply.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@colluca

Copy link
Copy Markdown
Contributor Author

Thank you for the prompt review.

There is no ucause CSR, so we should remove those macros, but the rest of this LGTM.

Good point, I fixed that now.

@aswaterman
Andrew Waterman (aswaterman) merged commit 62a06d2 into riscv:master Jul 30, 2026
11 of 12 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