-
Notifications
You must be signed in to change notification settings - Fork 166
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
Fix delegated interrupt handling #613
base: master
Are you sure you want to change the base?
Conversation
When the N extension was removed this code was accidentally broken because it doesn't respect mie for delegated interrupts any more. The `internal_error`s should be unreachable, at least for the sequential output. I believe formal backends may decide `mideleg` is going to be non-zero even without S, but I think that was an existing issue.
Ints_Delegated(d) => { | ||
if not(extensionEnabled(Ext_S)) then { | ||
// Can't delegate to user mode. This code is unreachable because | ||
// `mideleg.bits` is 0 without supervisor mode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the CSR doesn't exist so can't be written to by software and thus the Sail register remains its initial 0 value. The comment written here suggests that the CSR exists and is hardwired to 0 (which was the case in early specs).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Sail register mideleg
always exists. That's what I was referring to. Not sure how to make that clearer...
@KotorinMinami does this look right to you? |
So I think we might need to reflect this in the implementation of the sail's mideleg register, maybe this is the way to solve delegated interrupt handling? Moreover, based on what is said in spec, we can handle whether medeleg and mideleg exist and the delegated issues by checking misa
|
This is handled by |
When the N extension was removed this code was accidentally broken because it doesn't respect mie for delegated interrupts any more.
The
internal_error
s should be unreachable, at least for the sequential output. I believe formal backends may decidemideleg
is going to be non-zero even without S, but I think that was an existing issue.