diff options
author | Jerry Zhao <jerryz123@berkeley.edu> | 2022-12-23 19:05:29 -0800 |
---|---|---|
committer | Jerry Zhao <jerryz123@berkeley.edu> | 2022-12-23 19:05:29 -0800 |
commit | 15635c2553c62bb493c28ef33caf6aab1fe306de (patch) | |
tree | 5944bb6d83deefb7f32ec63afd1ac265a138dbe9 /riscv/mmu.cc | |
parent | 3349dc5113fb98d626ea2ee37fafc7f47819a6dc (diff) | |
download | riscv-isa-sim-15635c2553c62bb493c28ef33caf6aab1fe306de.zip riscv-isa-sim-15635c2553c62bb493c28ef33caf6aab1fe306de.tar.gz riscv-isa-sim-15635c2553c62bb493c28ef33caf6aab1fe306de.tar.bz2 |
Add mmio_fetch to simif_t to distinguish between fetch/load for mmio accesses
Diffstat (limited to 'riscv/mmu.cc')
-rw-r--r-- | riscv/mmu.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/riscv/mmu.cc b/riscv/mmu.cc index 99dd190..ddf277b 100644 --- a/riscv/mmu.cc +++ b/riscv/mmu.cc @@ -89,7 +89,7 @@ tlb_entry_t mmu_t::fetch_slow_path(reg_t vaddr) if (auto host_addr = sim->addr_to_mem(paddr)) { result = refill_tlb(vaddr, paddr, host_addr, FETCH); } else { - if (!mmio_load(paddr, sizeof fetch_temp, (uint8_t*)&fetch_temp)) + if (!mmio_fetch(paddr, sizeof fetch_temp, (uint8_t*)&fetch_temp)) throw trap_instruction_access_fault(proc->state.v, vaddr, 0, 0); result = {(char*)&fetch_temp - vaddr, paddr - vaddr}; } @@ -137,6 +137,14 @@ bool mmu_t::mmio_ok(reg_t addr, access_type UNUSED type) return true; } +bool mmu_t::mmio_fetch(reg_t addr, size_t len, uint8_t* bytes) +{ + if (!mmio_ok(addr, FETCH)) + return false; + + return sim->mmio_fetch(addr, len, bytes); +} + bool mmu_t::mmio_load(reg_t addr, size_t len, uint8_t* bytes) { if (!mmio_ok(addr, LOAD)) |