tlb.hh revision 6023
12623SN/A/*
29442SAndreas.Sandberg@ARM.com * Copyright (c) 2006 The Regents of The University of Michigan
39442SAndreas.Sandberg@ARM.com * All rights reserved.
49442SAndreas.Sandberg@ARM.com *
59442SAndreas.Sandberg@ARM.com * Redistribution and use in source and binary forms, with or without
69442SAndreas.Sandberg@ARM.com * modification, are permitted provided that the following conditions are
79442SAndreas.Sandberg@ARM.com * met: redistributions of source code must retain the above copyright
89442SAndreas.Sandberg@ARM.com * notice, this list of conditions and the following disclaimer;
99442SAndreas.Sandberg@ARM.com * redistributions in binary form must reproduce the above copyright
109442SAndreas.Sandberg@ARM.com * notice, this list of conditions and the following disclaimer in the
119442SAndreas.Sandberg@ARM.com * documentation and/or other materials provided with the distribution;
129442SAndreas.Sandberg@ARM.com * neither the name of the copyright holders nor the names of its
139442SAndreas.Sandberg@ARM.com * contributors may be used to endorse or promote products derived from
142623SN/A * this software without specific prior written permission.
152623SN/A *
162623SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172623SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182623SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192623SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202623SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212623SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222623SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232623SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242623SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252623SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262623SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272623SN/A *
282623SN/A * Authors: Gabe Black
292623SN/A */
302623SN/A
312623SN/A#ifndef __SIM_TLB_HH__
322623SN/A#define __SIM_TLB_HH__
332623SN/A
342623SN/A#include "base/misc.hh"
352623SN/A#include "mem/request.hh"
362623SN/A#include "sim/faults.hh"
372623SN/A#include "sim/sim_object.hh"
382623SN/A
392665Ssaidi@eecs.umich.educlass ThreadContext;
402665Ssaidi@eecs.umich.educlass Packet;
412623SN/A
422623SN/Aclass BaseTLB : public SimObject
432623SN/A{
442623SN/A  protected:
452623SN/A    BaseTLB(const Params *p)
462623SN/A        : SimObject(p)
476973Stjones1@inf.ed.ac.uk    {}
485529Snate@binkert.org
495529Snate@binkert.org  public:
502623SN/A    enum Mode { Read, Write, Execute };
512623SN/A
522623SN/A  public:
532623SN/A    virtual void demapPage(Addr vaddr, uint64_t asn) = 0;
545529Snate@binkert.org
552623SN/A    class Translation
562623SN/A    {
572623SN/A      public:
582623SN/A        virtual ~Translation()
592623SN/A        {}
602623SN/A
615728Sgblack@eecs.umich.edu        /*
625728Sgblack@eecs.umich.edu         * The memory for this object may be dynamically allocated, and it may
635728Sgblack@eecs.umich.edu         * be responsible for cleaning itself up which will happen in this
645728Sgblack@eecs.umich.edu         * function. Once it's called, the object is no longer valid.
655728Sgblack@eecs.umich.edu         */
665728Sgblack@eecs.umich.edu        virtual void finish(Fault fault, RequestPtr req, ThreadContext *tc,
675728Sgblack@eecs.umich.edu                            Mode mode) = 0;
685728Sgblack@eecs.umich.edu    };
695728Sgblack@eecs.umich.edu};
705728Sgblack@eecs.umich.edu
715728Sgblack@eecs.umich.educlass GenericTLB : public BaseTLB
725728Sgblack@eecs.umich.edu{
735728Sgblack@eecs.umich.edu  protected:
745728Sgblack@eecs.umich.edu    GenericTLB(const Params *p)
755728Sgblack@eecs.umich.edu        : BaseTLB(p)
765728Sgblack@eecs.umich.edu    {}
775728Sgblack@eecs.umich.edu
785728Sgblack@eecs.umich.edu  public:
795728Sgblack@eecs.umich.edu    void demapPage(Addr vaddr, uint64_t asn);
805728Sgblack@eecs.umich.edu
815728Sgblack@eecs.umich.edu    Fault translateAtomic(RequestPtr req, ThreadContext *tc, Mode mode);
825728Sgblack@eecs.umich.edu    void translateTiming(RequestPtr req, ThreadContext *tc,
835728Sgblack@eecs.umich.edu                         Translation *translation, Mode mode);
845728Sgblack@eecs.umich.edu};
855728Sgblack@eecs.umich.edu
865728Sgblack@eecs.umich.edu#endif // __ARCH_SPARC_TLB_HH__
875728Sgblack@eecs.umich.edu