faults.cc revision 8518
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 294762Snate@binkert.org * Gabe Black 30955SN/A */ 315522Snate@binkert.org 326143Snate@binkert.org#include "arch/isa_traits.hh" 334762Snate@binkert.org#include "base/misc.hh" 345522Snate@binkert.org#include "cpu/base.hh" 35955SN/A#include "cpu/thread_context.hh" 365522Snate@binkert.org#include "debug/Fault.hh" 3711974Sgabeblack@google.com#include "mem/page_table.hh" 38955SN/A#include "sim/faults.hh" 395522Snate@binkert.org#include "sim/process.hh" 404202Sbinkertn@umich.edu 415742Snate@binkert.org#if !FULL_SYSTEM 42955SN/Avoid FaultBase::invoke(ThreadContext * tc, StaticInstPtr inst) 434381Sbinkertn@umich.edu{ 444381Sbinkertn@umich.edu panic("fault (%s) detected @ PC %s", name(), tc->pcState()); 458334Snate@binkert.org} 46955SN/A#else 47955SN/Avoid FaultBase::invoke(ThreadContext * tc, StaticInstPtr inst) 484202Sbinkertn@umich.edu{ 49955SN/A DPRINTF(Fault, "Fault %s at PC: %s\n", name(), tc->pcState()); 504382Sbinkertn@umich.edu assert(!tc->misspeculating()); 514382Sbinkertn@umich.edu} 524382Sbinkertn@umich.edu#endif 536654Snate@binkert.org 545517Snate@binkert.orgvoid UnimpFault::invoke(ThreadContext * tc, StaticInstPtr inst) 558614Sgblack@eecs.umich.edu{ 567674Snate@binkert.org panic("Unimpfault: %s\n", panicStr.c_str()); 576143Snate@binkert.org} 586143Snate@binkert.org 596143Snate@binkert.org#if !FULL_SYSTEM 608233Snate@binkert.orgvoid GenericPageTableFault::invoke(ThreadContext *tc, StaticInstPtr inst) 618233Snate@binkert.org{ 628233Snate@binkert.org Process *p = tc->getProcessPtr(); 638233Snate@binkert.org 648233Snate@binkert.org if (!p->checkAndAllocNextPage(vaddr)) 658334Snate@binkert.org panic("Page table fault when accessing virtual address %#x\n", vaddr); 668334Snate@binkert.org 6710453SAndrew.Bardsley@arm.com} 6810453SAndrew.Bardsley@arm.com 698233Snate@binkert.orgvoid GenericAlignmentFault::invoke(ThreadContext *tc, StaticInstPtr inst) 708233Snate@binkert.org{ 718233Snate@binkert.org panic("Alignment fault when accessing virtual address %#x\n", vaddr); 728233Snate@binkert.org} 738233Snate@binkert.org#endif 748233Snate@binkert.org