tlb.hh revision 8768:314eb1e2fa94
12810SN/A/*
212728Snikos.nikoleris@arm.com * Copyright (c) 2007 The Hewlett-Packard Development Company
39347SAndreas.Sandberg@arm.com * All rights reserved.
49347SAndreas.Sandberg@arm.com *
59347SAndreas.Sandberg@arm.com * The license below extends only to copyright in the software and shall
69347SAndreas.Sandberg@arm.com * not be construed as granting a license to any other intellectual
79347SAndreas.Sandberg@arm.com * property including but not limited to intellectual property relating
89347SAndreas.Sandberg@arm.com * to a hardware implementation of the functionality of the software
99347SAndreas.Sandberg@arm.com * licensed hereunder.  You may use the software subject to the license
109347SAndreas.Sandberg@arm.com * terms below provided that you ensure that this notice is replicated
119347SAndreas.Sandberg@arm.com * unmodified and in its entirety in all distributions of the software,
129347SAndreas.Sandberg@arm.com * modified or unmodified, in source code or in binary form.
139347SAndreas.Sandberg@arm.com *
142810SN/A * Redistribution and use in source and binary forms, with or without
152810SN/A * modification, are permitted provided that the following conditions are
162810SN/A * met: redistributions of source code must retain the above copyright
172810SN/A * notice, this list of conditions and the following disclaimer;
182810SN/A * redistributions in binary form must reproduce the above copyright
192810SN/A * notice, this list of conditions and the following disclaimer in the
202810SN/A * documentation and/or other materials provided with the distribution;
212810SN/A * neither the name of the copyright holders nor the names of its
222810SN/A * contributors may be used to endorse or promote products derived from
232810SN/A * this software without specific prior written permission.
242810SN/A *
252810SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
262810SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
272810SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
282810SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
292810SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
302810SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
312810SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
322810SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
332810SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
342810SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
352810SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
362810SN/A *
372810SN/A * Authors: Gabe Black
382810SN/A */
392810SN/A
402810SN/A#ifndef __ARCH_X86_TLB_HH__
412810SN/A#define __ARCH_X86_TLB_HH__
422810SN/A
432810SN/A#include <list>
442810SN/A#include <string>
452810SN/A#include <vector>
462810SN/A
472810SN/A#include "arch/x86/regs/segment.hh"
482810SN/A#include "arch/x86/pagetable.hh"
4912492Sodanrc@yahoo.com.br#include "mem/mem_object.hh"
5012492Sodanrc@yahoo.com.br#include "mem/request.hh"
512810SN/A#include "params/X86TLB.hh"
5212727Snikos.nikoleris@arm.com#include "sim/fault_fwd.hh"
5312728Snikos.nikoleris@arm.com#include "sim/sim_object.hh"
542810SN/A#include "sim/tlb.hh"
558229Snate@binkert.org
568229Snate@binkert.orgclass ThreadContext;
5712727Snikos.nikoleris@arm.comclass Packet;
582810SN/A
5912727Snikos.nikoleris@arm.comnamespace X86ISA
6013223Sodanrc@yahoo.com.br{
6113752Sodanrc@yahoo.com.br    class Walker;
629796Sprakash.ramrakhyani@arm.com
639796Sprakash.ramrakhyani@arm.com    class TLB : public BaseTLB
642810SN/A    {
6513419Sodanrc@yahoo.com.br      protected:
6613219Sodanrc@yahoo.com.br        friend class Walker;
6712773Sodanrc@yahoo.com.br
682810SN/A        typedef std::list<TlbEntry *> EntryList;
692810SN/A
702810SN/A        uint32_t configAddress;
712810SN/A
729796Sprakash.ramrakhyani@arm.com      public:
732810SN/A
742810SN/A        typedef X86TLBParams Params;
759796Sprakash.ramrakhyani@arm.com        TLB(const Params *p);
769796Sprakash.ramrakhyani@arm.com
7711893Snikos.nikoleris@arm.com        void dumpAll();
7811893Snikos.nikoleris@arm.com
799796Sprakash.ramrakhyani@arm.com        TlbEntry *lookup(Addr va, bool update_lru = true);
809796Sprakash.ramrakhyani@arm.com
8111722Ssophiane.senni@gmail.com        void setConfigAddress(uint32_t addr);
8211722Ssophiane.senni@gmail.com
8313418Sodanrc@yahoo.com.br      protected:
8413419Sodanrc@yahoo.com.br
8513419Sodanrc@yahoo.com.br        EntryList::iterator lookupIt(Addr va, bool update_lru = true);
862810SN/A
8713219Sodanrc@yahoo.com.br        Walker * walker;
8813219Sodanrc@yahoo.com.br
8913219Sodanrc@yahoo.com.br      public:
902810SN/A        Walker *getWalker();
912810SN/A
922810SN/A        void invalidateAll();
932810SN/A
9412513Sodanrc@yahoo.com.br        void invalidateNonGlobal();
952810SN/A
962810SN/A        void demapPage(Addr va, uint64_t asn);
972810SN/A
986978SLisa.Hsu@amd.com      protected:
9912553Snikos.nikoleris@arm.com        int size;
1006978SLisa.Hsu@amd.com
10112629Sodanrc@yahoo.com.br        TlbEntry * tlb;
10212629Sodanrc@yahoo.com.br
10312629Sodanrc@yahoo.com.br        EntryList freeList;
1042810SN/A        EntryList entryList;
1052810SN/A
10612513Sodanrc@yahoo.com.br        Fault translateInt(RequestPtr req, ThreadContext *tc);
1072810SN/A
1082810SN/A        Fault translate(RequestPtr req, ThreadContext *tc,
1092810SN/A                Translation *translation, Mode mode,
1102810SN/A                bool &delayedResponse, bool timing);
1112810SN/A
1125999Snate@binkert.org      public:
1132810SN/A
1142810SN/A        Fault translateAtomic(RequestPtr req, ThreadContext *tc, Mode mode);
1155999Snate@binkert.org        void translateTiming(RequestPtr req, ThreadContext *tc,
1162810SN/A                Translation *translation, Mode mode);
1172810SN/A
1182810SN/A        TlbEntry * insert(Addr vpn, TlbEntry &entry);
1192810SN/A
1202810SN/A        // Checkpointing
1212810SN/A        virtual void serialize(std::ostream &os);
1225999Snate@binkert.org        virtual void unserialize(Checkpoint *cp, const std::string &section);
1232810SN/A    };
1242810SN/A}
1252810SN/A
1262810SN/A#endif // __ARCH_X86_TLB_HH__
1272810SN/A