tlb.hh revision 5034
14997Sgblack@eecs.umich.edu/*
24997Sgblack@eecs.umich.edu * Copyright (c) 2006 The Regents of The University of Michigan
34997Sgblack@eecs.umich.edu * All rights reserved.
44997Sgblack@eecs.umich.edu *
54997Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without
64997Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are
74997Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright
84997Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer;
94997Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright
104997Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the
114997Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution;
124997Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its
134997Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from
144997Sgblack@eecs.umich.edu * this software without specific prior written permission.
154997Sgblack@eecs.umich.edu *
164997Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
174997Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
184997Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
194997Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
204997Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
214997Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
224997Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
234997Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
244997Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
254997Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
264997Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
274997Sgblack@eecs.umich.edu *
284997Sgblack@eecs.umich.edu * Authors: Gabe Black
294997Sgblack@eecs.umich.edu */
304997Sgblack@eecs.umich.edu
314997Sgblack@eecs.umich.edu#ifndef __ARCH_MIPS_TLB_HH__
324997Sgblack@eecs.umich.edu#define __ARCH_MIPS_TLB_HH__
334997Sgblack@eecs.umich.edu
345034Smilesck@eecs.umich.edu#include "params/MipsDTB.hh"
355034Smilesck@eecs.umich.edu#include "params/MipsITB.hh"
364997Sgblack@eecs.umich.edu#include "sim/tlb.hh"
374997Sgblack@eecs.umich.edu
384997Sgblack@eecs.umich.edunamespace MipsISA
394997Sgblack@eecs.umich.edu{
405014Sgblack@eecs.umich.edu    struct TlbEntry
415014Sgblack@eecs.umich.edu    {
425014Sgblack@eecs.umich.edu        Addr pageStart;
435014Sgblack@eecs.umich.edu        TlbEntry() {}
445014Sgblack@eecs.umich.edu        TlbEntry(Addr paddr) : pageStart(paddr) {}
455014Sgblack@eecs.umich.edu
465014Sgblack@eecs.umich.edu        void serialize(std::ostream &os);
475014Sgblack@eecs.umich.edu        void unserialize(Checkpoint *cp, const std::string &section);
485014Sgblack@eecs.umich.edu    };
495014Sgblack@eecs.umich.edu
505019Sgblack@eecs.umich.edu    class TLB : public GenericTLB
514997Sgblack@eecs.umich.edu    {
524997Sgblack@eecs.umich.edu      public:
535034Smilesck@eecs.umich.edu        typedef MipsTLBParams Params;
545034Smilesck@eecs.umich.edu        TLB(const Params *p) : GenericTLB(p)
555019Sgblack@eecs.umich.edu        {}
565019Sgblack@eecs.umich.edu
575019Sgblack@eecs.umich.edu        Fault translate(RequestPtr req, ThreadContext *tc, bool=false);
585019Sgblack@eecs.umich.edu    };
595019Sgblack@eecs.umich.edu
605019Sgblack@eecs.umich.edu    class ITB : public TLB
615019Sgblack@eecs.umich.edu    {
625019Sgblack@eecs.umich.edu      public:
635034Smilesck@eecs.umich.edu        typedef MipsITBParams Params;
645034Smilesck@eecs.umich.edu        ITB(const Params *p) : TLB(p)
654997Sgblack@eecs.umich.edu        {}
664997Sgblack@eecs.umich.edu    };
674997Sgblack@eecs.umich.edu
685019Sgblack@eecs.umich.edu    class DTB : public TLB
694997Sgblack@eecs.umich.edu    {
704997Sgblack@eecs.umich.edu      public:
715034Smilesck@eecs.umich.edu        typedef MipsDTBParams Params;
725034Smilesck@eecs.umich.edu        DTB(const Params *p) : TLB(p)
734997Sgblack@eecs.umich.edu        {}
744997Sgblack@eecs.umich.edu    };
754997Sgblack@eecs.umich.edu};
764997Sgblack@eecs.umich.edu
774997Sgblack@eecs.umich.edu#endif // __ARCH_MIPS_TLB_HH__
78