|
|
|
@ -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; |
|
|
|
} |
|
|
|
|