summaryrefslogtreecommitdiff
path: root/src/arch/x86/tlb.cc
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-01-05 15:01:00 -0800
committerGabe Black <gabeblack@google.com>2018-01-20 08:06:56 +0000
commit2a15bfd79ced20a6d4cbf0a0a4c2fbb1444b9a44 (patch)
treed1fec5a31a00928dc9d5a3f4f05394236187d19c /src/arch/x86/tlb.cc
parentb1ade08b2da4a0b398b69ea4eb2de35b08941826 (diff)
downloadgem5-2a15bfd79ced20a6d4cbf0a0a4c2fbb1444b9a44.tar.xz
arch, mem: Make the page table lookup function return a pointer.
This avoids having a copy in the lookup function itself, and the declaration of a lot of temporary TLB entry pointers in callers. The gpu TLB seems to have had the most dependence on the original signature of the lookup function, partially because it was relying on a somewhat unsafe copy to a TLB entry using a base class pointer type. Change-Id: I8b1cf494468163deee000002d243541657faf57f Reviewed-on: https://gem5-review.googlesource.com/7343 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/arch/x86/tlb.cc')
-rw-r--r--src/arch/x86/tlb.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/arch/x86/tlb.cc b/src/arch/x86/tlb.cc
index 0b1df9e21..93369494d 100644
--- a/src/arch/x86/tlb.cc
+++ b/src/arch/x86/tlb.cc
@@ -94,7 +94,7 @@ TLB::evictLRU()
}
TlbEntry *
-TLB::insert(Addr vpn, TlbEntry &entry)
+TLB::insert(Addr vpn, const TlbEntry &entry)
{
// If somebody beat us to it, just use that existing entry.
TlbEntry *newEntry = trie.lookup(vpn);
@@ -357,23 +357,22 @@ TLB::translate(RequestPtr req, ThreadContext *tc, Translation *translation,
assert(entry);
} else {
Process *p = tc->getProcessPtr();
- TlbEntry newEntry;
- bool success = p->pTable->lookup(vaddr, newEntry);
- if (!success && mode != Execute) {
+ TlbEntry *newEntry = p->pTable->lookup(vaddr);
+ if (!newEntry && mode != Execute) {
// Check if we just need to grow the stack.
if (p->fixupStackFault(vaddr)) {
// If we did, lookup the entry for the new page.
- success = p->pTable->lookup(vaddr, newEntry);
+ newEntry = p->pTable->lookup(vaddr);
}
}
- if (!success) {
+ if (!newEntry) {
return std::make_shared<PageFault>(vaddr, true, mode,
true, false);
} else {
Addr alignedVaddr = p->pTable->pageAlign(vaddr);
DPRINTF(TLB, "Mapping %#x to %#x\n", alignedVaddr,
- newEntry.pageStart());
- entry = insert(alignedVaddr, newEntry);
+ newEntry->pageStart());
+ entry = insert(alignedVaddr, *newEntry);
}
DPRINTF(TLB, "Miss was serviced.\n");
}