Browse Source

Merge pull request #2343 from EccoTheDolphin/aap-sc/mmio_ok_gone

get rid of mmio_ok checks
pull/2349/head
Andrew Waterman 3 weeks ago
committed by GitHub
parent
commit
d9cfec7aeb
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 27
      riscv/mmu.cc
  2. 1
      riscv/mmu.h
  3. 1
      riscv/processor.cc

27
riscv/mmu.cc

@ -158,20 +158,8 @@ static reg_t reg_from_bytes(size_t len, const uint8_t* bytes)
return res;
}
bool mmu_t::mmio_ok(reg_t paddr, size_t len, access_type UNUSED type)
{
// Disallow access to debug region when not in debug mode
if (proc && sim && sim->is_debug_module_access(paddr, len) && !proc->state.debug_mode)
return false;
return true;
}
bool mmu_t::mmio_fetch(reg_t paddr, size_t len, uint8_t* bytes)
{
if (!mmio_ok(paddr, len, FETCH))
return false;
return sim->mmio_fetch(paddr, len, bytes);
}
@ -191,9 +179,6 @@ bool mmu_t::mmio(reg_t paddr, size_t len, uint8_t* bytes, access_type type)
bool naturally_aligned = (paddr & (len - 1)) == 0;
if (power_of_2 && naturally_aligned) {
if (!mmio_ok(paddr, len, type))
return false;
if (type == STORE)
return sim->mmio_store(paddr, len, bytes);
else
@ -533,13 +518,13 @@ std::optional<base_pmpaddr_csr_t*> mmu_t::pmp_lookup(reg_t addr, reg_t len, size
bool mmu_t::pmp_ok(reg_t addr, reg_t len, access_type type, reg_t mode, bool hlvx)
{
if (!proc || proc->n_pmp == 0)
return true;
// The debug module implementation relies on firmware (ROM) owned by spike.
// When executing code from this firmware we keep target PMP rules from
// blocking the simulator-owned debug firmware.
if (proc->state.debug_mode && sim && sim->is_debug_module_access(addr, len))
// The Debug Module address region is hidden from normal software.
// A hart can access it only in debug mode.
if (proc && sim && sim->is_debug_module_access(addr, len))
return proc->state.debug_mode;
if (!proc || proc->n_pmp == 0)
return true;
if (auto pmp = pmp_lookup(addr, len, 0, proc->n_pmp); pmp.has_value())

1
riscv/mmu.h

@ -444,7 +444,6 @@ private:
bool mmio_load(reg_t paddr, size_t len, uint8_t* bytes);
bool mmio_store(reg_t paddr, size_t len, const uint8_t* bytes);
bool mmio(reg_t paddr, size_t len, uint8_t* bytes, access_type type);
bool mmio_ok(reg_t paddr, size_t len, access_type type);
void check_triggers(triggers::operation_t operation,
reg_t addr, bool virt, std::size_t data_size, const std::uint8_t* bytes);

1
riscv/processor.cc

@ -150,6 +150,7 @@ void processor_t::reset()
{
xlen = isa.get_max_xlen();
state.reset(this, isa.get_max_isa());
mmu->flush_tlb();
if (any_vector_extensions())
VU.reset();
in_wfi = false;

Loading…
Cancel
Save