#include "arch/isa_traits.hh"
#include "base/misc.hh"
-#include "cpu/thread_context.hh"
#include "cpu/base.hh"
+#include "cpu/thread_context.hh"
+#include "debug/Fault.hh"
+#include "mem/page_table.hh"
#include "sim/faults.hh"
+#include "sim/full_system.hh"
#include "sim/process.hh"
-#include "mem/page_table.hh"
-#if !FULL_SYSTEM
-void FaultBase::invoke(ThreadContext * tc)
+void FaultBase::invoke(ThreadContext * tc, const StaticInstPtr &inst)
{
- panic("fault (%s) detected @ PC %p", name(), tc->readPC());
+ if (FullSystem) {
+ DPRINTF(Fault, "Fault %s at PC: %s\n", name(), tc->pcState());
+ } else {
+ panic("fault (%s) detected @ PC %s", name(), tc->pcState());
+ }
}
-#else
-void FaultBase::invoke(ThreadContext * tc)
-{
- DPRINTF(Fault, "Fault %s at PC: %#x\n", name(), tc->readPC());
- tc->getCpuPtr()->recordEvent(csprintf("Fault %s", name()));
- assert(!tc->misspeculating());
-}
-#endif
-
-void UnimpFault::invoke(ThreadContext * tc)
+void UnimpFault::invoke(ThreadContext * tc, const StaticInstPtr &inst)
{
panic("Unimpfault: %s\n", panicStr.c_str());
}
-#if !FULL_SYSTEM
-void GenericPageTableFault::invoke(ThreadContext *tc)
+void ReExec::invoke(ThreadContext *tc, const StaticInstPtr &inst)
{
- Process *p = tc->getProcessPtr();
+ tc->pcState(tc->pcState());
+}
- if (!p->checkAndAllocNextPage(vaddr))
+void GenericPageTableFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
+{
+ bool handled = false;
+ if (!FullSystem) {
+ Process *p = tc->getProcessPtr();
+ handled = p->fixupStackFault(vaddr);
+ }
+ if (!handled)
panic("Page table fault when accessing virtual address %#x\n", vaddr);
}
-void GenericAlignmentFault::invoke(ThreadContext *tc)
+void GenericAlignmentFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
{
panic("Alignment fault when accessing virtual address %#x\n", vaddr);
}
-#endif