tlb.cc revision 5894
110448Snilay@cs.wisc.edu/*
210448Snilay@cs.wisc.edu * Copyright (c) 2001-2005 The Regents of The University of Michigan
310448Snilay@cs.wisc.edu * All rights reserved.
410448Snilay@cs.wisc.edu *
510448Snilay@cs.wisc.edu * Redistribution and use in source and binary forms, with or without
610448Snilay@cs.wisc.edu * modification, are permitted provided that the following conditions are
710448Snilay@cs.wisc.edu * met: redistributions of source code must retain the above copyright
810448Snilay@cs.wisc.edu * notice, this list of conditions and the following disclaimer;
910448Snilay@cs.wisc.edu * redistributions in binary form must reproduce the above copyright
1010448Snilay@cs.wisc.edu * notice, this list of conditions and the following disclaimer in the
1110448Snilay@cs.wisc.edu * documentation and/or other materials provided with the distribution;
1210448Snilay@cs.wisc.edu * neither the name of the copyright holders nor the names of its
1310448Snilay@cs.wisc.edu * contributors may be used to endorse or promote products derived from
1410448Snilay@cs.wisc.edu * this software without specific prior written permission.
1510448Snilay@cs.wisc.edu *
1610448Snilay@cs.wisc.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1710448Snilay@cs.wisc.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1810448Snilay@cs.wisc.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1910448Snilay@cs.wisc.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2010448Snilay@cs.wisc.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2110448Snilay@cs.wisc.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2210447Snilay@cs.wisc.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2310447Snilay@cs.wisc.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2410447Snilay@cs.wisc.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2510447Snilay@cs.wisc.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2610447Snilay@cs.wisc.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2710447Snilay@cs.wisc.edu *
2810447Snilay@cs.wisc.edu * Authors: Gabe Black
2910447Snilay@cs.wisc.edu */
3010447Snilay@cs.wisc.edu
3110447Snilay@cs.wisc.edu#include "cpu/thread_context.hh"
3210447Snilay@cs.wisc.edu#include "mem/page_table.hh"
3310447Snilay@cs.wisc.edu#include "sim/process.hh"
3410447Snilay@cs.wisc.edu#include "sim/tlb.hh"
3510447Snilay@cs.wisc.edu
3610447Snilay@cs.wisc.eduFault
3710447Snilay@cs.wisc.eduGenericTLB::translateAtomic(RequestPtr req, ThreadContext * tc, bool)
3810447Snilay@cs.wisc.edu{
3910447Snilay@cs.wisc.edu#if FULL_SYSTEM
4010447Snilay@cs.wisc.edu        panic("Generic translation shouldn't be used in full system mode.\n");
4110447Snilay@cs.wisc.edu#else
4210447Snilay@cs.wisc.edu        Process * p = tc->getProcessPtr();
4310447Snilay@cs.wisc.edu
4410447Snilay@cs.wisc.edu        Fault fault = p->pTable->translate(req);
4510447Snilay@cs.wisc.edu        if(fault != NoFault)
4610447Snilay@cs.wisc.edu            return fault;
4710447Snilay@cs.wisc.edu
4810447Snilay@cs.wisc.edu        return NoFault;
4910447Snilay@cs.wisc.edu#endif
5010447Snilay@cs.wisc.edu}
5110447Snilay@cs.wisc.edu
5210447Snilay@cs.wisc.eduvoid
5310447Snilay@cs.wisc.eduGenericTLB::translateTiming(RequestPtr req, ThreadContext *tc,
5410447Snilay@cs.wisc.edu        Translation *translation, bool write)
5510447Snilay@cs.wisc.edu{
5610447Snilay@cs.wisc.edu    assert(translation);
5710447Snilay@cs.wisc.edu    translation->finish(translateAtomic(req, tc, write), req, tc, write);
5810447Snilay@cs.wisc.edu}
5910447Snilay@cs.wisc.edu
6010447Snilay@cs.wisc.eduvoid
6110447Snilay@cs.wisc.eduGenericTLB::demapPage(Addr vaddr, uint64_t asn)
6210447Snilay@cs.wisc.edu{
6310447Snilay@cs.wisc.edu    warn("Demapping pages in the generic TLB is unnecessary.\n");
6410447Snilay@cs.wisc.edu}
6510447Snilay@cs.wisc.edu