tlb.hh revision 3602
12650Ssaidi@eecs.umich.edu/* 22650Ssaidi@eecs.umich.edu * Copyright (c) 2006 The Regents of The University of Michigan 32650Ssaidi@eecs.umich.edu * All rights reserved. 42650Ssaidi@eecs.umich.edu * 52650Ssaidi@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 62650Ssaidi@eecs.umich.edu * modification, are permitted provided that the following conditions are 72650Ssaidi@eecs.umich.edu * met: redistributions of source code must retain the above copyright 82650Ssaidi@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 92650Ssaidi@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 102650Ssaidi@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 112650Ssaidi@eecs.umich.edu * documentation and/or other materials provided with the distribution; 122650Ssaidi@eecs.umich.edu * neither the name of the copyright holders nor the names of its 132650Ssaidi@eecs.umich.edu * contributors may be used to endorse or promote products derived from 142650Ssaidi@eecs.umich.edu * this software without specific prior written permission. 152650Ssaidi@eecs.umich.edu * 162650Ssaidi@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172650Ssaidi@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182650Ssaidi@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192650Ssaidi@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202650Ssaidi@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212650Ssaidi@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222650Ssaidi@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232650Ssaidi@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242650Ssaidi@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252650Ssaidi@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262650Ssaidi@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272650Ssaidi@eecs.umich.edu * 282650Ssaidi@eecs.umich.edu * Authors: Ali Saidi 292650Ssaidi@eecs.umich.edu */ 302650Ssaidi@eecs.umich.edu 312650Ssaidi@eecs.umich.edu#ifndef __ARCH_SPARC_TLB_HH__ 322650Ssaidi@eecs.umich.edu#define __ARCH_SPARC_TLB_HH__ 332650Ssaidi@eecs.umich.edu 343602Sgblack@eecs.umich.edu#include "base/misc.hh" 353569Sgblack@eecs.umich.edu#include "mem/request.hh" 363468Sgblack@eecs.umich.edu#include "sim/faults.hh" 373569Sgblack@eecs.umich.edu#include "sim/sim_object.hh" 383468Sgblack@eecs.umich.edu 393468Sgblack@eecs.umich.educlass ThreadContext; 403468Sgblack@eecs.umich.edu 413468Sgblack@eecs.umich.edunamespace SparcISA 423468Sgblack@eecs.umich.edu{ 433569Sgblack@eecs.umich.edu class TLB : public SimObject 443468Sgblack@eecs.umich.edu { 453569Sgblack@eecs.umich.edu public: 463569Sgblack@eecs.umich.edu TLB(const std::string &name, int size) : SimObject(name) 473569Sgblack@eecs.umich.edu { 483569Sgblack@eecs.umich.edu } 493468Sgblack@eecs.umich.edu }; 503468Sgblack@eecs.umich.edu 513468Sgblack@eecs.umich.edu class ITB : public TLB 523468Sgblack@eecs.umich.edu { 533468Sgblack@eecs.umich.edu public: 543569Sgblack@eecs.umich.edu ITB(const std::string &name, int size) : TLB(name, size) 553569Sgblack@eecs.umich.edu { 563569Sgblack@eecs.umich.edu } 573569Sgblack@eecs.umich.edu 583468Sgblack@eecs.umich.edu Fault translate(RequestPtr &req, ThreadContext *tc) const 593468Sgblack@eecs.umich.edu { 603602Sgblack@eecs.umich.edu //For now, always assume the address is already physical. 613602Sgblack@eecs.umich.edu //Also assume that there are 40 bits of physical address space. 623602Sgblack@eecs.umich.edu req->setPaddr(req->getVaddr() & ((1ULL << 40) - 1)); 633468Sgblack@eecs.umich.edu return NoFault; 643468Sgblack@eecs.umich.edu } 653468Sgblack@eecs.umich.edu }; 663468Sgblack@eecs.umich.edu 673468Sgblack@eecs.umich.edu class DTB : public TLB 683468Sgblack@eecs.umich.edu { 693468Sgblack@eecs.umich.edu public: 703569Sgblack@eecs.umich.edu DTB(const std::string &name, int size) : TLB(name, size) 713569Sgblack@eecs.umich.edu { 723569Sgblack@eecs.umich.edu } 733569Sgblack@eecs.umich.edu 743468Sgblack@eecs.umich.edu Fault translate(RequestPtr &req, ThreadContext *tc, bool write) const 753468Sgblack@eecs.umich.edu { 763602Sgblack@eecs.umich.edu //For now, always assume the address is already physical. 773602Sgblack@eecs.umich.edu //Also assume that there are 40 bits of physical address space. 783602Sgblack@eecs.umich.edu req->setPaddr(req->getVaddr() & ((1ULL << 40) - 1)); 793468Sgblack@eecs.umich.edu return NoFault; 803468Sgblack@eecs.umich.edu } 813468Sgblack@eecs.umich.edu }; 823468Sgblack@eecs.umich.edu} 832650Ssaidi@eecs.umich.edu 842650Ssaidi@eecs.umich.edu#endif // __ARCH_SPARC_TLB_HH__ 85