aboutsummaryrefslogtreecommitdiff
path: root/riscv/mmu.cc
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@eecs.berkeley.edu>2013-12-17 10:18:47 -0800
committerAndrew Waterman <waterman@eecs.berkeley.edu>2013-12-17 10:18:47 -0800
commit7f457c47b339cc7c79f56bb277ed8ed989e88ae1 (patch)
tree4a3cc949c4a5631699c69443b1a24049ca01fbb4 /riscv/mmu.cc
parente85cb99c5e042ebce78f64213677a48ee7ba0491 (diff)
downloadspike-7f457c47b339cc7c79f56bb277ed8ed989e88ae1.zip
spike-7f457c47b339cc7c79f56bb277ed8ed989e88ae1.tar.gz
spike-7f457c47b339cc7c79f56bb277ed8ed989e88ae1.tar.bz2
Speed things up quite a bit
Diffstat (limited to 'riscv/mmu.cc')
-rw-r--r--riscv/mmu.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/riscv/mmu.cc b/riscv/mmu.cc
index 96884d6..f8efd5a 100644
--- a/riscv/mmu.cc
+++ b/riscv/mmu.cc
@@ -16,7 +16,8 @@ mmu_t::~mmu_t()
void mmu_t::flush_icache()
{
- memset(icache_tag, -1, sizeof(icache_tag));
+ for (size_t i = 0; i < ICACHE_ENTRIES; i++)
+ icache[i].tag = -1;
}
void mmu_t::flush_tlb()
@@ -28,7 +29,7 @@ void mmu_t::flush_tlb()
flush_icache();
}
-reg_t mmu_t::refill_tlb(reg_t addr, reg_t bytes, bool store, bool fetch)
+void* mmu_t::refill_tlb(reg_t addr, reg_t bytes, bool store, bool fetch)
{
reg_t idx = (addr >> PGSHIFT) % TLB_ENTRIES;
reg_t expected_tag = addr & ~(PGSIZE-1);
@@ -62,10 +63,10 @@ reg_t mmu_t::refill_tlb(reg_t addr, reg_t bytes, bool store, bool fetch)
tlb_load_tag[idx] = (pte_perm & PTE_UR) ? expected_tag : -1;
tlb_store_tag[idx] = (pte_perm & PTE_UW) ? expected_tag : -1;
tlb_insn_tag[idx] = (pte_perm & PTE_UX) ? expected_tag : -1;
- tlb_data[idx] = pgbase;
+ tlb_data[idx] = mem + pgbase - (addr & ~(PGSIZE-1));
}
- return paddr;
+ return mem + paddr;
}
pte_t mmu_t::walk(reg_t addr)