Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [rtl] core trap fixes #450

Merged
merged 8 commits into from
Dec 8, 2022
Merged

🐛 [rtl] core trap fixes #450

merged 8 commits into from
Dec 8, 2022

Conversation

stnolting
Copy link
Owner

@stnolting stnolting commented Dec 8, 2022

  • Fix a bug in the core's interrupt system: when in user-mode, interrupts are globally enabled even if mstatus.mie is cleared. Quote from the RISC-V privilege specification:

When a hart is executing in privilege mode x, interrupts are globally enabled when xIE=1 and
globally disabled when xIE=0. Interrupts for lower-privilege modes, w<x, are always globally
disabled regardless of the setting of any global wIE bit for the lower-privilege mode. Interrupts for
higher-privilege modes, y>x, are always globally enabled regardless of the setting of the global yIE
bit for the higher-privilege mode.
Higher-privilege-level code can use separate per-interrupt enable
bits to disable selected higher-privilege-mode interrupts before ceding control to a lower-privilege
mode.

  • The illegal instruction check for CFU (custom functions unit) is changed: instructions targeting the CFU (using custom-0 or custom-1 opcodes) are not checked for illegal registers when the E ISA extension is enabled (registers above x15).

  • Rework the handling of the hardware-based mstatus.mie/mstatus.mpie, mstatus.mprv and privilege stacks.

@stnolting stnolting added bug Something isn't working risc-v compliance Modification to comply with official RISC-V specs. HW hardware-related labels Dec 8, 2022
@stnolting stnolting self-assigned this Dec 8, 2022
* always enable interrupts when in user-mode
* remove register checking (above x15) for custom CFU instructions
* rework core' interrupt-enable and privilege hardware stacks
@stnolting stnolting marked this pull request as ready for review December 8, 2022 17:30
@stnolting stnolting merged commit 2a02933 into main Dec 8, 2022
@stnolting stnolting deleted the core_trap_fixes branch December 8, 2022 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working HW hardware-related risc-v compliance Modification to comply with official RISC-V specs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant