Browse Source

Move setting of V=0 for HS-mode trap

So it's right next to set_privilege() which it will be combined with
next.
pull/1366/head
Scott Johnson 3 years ago
committed by Andrew Waterman
parent
commit
87bf990083
  1. 2
      riscv/processor.cc

2
riscv/processor.cc

@ -836,7 +836,6 @@ void processor_t::take_trap(trap_t& t, reg_t epc)
set_privilege(PRV_S);
} else if (state.prv <= PRV_S && bit < max_xlen && ((hsdeleg >> bit) & 1)) {
// Handle the trap in HS-mode
set_virt(false);
reg_t vector = (state.nonvirtual_stvec->read() & 1) && interrupt ? 4 * bit : 0;
state.pc = (state.nonvirtual_stvec->read() & ~(reg_t)1) + vector;
state.nonvirtual_scause->write(t.cause());
@ -858,6 +857,7 @@ void processor_t::take_trap(trap_t& t, reg_t epc)
s = set_field(s, HSTATUS_GVA, t.has_gva());
state.hstatus->write(s);
}
set_virt(false);
set_privilege(PRV_S);
} else {
// Handle the trap in M-mode

Loading…
Cancel
Save