Browse Source

Use virtualized sstatus when deciding interrupt enables

No functional change.

It's safe to use the virtualized sstatus here after [this
bugfix](https://github.com/riscv/riscv-isa-sim/pull/680) since the
value of hsie doesn't matter if state.v==1. In the cases where it does
matter (i.e. when state.v==0), hsie will come from sstatus, not
vsstatus.

Before that bugfix, this needed to use sstatus (not vsstatus) always,
because sstatus.sie was considered when in either HS-mode or VS-mode.
pull/796/head
Scott Johnson 5 years ago
committed by Andrew Waterman
parent
commit
25f88c696a
  1. 2
      riscv/processor.cc

2
riscv/processor.cc

@ -643,7 +643,7 @@ void processor_t::take_interrupt(reg_t pending_interrupts)
if (enabled_interrupts == 0) {
// HS-ints have higher priority over VS-ints
deleg = state.mideleg->read() & ~state.hideleg;
status = state.nonvirtual_sstatus->read();
status = state.sstatus->read();
hsie = get_field(status, MSTATUS_SIE);
hs_enabled = state.v || state.prv < PRV_S || (state.prv == PRV_S && hsie);
enabled_interrupts = pending_interrupts & deleg & -hs_enabled;

Loading…
Cancel
Save