faults.cc revision 8589
12068SN/A/* 22068SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan 32068SN/A * All rights reserved. 42068SN/A * 52068SN/A * Redistribution and use in source and binary forms, with or without 62068SN/A * modification, are permitted provided that the following conditions are 72068SN/A * met: redistributions of source code must retain the above copyright 82068SN/A * notice, this list of conditions and the following disclaimer; 92068SN/A * redistributions in binary form must reproduce the above copyright 102068SN/A * notice, this list of conditions and the following disclaimer in the 112068SN/A * documentation and/or other materials provided with the distribution; 122068SN/A * neither the name of the copyright holders nor the names of its 132068SN/A * contributors may be used to endorse or promote products derived from 142068SN/A * this software without specific prior written permission. 152068SN/A * 162068SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172068SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182068SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192068SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202068SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212068SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222068SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232068SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242068SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252068SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262068SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272068SN/A * 282665Ssaidi@eecs.umich.edu * Authors: Nathan Binkert 292665Ssaidi@eecs.umich.edu * Gabe Black 302665Ssaidi@eecs.umich.edu */ 312068SN/A 322649Ssaidi@eecs.umich.edu#include "arch/isa_traits.hh" 332649Ssaidi@eecs.umich.edu#include "base/misc.hh" 342649Ssaidi@eecs.umich.edu#include "cpu/base.hh" 352649Ssaidi@eecs.umich.edu#include "cpu/thread_context.hh" 362649Ssaidi@eecs.umich.edu#include "debug/Fault.hh" 372068SN/A#include "mem/page_table.hh" 382068SN/A#include "sim/faults.hh" 392068SN/A#include "sim/process.hh" 402068SN/A 412068SN/Avoid FaultBase::invoke(ThreadContext * tc, StaticInstPtr inst) 422068SN/A{ 432068SN/A if (FULL_SYSTEM) { 442068SN/A DPRINTF(Fault, "Fault %s at PC: %s\n", name(), tc->pcState()); 452068SN/A assert(!tc->misspeculating()); 465736Snate@binkert.org } else { 472068SN/A panic("fault (%s) detected @ PC %s", name(), tc->pcState()); 482068SN/A } 496181Sksewell@umich.edu} 506181Sksewell@umich.edu 512068SN/Avoid UnimpFault::invoke(ThreadContext * tc, StaticInstPtr inst) 522068SN/A{ 532068SN/A panic("Unimpfault: %s\n", panicStr.c_str()); 542068SN/A} 552068SN/A 562068SN/Avoid ReExec::invoke(ThreadContext *tc, StaticInstPtr inst) 572068SN/A{ 582068SN/A tc->pcState(tc->pcState()); 592068SN/A} 602068SN/A 612068SN/Avoid GenericPageTableFault::invoke(ThreadContext *tc, StaticInstPtr inst) 622068SN/A{ 632068SN/A bool handled = false; 642068SN/A#if !FULL_SYSTEM 652068SN/A Process *p = tc->getProcessPtr(); 662068SN/A 672068SN/A handled = p->fixupStackFault(vaddr); 682068SN/A#endif 696181Sksewell@umich.edu if (!handled) 706181Sksewell@umich.edu panic("Page table fault when accessing virtual address %#x\n", vaddr); 712068SN/A 722068SN/A} 732068SN/A 742068SN/Avoid GenericAlignmentFault::invoke(ThreadContext *tc, StaticInstPtr inst) 752068SN/A{ 762068SN/A panic("Alignment fault when accessing virtual address %#x\n", vaddr); 772068SN/A} 782068SN/A