Browse Source

Extract hypervisor_exceptions variable

Which I will reuse next.
pull/658/head
Scott Johnson 5 years ago
parent
commit
d0b8a6ec69
No known key found for this signature in database GPG Key ID: 61C1F01D3D1410C9
  1. 15
      riscv/processor.cc

15
riscv/processor.cc

@ -872,6 +872,13 @@ void processor_t::set_csr(int which, reg_t val)
reg_t coprocessor_ints = (!custom_extensions.empty()) << IRQ_COP;
reg_t delegable_ints = supervisor_ints | coprocessor_ints;
reg_t all_ints = delegable_ints | hypervisor_ints | MIP_MSIP | MIP_MTIP | MIP_MEIP;
reg_t hypervisor_exceptions = 0
| (1 << CAUSE_VIRTUAL_SUPERVISOR_ECALL)
| (1 << CAUSE_FETCH_GUEST_PAGE_FAULT)
| (1 << CAUSE_LOAD_GUEST_PAGE_FAULT)
| (1 << CAUSE_VIRTUAL_INSTRUCTION)
| (1 << CAUSE_STORE_GUEST_PAGE_FAULT)
;
if (which >= CSR_PMPADDR0 && which < CSR_PMPADDR0 + state.max_pmp) {
// If no PMPs are configured, disallow access to all. Otherwise, allow
@ -1001,13 +1008,7 @@ void processor_t::set_csr(int which, reg_t val)
(1 << CAUSE_FETCH_PAGE_FAULT) |
(1 << CAUSE_LOAD_PAGE_FAULT) |
(1 << CAUSE_STORE_PAGE_FAULT);
mask |= supports_extension('H') ?
(1 << CAUSE_VIRTUAL_SUPERVISOR_ECALL) |
(1 << CAUSE_FETCH_GUEST_PAGE_FAULT) |
(1 << CAUSE_LOAD_GUEST_PAGE_FAULT) |
(1 << CAUSE_VIRTUAL_INSTRUCTION) |
(1 << CAUSE_STORE_GUEST_PAGE_FAULT)
: 0;
mask |= supports_extension('H') ? hypervisor_exceptions : 0;
state.medeleg = (state.medeleg & ~mask) | (val & mask);
break;
}

Loading…
Cancel
Save