faults.cc revision 8518
16167SN/A/*
26167SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan
36167SN/A * All rights reserved.
410036SAli.Saidi@ARM.com *
58835SAli.Saidi@ARM.com * Redistribution and use in source and binary forms, with or without
610036SAli.Saidi@ARM.com * modification, are permitted provided that the following conditions are
77935SN/A * met: redistributions of source code must retain the above copyright
87935SN/A * notice, this list of conditions and the following disclaimer;
97935SN/A * redistributions in binary form must reproduce the above copyright
106167SN/A * notice, this list of conditions and the following disclaimer in the
116167SN/A * documentation and/or other materials provided with the distribution;
126167SN/A * neither the name of the copyright holders nor the names of its
1310093Snilay@cs.wisc.edu * contributors may be used to endorse or promote products derived from
148835SAli.Saidi@ARM.com * this software without specific prior written permission.
159864Snilay@cs.wisc.edu *
169864Snilay@cs.wisc.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1710036SAli.Saidi@ARM.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
188835SAli.Saidi@ARM.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
198835SAli.Saidi@ARM.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
208835SAli.Saidi@ARM.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2110093Snilay@cs.wisc.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
227935SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
239864Snilay@cs.wisc.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
248540SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
258721SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
268835SAli.Saidi@ARM.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
278835SAli.Saidi@ARM.com *
287935SN/A * Authors: Nathan Binkert
297935SN/A *          Gabe Black
307935SN/A */
317935SN/A
327935SN/A#include "arch/isa_traits.hh"
337935SN/A#include "base/misc.hh"
347935SN/A#include "cpu/base.hh"
358983Snate@binkert.org#include "cpu/thread_context.hh"
366167SN/A#include "debug/Fault.hh"
379864Snilay@cs.wisc.edu#include "mem/page_table.hh"
389864Snilay@cs.wisc.edu#include "sim/faults.hh"
399864Snilay@cs.wisc.edu#include "sim/process.hh"
4010036SAli.Saidi@ARM.com
419864Snilay@cs.wisc.edu#if !FULL_SYSTEM
429864Snilay@cs.wisc.eduvoid FaultBase::invoke(ThreadContext * tc, StaticInstPtr inst)
436167SN/A{
446167SN/A    panic("fault (%s) detected @ PC %s", name(), tc->pcState());
459864Snilay@cs.wisc.edu}
4610093Snilay@cs.wisc.edu#else
476167SN/Avoid FaultBase::invoke(ThreadContext * tc, StaticInstPtr inst)
489864Snilay@cs.wisc.edu{
496167SN/A    DPRINTF(Fault, "Fault %s at PC: %s\n", name(), tc->pcState());
506167SN/A    assert(!tc->misspeculating());
518835SAli.Saidi@ARM.com}
526167SN/A#endif
536167SN/A
5410036SAli.Saidi@ARM.comvoid UnimpFault::invoke(ThreadContext * tc, StaticInstPtr inst)
556167SN/A{
566167SN/A    panic("Unimpfault: %s\n", panicStr.c_str());
578835SAli.Saidi@ARM.com}
589469Snilay@cs.wisc.edu
596167SN/A#if !FULL_SYSTEM
606167SN/Avoid GenericPageTableFault::invoke(ThreadContext *tc, StaticInstPtr inst)
616167SN/A{
626167SN/A    Process *p = tc->getProcessPtr();
636167SN/A
646167SN/A    if (!p->checkAndAllocNextPage(vaddr))
658835SAli.Saidi@ARM.com        panic("Page table fault when accessing virtual address %#x\n", vaddr);
666167SN/A
679864Snilay@cs.wisc.edu}
689469Snilay@cs.wisc.edu
696167SN/Avoid GenericAlignmentFault::invoke(ThreadContext *tc, StaticInstPtr inst)
706167SN/A{
716167SN/A    panic("Alignment fault when accessing virtual address %#x\n", vaddr);
729469Snilay@cs.wisc.edu}
739469Snilay@cs.wisc.edu#endif
746167SN/A