faults.cc revision 8405
1545SN/A/* 211010Sandreas.sandberg@arm.com * Copyright (c) 2003-2005 The Regents of The University of Michigan 38948SN/A * All rights reserved. 48948SN/A * 58948SN/A * Redistribution and use in source and binary forms, with or without 68948SN/A * modification, are permitted provided that the following conditions are 78948SN/A * met: redistributions of source code must retain the above copyright 88948SN/A * notice, this list of conditions and the following disclaimer; 98948SN/A * redistributions in binary form must reproduce the above copyright 108948SN/A * notice, this list of conditions and the following disclaimer in the 118948SN/A * documentation and/or other materials provided with the distribution; 128948SN/A * neither the name of the copyright holders nor the names of its 138948SN/A * contributors may be used to endorse or promote products derived from 142512SN/A * this software without specific prior written permission. 15545SN/A * 16545SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17545SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18545SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19545SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20545SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21545SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22545SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23545SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24545SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25545SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26545SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27545SN/A * 28545SN/A * Authors: Nathan Binkert 29545SN/A * Gabe Black 30545SN/A */ 31545SN/A 32545SN/A#include "arch/isa_traits.hh" 33545SN/A#include "base/misc.hh" 34545SN/A#include "cpu/base.hh" 35545SN/A#include "cpu/thread_context.hh" 36545SN/A#include "debug/Fault.hh" 37545SN/A#include "mem/page_table.hh" 38545SN/A#include "sim/faults.hh" 392665SN/A#include "sim/process.hh" 402665SN/A 412665SN/A#if !FULL_SYSTEM 429166Sandreas.hansson@arm.comvoid FaultBase::invoke(ThreadContext * tc, StaticInstPtr inst) 4311010Sandreas.sandberg@arm.com{ 44545SN/A panic("fault (%s) detected @ PC %s", name(), tc->pcState()); 45545SN/A} 4611010Sandreas.sandberg@arm.com#else 4711010Sandreas.sandberg@arm.comvoid FaultBase::invoke(ThreadContext * tc, StaticInstPtr inst) 4811010Sandreas.sandberg@arm.com{ 4911010Sandreas.sandberg@arm.com DPRINTF(Fault, "Fault %s at PC: %s\n", name(), tc->pcState()); 503090SN/A assert(!tc->misspeculating()); 518232SN/A} 529152Satgutier@umich.edu#endif 532901SN/A 54545SN/Avoid UnimpFault::invoke(ThreadContext * tc, StaticInstPtr inst) 559165Sandreas.hansson@arm.com{ 5611010Sandreas.sandberg@arm.com panic("Unimpfault: %s\n", panicStr.c_str()); 5711010Sandreas.sandberg@arm.com} 5811010Sandreas.sandberg@arm.com 592489SN/A#if !FULL_SYSTEM 602489SN/Avoid GenericPageTableFault::invoke(ThreadContext *tc, StaticInstPtr inst) 619166Sandreas.hansson@arm.com{ 629166Sandreas.hansson@arm.com Process *p = tc->getProcessPtr(); 639166Sandreas.hansson@arm.com 649166Sandreas.hansson@arm.com if (!p->checkAndAllocNextPage(vaddr)) 659166Sandreas.hansson@arm.com panic("Page table fault when accessing virtual address %#x\n", vaddr); 669166Sandreas.hansson@arm.com 679166Sandreas.hansson@arm.com} 689166Sandreas.hansson@arm.com 699166Sandreas.hansson@arm.comvoid GenericAlignmentFault::invoke(ThreadContext *tc, StaticInstPtr inst) 709166Sandreas.hansson@arm.com{ 719166Sandreas.hansson@arm.com panic("Alignment fault when accessing virtual address %#x\n", vaddr); 729166Sandreas.hansson@arm.com} 739166Sandreas.hansson@arm.com#endif 749166Sandreas.hansson@arm.com