tlb.hh revision 9258
111794Sbrandon.potter@amd.com/* 211794Sbrandon.potter@amd.com * Copyright (c) 2011 ARM Limited 311794Sbrandon.potter@amd.com * All rights reserved. 411794Sbrandon.potter@amd.com * 511794Sbrandon.potter@amd.com * The license below extends only to copyright in the software and shall 611794Sbrandon.potter@amd.com * not be construed as granting a license to any other intellectual 711794Sbrandon.potter@amd.com * property including but not limited to intellectual property relating 811794Sbrandon.potter@amd.com * to a hardware implementation of the functionality of the software 911794Sbrandon.potter@amd.com * licensed hereunder. You may use the software subject to the license 1011794Sbrandon.potter@amd.com * terms below provided that you ensure that this notice is replicated 1111794Sbrandon.potter@amd.com * unmodified and in its entirety in all distributions of the software, 1211794Sbrandon.potter@amd.com * modified or unmodified, in source code or in binary form. 1311794Sbrandon.potter@amd.com * 1411794Sbrandon.potter@amd.com * Copyright (c) 2006 The Regents of The University of Michigan 1511794Sbrandon.potter@amd.com * All rights reserved. 1611794Sbrandon.potter@amd.com * 1711794Sbrandon.potter@amd.com * Redistribution and use in source and binary forms, with or without 1811794Sbrandon.potter@amd.com * modification, are permitted provided that the following conditions are 1911794Sbrandon.potter@amd.com * met: redistributions of source code must retain the above copyright 2011794Sbrandon.potter@amd.com * notice, this list of conditions and the following disclaimer; 2111794Sbrandon.potter@amd.com * redistributions in binary form must reproduce the above copyright 2211794Sbrandon.potter@amd.com * notice, this list of conditions and the following disclaimer in the 2311794Sbrandon.potter@amd.com * documentation and/or other materials provided with the distribution; 2411794Sbrandon.potter@amd.com * neither the name of the copyright holders nor the names of its 2511794Sbrandon.potter@amd.com * contributors may be used to endorse or promote products derived from 2611794Sbrandon.potter@amd.com * this software without specific prior written permission. 2711794Sbrandon.potter@amd.com * 2811794Sbrandon.potter@amd.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 2911794Sbrandon.potter@amd.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 3011794Sbrandon.potter@amd.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 3111794Sbrandon.potter@amd.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 3211794Sbrandon.potter@amd.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 3311794Sbrandon.potter@amd.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 3411794Sbrandon.potter@amd.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 3511794Sbrandon.potter@amd.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 3611794Sbrandon.potter@amd.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3711794Sbrandon.potter@amd.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 3811794Sbrandon.potter@amd.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3911794Sbrandon.potter@amd.com * 4011794Sbrandon.potter@amd.com * Authors: Gabe Black 4111794Sbrandon.potter@amd.com */ 4211794Sbrandon.potter@amd.com 4311794Sbrandon.potter@amd.com#ifndef __SIM_TLB_HH__ 4411794Sbrandon.potter@amd.com#define __SIM_TLB_HH__ 4511794Sbrandon.potter@amd.com 4611794Sbrandon.potter@amd.com#include "base/misc.hh" 4711794Sbrandon.potter@amd.com#include "mem/request.hh" 4811794Sbrandon.potter@amd.com#include "sim/fault_fwd.hh" 4911794Sbrandon.potter@amd.com#include "sim/sim_object.hh" 5011794Sbrandon.potter@amd.com 5111877Sbrandon.potter@amd.comclass ThreadContext; 5211877Sbrandon.potter@amd.comclass MasterPort; 5311851Sbrandon.potter@amd.com 5412296Sar4jc@virginia.educlass BaseTLB : public SimObject 5511794Sbrandon.potter@amd.com{ 5611794Sbrandon.potter@amd.com protected: 5711794Sbrandon.potter@amd.com BaseTLB(const Params *p) 5812296Sar4jc@virginia.edu : SimObject(p) 5913995Sbrandon.potter@amd.com {} 6012296Sar4jc@virginia.edu 6111794Sbrandon.potter@amd.com public: 6211794Sbrandon.potter@amd.com enum Mode { Read, Write, Execute }; 6311794Sbrandon.potter@amd.com 6411794Sbrandon.potter@amd.com public: 6511794Sbrandon.potter@amd.com virtual void demapPage(Addr vaddr, uint64_t asn) = 0; 6611794Sbrandon.potter@amd.com 6711794Sbrandon.potter@amd.com /** 6811794Sbrandon.potter@amd.com * Get the table walker master port if present. This is used for 6911794Sbrandon.potter@amd.com * migrating port connections during a CPU takeOverFrom() 7011794Sbrandon.potter@amd.com * call. For architectures that do not have a table walker, NULL 7113995Sbrandon.potter@amd.com * is returned, hence the use of a pointer rather than a 7211794Sbrandon.potter@amd.com * reference. 7312296Sar4jc@virginia.edu * 7412296Sar4jc@virginia.edu * @return A pointer to the walker master port or NULL if not present 7511794Sbrandon.potter@amd.com */ 7611794Sbrandon.potter@amd.com virtual MasterPort* getMasterPort() { return NULL; } 7711794Sbrandon.potter@amd.com 7811794Sbrandon.potter@amd.com class Translation 7911794Sbrandon.potter@amd.com { 8011794Sbrandon.potter@amd.com public: 8111794Sbrandon.potter@amd.com virtual ~Translation() 8211794Sbrandon.potter@amd.com {} 8311794Sbrandon.potter@amd.com 8411794Sbrandon.potter@amd.com /** 8511794Sbrandon.potter@amd.com * Signal that the translation has been delayed due to a hw page table 8611794Sbrandon.potter@amd.com * walk. 8711794Sbrandon.potter@amd.com */ 8811794Sbrandon.potter@amd.com virtual void markDelayed() = 0; 8911794Sbrandon.potter@amd.com 9011794Sbrandon.potter@amd.com /* 9111794Sbrandon.potter@amd.com * The memory for this object may be dynamically allocated, and it may 9211794Sbrandon.potter@amd.com * be responsible for cleaning itself up which will happen in this 9311794Sbrandon.potter@amd.com * function. Once it's called, the object is no longer valid. 9411794Sbrandon.potter@amd.com */ 9511794Sbrandon.potter@amd.com virtual void finish(Fault fault, RequestPtr req, ThreadContext *tc, 9611794Sbrandon.potter@amd.com Mode mode) = 0; 9711794Sbrandon.potter@amd.com 9811794Sbrandon.potter@amd.com /** This function is used by the page table walker to determine if it 9911794Sbrandon.potter@amd.com * should translate the a pending request or if the underlying request 10011794Sbrandon.potter@amd.com * has been squashed. 10113995Sbrandon.potter@amd.com * @ return Is the instruction that requested this translation squashed? 10211794Sbrandon.potter@amd.com */ 10311794Sbrandon.potter@amd.com virtual bool squashed() const { return false; } 10411794Sbrandon.potter@amd.com }; 10511794Sbrandon.potter@amd.com}; 10611794Sbrandon.potter@amd.com 10711794Sbrandon.potter@amd.comclass GenericTLB : public BaseTLB 10811794Sbrandon.potter@amd.com{ 10911794Sbrandon.potter@amd.com protected: 11011794Sbrandon.potter@amd.com GenericTLB(const Params *p) 11111794Sbrandon.potter@amd.com : BaseTLB(p) 11211794Sbrandon.potter@amd.com {} 11311794Sbrandon.potter@amd.com 11411886Sbrandon.potter@amd.com public: 11511886Sbrandon.potter@amd.com void demapPage(Addr vaddr, uint64_t asn); 11611886Sbrandon.potter@amd.com 11711886Sbrandon.potter@amd.com Fault translateAtomic(RequestPtr req, ThreadContext *tc, Mode mode); 11811794Sbrandon.potter@amd.com void translateTiming(RequestPtr req, ThreadContext *tc, 11911794Sbrandon.potter@amd.com Translation *translation, Mode mode); 12011794Sbrandon.potter@amd.com}; 12111794Sbrandon.potter@amd.com 12211794Sbrandon.potter@amd.com#endif // __ARCH_SPARC_TLB_HH__ 12311794Sbrandon.potter@amd.com