1
\$\begingroup\$

I'm working on implementing the privileged RISC V ISA, which can be found here.

I'm looking at the bottom of page 20, and the interrupt conditions are stated very confusingly:

Global interrupt-enable bits, MIE, SIE, and UIE, are provided for each privilege mode. These bits are primarily used to guarantee atomicity with respect to interrupt handlers in the current privilege mode.

The global x IE bits are located in the low-order bits of mstatus, allowing them to be atomically set or cleared with a single CSR instruction.

When a hart is executing in privilege mode x, interrupts are globally enabled when x IE=1 and globally disabled when x IE=0. Interrupts for lower-privilege modes, wx, are always globally enabled regardless of the setting of the higherprivilege mode’s global y IE bit. 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.

With this description, I have made the following truth table which determines whether or not a certain interrupt will be execute based upon the MIE, SIE, and UIE bits, and the current privilege mode. This is confusing because it seems like while execution as a user, the supervisor won't take interrupts of a higher privilege level... Is that correct?

enter image description here

is this truth table correct?

\$\endgroup\$
2
\$\begingroup\$

Yes, the truth table above is correct, and verifiable by the text.

Note that if you want to disable a higher level interrupt while running in a lower level mode, the interrupts can be disabled on an individual basis.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I think you're using 'Answer' on this site like 'Reply' is used on other discussion sites. Although well-intended, this is a comment and not an answer. It will most likely be deleted but you can delete it yourself before any downvotes reduce your Reputation. Thanks. \$\endgroup\$ – TonyM Jun 1 at 9:33
  • \$\begingroup\$ @TonyM what's wrong? it's correct, and uses a first hand source \$\endgroup\$ – tuskiomi Jun 1 at 15:55
  • \$\begingroup\$ Your answer needs to contain some explanations rather than just firing off a one-line solution exam-style. It should be written clearly enough to teach future readers. It appears you've since edited it beyond the 'yes it is' it originally was. \$\endgroup\$ – TonyM Jun 1 at 22:17
  • \$\begingroup\$ @TonyM so what would you suggest I put in to teach future readers? \$\endgroup\$ – tuskiomi Jun 1 at 22:19
  • \$\begingroup\$ I have no suggestion on the detail of your own answer. I have tried to help you avoid deletion votes. I did not mark it for deletion and deletion comes after multiple votes. \$\endgroup\$ – TonyM Jun 1 at 22:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.