tlb.cc revision 8784
12497SN/A/*
212776Snikos.nikoleris@arm.com * Copyright (c) 2001-2005 The Regents of The University of Michigan
38711SN/A * All rights reserved.
48711SN/A *
58711SN/A * Redistribution and use in source and binary forms, with or without
68711SN/A * modification, are permitted provided that the following conditions are
78711SN/A * met: redistributions of source code must retain the above copyright
88711SN/A * notice, this list of conditions and the following disclaimer;
98711SN/A * redistributions in binary form must reproduce the above copyright
108711SN/A * notice, this list of conditions and the following disclaimer in the
118711SN/A * documentation and/or other materials provided with the distribution;
128711SN/A * neither the name of the copyright holders nor the names of its
138711SN/A * contributors may be used to endorse or promote products derived from
142497SN/A * this software without specific prior written permission.
152497SN/A *
162497SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172497SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182497SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192497SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202497SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212497SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222497SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232497SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242497SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252497SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262497SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272497SN/A *
282497SN/A * Authors: Gabe Black
292497SN/A */
302497SN/A
312497SN/A#include "cpu/thread_context.hh"
322497SN/A#include "mem/page_table.hh"
332497SN/A#include "sim/faults.hh"
342497SN/A#include "sim/full_system.hh"
352497SN/A#include "sim/process.hh"
362497SN/A#include "sim/tlb.hh"
372497SN/A
382497SN/AFault
392665SN/AGenericTLB::translateAtomic(RequestPtr req, ThreadContext *tc, Mode)
402665SN/A{
418715SN/A    if (FullSystem)
428922SN/A        panic("Generic translation shouldn't be used in full system mode.\n");
432497SN/A
442497SN/A    Process * p = tc->getProcessPtr();
452497SN/A
462982SN/A    Fault fault = p->pTable->translate(req);
4710405Sandreas.hansson@arm.com    if(fault != NoFault)
482497SN/A        return fault;
492497SN/A
5011793Sbrandon.potter@amd.com    return NoFault;
5111793Sbrandon.potter@amd.com}
5212334Sgabeblack@google.com
532548SN/Avoid
5410405Sandreas.hansson@arm.comGenericTLB::translateTiming(RequestPtr req, ThreadContext *tc,
559152SN/A        Translation *translation, Mode mode)
5610405Sandreas.hansson@arm.com{
572497SN/A    assert(translation);
5810405Sandreas.hansson@arm.com    translation->finish(translateAtomic(req, tc, mode), req, tc, mode);
599157SN/A}
6010719SMarco.Balboni@ARM.com
6110719SMarco.Balboni@ARM.comvoid
6210719SMarco.Balboni@ARM.comGenericTLB::demapPage(Addr vaddr, uint64_t asn)
6310719SMarco.Balboni@ARM.com{
649279SN/A    warn("Demapping pages in the generic TLB is unnecessary.\n");
659279SN/A}
669279SN/A