From a3367adaff66997044553cb9a746e101418afbdd Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Tue, 28 Aug 2007 14:30:50 -0700 Subject: Address translation: De-templatize the GenericTLB class. --HG-- extra : convert_revision : b605a90a4a1071e39f49085a839fdcd175e09fdb --- src/arch/mips/tlb.cc | 18 ++++++++++++++++++ src/arch/mips/tlb.hh | 17 +++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) (limited to 'src/arch/mips') diff --git a/src/arch/mips/tlb.cc b/src/arch/mips/tlb.cc index 71111b843..41a26aba1 100644 --- a/src/arch/mips/tlb.cc +++ b/src/arch/mips/tlb.cc @@ -35,6 +35,24 @@ #include "params/MipsITB.hh" namespace MipsISA { + Fault + TLB::translate(RequestPtr req, ThreadContext *tc, bool) + { + Fault fault = GenericTLB::translate(req, tc); + if (fault != NoFault) + return fault; + + typeof(req->getSize()) size = req->getSize(); + Addr paddr = req->getPaddr(); + + if (!isPowerOf2(size)) + panic("Invalid request size!\n"); + if ((size - 1) & paddr) + return new GenericAlignmentFault(paddr); + + return NoFault; + } + void TlbEntry::serialize(std::ostream &os) { diff --git a/src/arch/mips/tlb.hh b/src/arch/mips/tlb.hh index 6025de4c0..682aa7654 100644 --- a/src/arch/mips/tlb.hh +++ b/src/arch/mips/tlb.hh @@ -45,17 +45,26 @@ namespace MipsISA void unserialize(Checkpoint *cp, const std::string §ion); }; - class ITB : public GenericITB<> + class TLB : public GenericTLB { public: - ITB(const std::string &name) : GenericITB<>(name) + TLB(const std::string &name) : GenericTLB(name) + {} + + Fault translate(RequestPtr req, ThreadContext *tc, bool=false); + }; + + class ITB : public TLB + { + public: + ITB(const std::string &name) : TLB(name) {} }; - class DTB : public GenericDTB<> + class DTB : public TLB { public: - DTB(const std::string &name) : GenericDTB<>(name) + DTB(const std::string &name) : TLB(name) {} }; }; -- cgit v1.2.3