faults.cc revision 8545
12567SN/A/* 22567SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan 32567SN/A * All rights reserved. 42567SN/A * 52567SN/A * Redistribution and use in source and binary forms, with or without 62567SN/A * modification, are permitted provided that the following conditions are 72567SN/A * met: redistributions of source code must retain the above copyright 82567SN/A * notice, this list of conditions and the following disclaimer; 92567SN/A * redistributions in binary form must reproduce the above copyright 102567SN/A * notice, this list of conditions and the following disclaimer in the 112567SN/A * documentation and/or other materials provided with the distribution; 122567SN/A * neither the name of the copyright holders nor the names of its 132567SN/A * contributors may be used to endorse or promote products derived from 142567SN/A * this software without specific prior written permission. 152567SN/A * 162567SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172567SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182567SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192567SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202567SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212567SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222567SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232567SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242567SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252567SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262567SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu * 282665Ssaidi@eecs.umich.edu * Authors: Nathan Binkert 292567SN/A * Gabe Black 302567SN/A */ 312567SN/A 322567SN/A#include "arch/isa_traits.hh" 332567SN/A#include "base/misc.hh" 342567SN/A#include "cpu/base.hh" 352567SN/A#include "cpu/thread_context.hh" 362567SN/A#include "debug/Fault.hh" 372567SN/A#include "mem/page_table.hh" 382567SN/A#include "sim/faults.hh" 392567SN/A#include "sim/process.hh" 402567SN/A 412567SN/A#if !FULL_SYSTEM 422567SN/Avoid FaultBase::invoke(ThreadContext * tc, StaticInstPtr inst) 432567SN/A{ 442567SN/A panic("fault (%s) detected @ PC %s", name(), tc->pcState()); 453745Sgblack@eecs.umich.edu} 463745Sgblack@eecs.umich.edu#else 473745Sgblack@eecs.umich.eduvoid FaultBase::invoke(ThreadContext * tc, StaticInstPtr inst) 483745Sgblack@eecs.umich.edu{ 492567SN/A DPRINTF(Fault, "Fault %s at PC: %s\n", name(), tc->pcState()); 502567SN/A assert(!tc->misspeculating()); 512567SN/A} 522567SN/A#endif 533745Sgblack@eecs.umich.edu 543745Sgblack@eecs.umich.eduvoid UnimpFault::invoke(ThreadContext * tc, StaticInstPtr inst) 553745Sgblack@eecs.umich.edu{ 562567SN/A panic("Unimpfault: %s\n", panicStr.c_str()); 573584Ssaidi@eecs.umich.edu} 583584Ssaidi@eecs.umich.edu 593584Ssaidi@eecs.umich.eduvoid ReExec::invoke(ThreadContext *tc, StaticInstPtr inst) 603584Ssaidi@eecs.umich.edu{ 612567SN/A tc->pcState(tc->pcState()); 623745Sgblack@eecs.umich.edu} 633745Sgblack@eecs.umich.edu 643745Sgblack@eecs.umich.edu 653745Sgblack@eecs.umich.edu#if !FULL_SYSTEM 663745Sgblack@eecs.umich.eduvoid GenericPageTableFault::invoke(ThreadContext *tc, StaticInstPtr inst) 673745Sgblack@eecs.umich.edu{ 683745Sgblack@eecs.umich.edu Process *p = tc->getProcessPtr(); 693745Sgblack@eecs.umich.edu 703745Sgblack@eecs.umich.edu if (!p->fixupStackFault(vaddr)) 713745Sgblack@eecs.umich.edu panic("Page table fault when accessing virtual address %#x\n", vaddr); 723745Sgblack@eecs.umich.edu 733745Sgblack@eecs.umich.edu} 742567SN/A 752567SN/Avoid GenericAlignmentFault::invoke(ThreadContext *tc, StaticInstPtr inst) 762567SN/A{ 772567SN/A panic("Alignment fault when accessing virtual address %#x\n", vaddr); 783584Ssaidi@eecs.umich.edu} 792567SN/A#endif 802567SN/A