tlb.hh revision 5894
12391SN/A/*
210482Sandreas.hansson@arm.com * Copyright (c) 2006 The Regents of The University of Michigan
37733SAli.Saidi@ARM.com * All rights reserved.
47733SAli.Saidi@ARM.com *
57733SAli.Saidi@ARM.com * Redistribution and use in source and binary forms, with or without
67733SAli.Saidi@ARM.com * modification, are permitted provided that the following conditions are
77733SAli.Saidi@ARM.com * met: redistributions of source code must retain the above copyright
87733SAli.Saidi@ARM.com * notice, this list of conditions and the following disclaimer;
97733SAli.Saidi@ARM.com * redistributions in binary form must reproduce the above copyright
107733SAli.Saidi@ARM.com * notice, this list of conditions and the following disclaimer in the
117733SAli.Saidi@ARM.com * documentation and/or other materials provided with the distribution;
127733SAli.Saidi@ARM.com * neither the name of the copyright holders nor the names of its
137733SAli.Saidi@ARM.com * contributors may be used to endorse or promote products derived from
142391SN/A * this software without specific prior written permission.
152391SN/A *
162391SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172391SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182391SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192391SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202391SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212391SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222391SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232391SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242391SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252391SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262391SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272391SN/A *
282391SN/A * Authors: Gabe Black
292391SN/A */
302391SN/A
312391SN/A#ifndef __SIM_TLB_HH__
322391SN/A#define __SIM_TLB_HH__
332391SN/A
342391SN/A#include "base/misc.hh"
352391SN/A#include "mem/request.hh"
362665Ssaidi@eecs.umich.edu#include "sim/faults.hh"
378931Sandreas.hansson@arm.com#include "sim/sim_object.hh"
382391SN/A
392391SN/Aclass ThreadContext;
409293Sandreas.hansson@arm.comclass Packet;
419293Sandreas.hansson@arm.com
429293Sandreas.hansson@arm.comclass BaseTLB : public SimObject
439293Sandreas.hansson@arm.com{
449293Sandreas.hansson@arm.com  protected:
459293Sandreas.hansson@arm.com    BaseTLB(const Params *p) : SimObject(p)
469293Sandreas.hansson@arm.com    {}
479293Sandreas.hansson@arm.com
489293Sandreas.hansson@arm.com  public:
499293Sandreas.hansson@arm.com    virtual void demapPage(Addr vaddr, uint64_t asn) = 0;
509293Sandreas.hansson@arm.com
519293Sandreas.hansson@arm.com    class Translation
529293Sandreas.hansson@arm.com    {
539356Snilay@cs.wisc.edu      public:
5410405Sandreas.hansson@arm.com        virtual ~Translation()
559293Sandreas.hansson@arm.com        {}
569293Sandreas.hansson@arm.com
572394SN/A        /*
582394SN/A         * The memory for this object may be dynamically allocated, and it may
592391SN/A         * be responsible for cleaning itself up which will happen in this
602391SN/A         * function. Once it's called, the object is no longer valid.
619293Sandreas.hansson@arm.com         */
629293Sandreas.hansson@arm.com        virtual void finish(Fault fault, RequestPtr req,
639293Sandreas.hansson@arm.com                ThreadContext *tc, bool write=false) = 0;
642391SN/A    };
659293Sandreas.hansson@arm.com};
669293Sandreas.hansson@arm.com
6710482Sandreas.hansson@arm.comclass GenericTLB : public BaseTLB
688931Sandreas.hansson@arm.com{
6910482Sandreas.hansson@arm.com  protected:
7010482Sandreas.hansson@arm.com    GenericTLB(const Params *p) : BaseTLB(p)
712391SN/A    {}
728931Sandreas.hansson@arm.com
7310482Sandreas.hansson@arm.com  public:
748931Sandreas.hansson@arm.com    void demapPage(Addr vaddr, uint64_t asn);
758931Sandreas.hansson@arm.com
768931Sandreas.hansson@arm.com    Fault translateAtomic(RequestPtr req, ThreadContext *tc, bool=false);
7710482Sandreas.hansson@arm.com    void translateTiming(RequestPtr req, ThreadContext *tc,
7810482Sandreas.hansson@arm.com            Translation *translation, bool=false);
7910482Sandreas.hansson@arm.com};
809293Sandreas.hansson@arm.com
819293Sandreas.hansson@arm.com#endif // __ARCH_SPARC_TLB_HH__
829293Sandreas.hansson@arm.com