Skip to content

Commit

Permalink
fix: use PAGEMASK for perfect TLB (#76)
Browse files Browse the repository at this point in the history
The perfect TLB access are set to a 0xFFF.. Addresses, but this requires
a page number instead, therefore a shift
  • Loading branch information
branylagaffe committed Oct 31, 2024
1 parent f9fb43e commit 4e7740f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/MMU/MMUImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ bool MMUComponent::cfg_mmu(index_t anIndex)
theMMU->setupAddressSpaceSizesAndGranules();
DBG_Assert(theMMU->Gran0->getlogKBSize() == 12, (<< "TG0 has non-4KB size - unsupported"));
DBG_Assert(theMMU->Gran1->getlogKBSize() == 12, (<< "TG1 has non-4KB size - unsupported"));
PAGEMASK = ~((1 << theMMU->Gran0->getlogKBSize()) - 1);
PAGEMASK = ~((1ULL << theMMU->Gran0->getlogKBSize()) - 1);
ret = true;
}

Expand Down Expand Up @@ -279,6 +279,10 @@ void MMUComponent::initialize()
mmu_is_init = false;
theInstrTLB.resize(cfg.iTLBSize);
theDataTLB.resize(cfg.dTLBSize);

if (cfg.PerfectTLB) {
PAGEMASK = ~((1ULL << 12) - 1);
}
}

void MMUComponent::finalize() {}
Expand Down

0 comments on commit 4e7740f

Please sign in to comment.