diff options
author | Gabe Black <gabeblack@google.com> | 2018-01-05 15:01:00 -0800 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-01-20 08:06:56 +0000 |
commit | 2a15bfd79ced20a6d4cbf0a0a4c2fbb1444b9a44 (patch) | |
tree | d1fec5a31a00928dc9d5a3f4f05394236187d19c /src/arch/alpha | |
parent | b1ade08b2da4a0b398b69ea4eb2de35b08941826 (diff) | |
download | gem5-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/alpha')
-rw-r--r-- | src/arch/alpha/faults.cc | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/src/arch/alpha/faults.cc b/src/arch/alpha/faults.cc index 4a829cd9b..89b0ecea8 100644 --- a/src/arch/alpha/faults.cc +++ b/src/arch/alpha/faults.cc @@ -196,14 +196,11 @@ ItbPageFault::invoke(ThreadContext *tc, const StaticInstPtr &inst) } Process *p = tc->getProcessPtr(); - TlbEntry entry; - bool success = p->pTable->lookup(pc, entry); - if (!success) { - panic("Tried to execute unmapped address %#x.\n", pc); - } else { - VAddr vaddr(pc); - dynamic_cast<TLB *>(tc->getITBPtr())->insert(vaddr.page(), entry); - } + TlbEntry *entry = p->pTable->lookup(pc); + panic_if(!entry, "Tried to execute unmapped address %#x.\n", pc); + + VAddr vaddr(pc); + dynamic_cast<TLB *>(tc->getITBPtr())->insert(vaddr.page(), *entry); } void @@ -215,17 +212,11 @@ NDtbMissFault::invoke(ThreadContext *tc, const StaticInstPtr &inst) } Process *p = tc->getProcessPtr(); - TlbEntry entry; - bool success = p->pTable->lookup(vaddr, entry); - if (!success) { - if (p->fixupStackFault(vaddr)) - success = p->pTable->lookup(vaddr, entry); - } - if (!success) { - panic("Tried to access unmapped address %#x.\n", (Addr)vaddr); - } else { - dynamic_cast<TLB *>(tc->getDTBPtr())->insert(vaddr.page(), entry); - } + TlbEntry *entry = p->pTable->lookup(vaddr); + if (!entry && p->fixupStackFault(vaddr)) + entry = p->pTable->lookup(vaddr); + panic_if(!entry, "Tried to access unmapped address %#x.\n", (Addr)vaddr); + dynamic_cast<TLB *>(tc->getDTBPtr())->insert(vaddr.page(), *entry); } } // namespace AlphaISA |