faults.cc revision 8229
112838Sgabeblack@google.com/* 212838Sgabeblack@google.com * Copyright (c) 2003-2005 The Regents of The University of Michigan 312838Sgabeblack@google.com * All rights reserved. 412838Sgabeblack@google.com * 512838Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 612838Sgabeblack@google.com * modification, are permitted provided that the following conditions are 712838Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 812838Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 912838Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 1012838Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1112838Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1212838Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1312838Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1412838Sgabeblack@google.com * this software without specific prior written permission. 1512838Sgabeblack@google.com * 1612838Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1712838Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1812838Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1912838Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2012838Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2112838Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2212838Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2312838Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2412838Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2512838Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2612838Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2712838Sgabeblack@google.com * 2812838Sgabeblack@google.com * Authors: Nathan Binkert 2912838Sgabeblack@google.com * Gabe Black 3012838Sgabeblack@google.com */ 3112838Sgabeblack@google.com 3212838Sgabeblack@google.com#include "arch/isa_traits.hh" 3312838Sgabeblack@google.com#include "base/misc.hh" 3412838Sgabeblack@google.com#include "cpu/base.hh" 3512838Sgabeblack@google.com#include "cpu/thread_context.hh" 3612852Sgabeblack@google.com#include "mem/page_table.hh" 3712852Sgabeblack@google.com#include "sim/faults.hh" 3812852Sgabeblack@google.com#include "sim/process.hh" 3912852Sgabeblack@google.com 4012852Sgabeblack@google.com#if !FULL_SYSTEM 4112952Sgabeblack@google.comvoid FaultBase::invoke(ThreadContext * tc, StaticInstPtr inst) 4212952Sgabeblack@google.com{ 4312952Sgabeblack@google.com panic("fault (%s) detected @ PC %s", name(), tc->pcState()); 4412952Sgabeblack@google.com} 4512952Sgabeblack@google.com#else 4612952Sgabeblack@google.comvoid FaultBase::invoke(ThreadContext * tc, StaticInstPtr inst) 4712952Sgabeblack@google.com{ 4812952Sgabeblack@google.com DPRINTF(Fault, "Fault %s at PC: %s\n", name(), tc->pcState()); 4912952Sgabeblack@google.com assert(!tc->misspeculating()); 5012952Sgabeblack@google.com} 5112952Sgabeblack@google.com#endif 5212952Sgabeblack@google.com 5312952Sgabeblack@google.comvoid UnimpFault::invoke(ThreadContext * tc, StaticInstPtr inst) 5412952Sgabeblack@google.com{ 5512952Sgabeblack@google.com panic("Unimpfault: %s\n", panicStr.c_str()); 5612952Sgabeblack@google.com} 5712952Sgabeblack@google.com 5812952Sgabeblack@google.com#if !FULL_SYSTEM 5912952Sgabeblack@google.comvoid GenericPageTableFault::invoke(ThreadContext *tc, StaticInstPtr inst) 6012952Sgabeblack@google.com{ 6112952Sgabeblack@google.com Process *p = tc->getProcessPtr(); 6212952Sgabeblack@google.com 6312952Sgabeblack@google.com if (!p->checkAndAllocNextPage(vaddr)) 6412952Sgabeblack@google.com panic("Page table fault when accessing virtual address %#x\n", vaddr); 6512952Sgabeblack@google.com 6612952Sgabeblack@google.com} 6712952Sgabeblack@google.com 6812952Sgabeblack@google.comvoid GenericAlignmentFault::invoke(ThreadContext *tc, StaticInstPtr inst) 6912952Sgabeblack@google.com{ 7012952Sgabeblack@google.com panic("Alignment fault when accessing virtual address %#x\n", vaddr); 7112952Sgabeblack@google.com} 7212952Sgabeblack@google.com#endif 7312952Sgabeblack@google.com