From ca83295b6fec38c4fe00aee53f9331c71fb0bef1 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Tue, 10 Mar 2020 18:15:44 -0700 Subject: [PATCH] mips: Implement translateFunctional. Change-Id: I32df1b3b12a0adee4457b78c735936c4c73da048 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26548 Maintainer: Gabe Black Tested-by: kokoro Reviewed-by: Nikos Nikoleris --- src/arch/mips/tlb.cc | 46 ++++++++++---------------------------------- src/arch/mips/tlb.hh | 6 ++---- 2 files changed, 12 insertions(+), 40 deletions(-) diff --git a/src/arch/mips/tlb.cc b/src/arch/mips/tlb.cc index aec91a259..8d2667ccd 100644 --- a/src/arch/mips/tlb.cc +++ b/src/arch/mips/tlb.cc @@ -64,8 +64,7 @@ TLB::TLB(const Params *p) TLB::~TLB() { - if (table) - delete [] table; + delete [] table; } // look up an entry in the TLB @@ -275,43 +274,11 @@ TLB::regStats() accesses = read_accesses + write_accesses; } -Fault -TLB::translateInst(const RequestPtr &req, ThreadContext *tc) -{ - if (FullSystem) - panic("translateInst not implemented in MIPS.\n"); - - Process * p = tc->getProcessPtr(); - - Fault fault = p->pTable->translate(req); - if (fault != NoFault) - return fault; - - return NoFault; -} - -Fault -TLB::translateData(const RequestPtr &req, ThreadContext *tc, bool write) -{ - if (FullSystem) - panic("translateData not implemented in MIPS.\n"); - - Process * p = tc->getProcessPtr(); - - Fault fault = p->pTable->translate(req); - if (fault != NoFault) - return fault; - - return NoFault; -} - Fault TLB::translateAtomic(const RequestPtr &req, ThreadContext *tc, Mode mode) { - if (mode == Execute) - return translateInst(req, tc); - else - return translateData(req, tc, mode == Write); + panic_if(FullSystem, "translateAtomic not implemented in full system."); + return tc->getProcessPtr()->pTable->translate(req); } void @@ -322,6 +289,13 @@ TLB::translateTiming(const RequestPtr &req, ThreadContext *tc, translation->finish(translateAtomic(req, tc, mode), req, tc, mode); } +Fault +TLB::translateFunctional(const RequestPtr &req, ThreadContext *tc, Mode mode) +{ + panic_if(FullSystem, "translateAtomic not implemented in full system."); + return tc->getProcessPtr()->pTable->translate(req); +} + Fault TLB::finalizePhysical(const RequestPtr &req, ThreadContext *tc, Mode mode) const diff --git a/src/arch/mips/tlb.hh b/src/arch/mips/tlb.hh index a63ded24b..bfe424d5c 100644 --- a/src/arch/mips/tlb.hh +++ b/src/arch/mips/tlb.hh @@ -112,13 +112,11 @@ class TLB : public BaseTLB void translateTiming( const RequestPtr &req, ThreadContext *tc, Translation *translation, Mode mode) override; + Fault translateFunctional( + const RequestPtr &req, ThreadContext *tc, Mode mode) override; Fault finalizePhysical( const RequestPtr &req, ThreadContext *tc, Mode mode) const override; - - private: - Fault translateInst(const RequestPtr &req, ThreadContext *tc); - Fault translateData(const RequestPtr &req, ThreadContext *tc, bool write); }; } -- 2.30.2