|
|
@ -196,8 +196,8 @@ void state_t::reset(processor_t* const proc, reg_t max_isa) |
|
|
// mstatus_csr_t::unlogged_write()):
|
|
|
// mstatus_csr_t::unlogged_write()):
|
|
|
auto xlen = proc->get_isa().get_max_xlen(); |
|
|
auto xlen = proc->get_isa().get_max_xlen(); |
|
|
|
|
|
|
|
|
prv = PRV_M; |
|
|
prv = prev_prv = PRV_M; |
|
|
v = false; |
|
|
v = prev_v = false; |
|
|
csrmap[CSR_MISA] = misa = std::make_shared<misa_csr_t>(proc, CSR_MISA, max_isa); |
|
|
csrmap[CSR_MISA] = misa = std::make_shared<misa_csr_t>(proc, CSR_MISA, max_isa); |
|
|
mstatus = std::make_shared<mstatus_csr_t>(proc, CSR_MSTATUS); |
|
|
mstatus = std::make_shared<mstatus_csr_t>(proc, CSR_MSTATUS); |
|
|
|
|
|
|
|
|
@ -717,6 +717,7 @@ reg_t processor_t::legalize_privilege(reg_t prv) |
|
|
void processor_t::set_privilege(reg_t prv) |
|
|
void processor_t::set_privilege(reg_t prv) |
|
|
{ |
|
|
{ |
|
|
mmu->flush_tlb(); |
|
|
mmu->flush_tlb(); |
|
|
|
|
|
state.prev_prv = state.prv; |
|
|
state.prv = legalize_privilege(prv); |
|
|
state.prv = legalize_privilege(prv); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -747,17 +748,16 @@ void processor_t::set_virt(bool virt) |
|
|
if (state.prv == PRV_M) |
|
|
if (state.prv == PRV_M) |
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
|
if (state.v != virt) { |
|
|
/*
|
|
|
/*
|
|
|
* Ideally, we should flush TLB here but we don't need it because |
|
|
* Ideally, we should flush TLB here but we don't need it because |
|
|
* set_virt() is always used in conjucter with set_privilege() and |
|
|
* set_virt() is always used in conjucter with set_privilege() and |
|
|
* set_privilege() will flush TLB unconditionally. |
|
|
* set_privilege() will flush TLB unconditionally. |
|
|
* |
|
|
* |
|
|
* The virtualized sstatus register also relies on this TLB flush, |
|
|
* The virtualized sstatus register also relies on this TLB flush, |
|
|
* since changing V might change sstatus.MXR and sstatus.SUM. |
|
|
* since changing V might change sstatus.MXR and sstatus.SUM. |
|
|
*/ |
|
|
*/ |
|
|
state.prev_v = state.v; |
|
|
state.v = virt; |
|
|
state.v = virt; |
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void processor_t::enter_debug_mode(uint8_t cause) |
|
|
void processor_t::enter_debug_mode(uint8_t cause) |
|
|
|