faults.cc revision 8589:d0772caaeacd
1955SN/A/* 2955SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan 31762SN/A * All rights reserved. 4955SN/A * 5955SN/A * Redistribution and use in source and binary forms, with or without 6955SN/A * modification, are permitted provided that the following conditions are 7955SN/A * met: redistributions of source code must retain the above copyright 8955SN/A * notice, this list of conditions and the following disclaimer; 9955SN/A * redistributions in binary form must reproduce the above copyright 10955SN/A * notice, this list of conditions and the following disclaimer in the 11955SN/A * documentation and/or other materials provided with the distribution; 12955SN/A * neither the name of the copyright holders nor the names of its 13955SN/A * contributors may be used to endorse or promote products derived from 14955SN/A * this software without specific prior written permission. 15955SN/A * 16955SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17955SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18955SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19955SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20955SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21955SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22955SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23955SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24955SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25955SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26955SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27955SN/A * 282665Ssaidi@eecs.umich.edu * Authors: Nathan Binkert 292665Ssaidi@eecs.umich.edu * Gabe Black 30955SN/A */ 31955SN/A 32955SN/A#include "arch/isa_traits.hh" 33955SN/A#include "base/misc.hh" 34955SN/A#include "cpu/base.hh" 352632Sstever@eecs.umich.edu#include "cpu/thread_context.hh" 362632Sstever@eecs.umich.edu#include "debug/Fault.hh" 372632Sstever@eecs.umich.edu#include "mem/page_table.hh" 382632Sstever@eecs.umich.edu#include "sim/faults.hh" 39955SN/A#include "sim/process.hh" 402632Sstever@eecs.umich.edu 412632Sstever@eecs.umich.eduvoid FaultBase::invoke(ThreadContext * tc, StaticInstPtr inst) 422761Sstever@eecs.umich.edu{ 432632Sstever@eecs.umich.edu if (FULL_SYSTEM) { 442632Sstever@eecs.umich.edu DPRINTF(Fault, "Fault %s at PC: %s\n", name(), tc->pcState()); 452632Sstever@eecs.umich.edu assert(!tc->misspeculating()); 462761Sstever@eecs.umich.edu } else { 472761Sstever@eecs.umich.edu panic("fault (%s) detected @ PC %s", name(), tc->pcState()); 482761Sstever@eecs.umich.edu } 492632Sstever@eecs.umich.edu} 502632Sstever@eecs.umich.edu 512761Sstever@eecs.umich.eduvoid UnimpFault::invoke(ThreadContext * tc, StaticInstPtr inst) 522761Sstever@eecs.umich.edu{ 532761Sstever@eecs.umich.edu panic("Unimpfault: %s\n", panicStr.c_str()); 542761Sstever@eecs.umich.edu} 552761Sstever@eecs.umich.edu 562632Sstever@eecs.umich.eduvoid ReExec::invoke(ThreadContext *tc, StaticInstPtr inst) 572632Sstever@eecs.umich.edu{ 582632Sstever@eecs.umich.edu tc->pcState(tc->pcState()); 592632Sstever@eecs.umich.edu} 602632Sstever@eecs.umich.edu 612632Sstever@eecs.umich.eduvoid GenericPageTableFault::invoke(ThreadContext *tc, StaticInstPtr inst) 622632Sstever@eecs.umich.edu{ 63955SN/A bool handled = false; 64955SN/A#if !FULL_SYSTEM 65955SN/A Process *p = tc->getProcessPtr(); 66955SN/A 67955SN/A handled = p->fixupStackFault(vaddr); 685396Ssaidi@eecs.umich.edu#endif 694202Sbinkertn@umich.edu if (!handled) 705342Sstever@gmail.com panic("Page table fault when accessing virtual address %#x\n", vaddr); 71955SN/A 725273Sstever@gmail.com} 735273Sstever@gmail.com 742656Sstever@eecs.umich.eduvoid GenericAlignmentFault::invoke(ThreadContext *tc, StaticInstPtr inst) 752656Sstever@eecs.umich.edu{ 762656Sstever@eecs.umich.edu panic("Alignment fault when accessing virtual address %#x\n", vaddr); 772656Sstever@eecs.umich.edu} 782656Sstever@eecs.umich.edu