* Gabe Black
*/
+#include "arch/isa_traits.hh"
#include "base/misc.hh"
-#include "sim/faults.hh"
-#include "cpu/exec_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"
-#if !FULL_SYSTEM
-void FaultBase::invoke(ExecContext * xc)
+void FaultBase::invoke(ThreadContext * tc, const StaticInstPtr &inst)
{
- fatal("fault (%s) detected @ PC 0x%08p", name(), xc->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(ExecContext * xc)
+
+void UnimpFault::invoke(ThreadContext * tc, const StaticInstPtr &inst)
{
- DPRINTF(Fault, "Fault %s at PC: %#x\n", name(), xc->readPC());
- xc->getCpuPtr()->recordEvent(csprintf("Fault %s", name()));
+ panic("Unimpfault: %s\n", panicStr.c_str());
+}
- assert(!xc->misspeculating());
+void ReExec::invoke(ThreadContext *tc, const StaticInstPtr &inst)
+{
+ tc->pcState(tc->pcState());
}
-#endif
-void UnimpFault::invoke(ExecContext * xc)
+void GenericPageTableFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
{
- panic("Unimpfault: %s\n", panicStr.c_str());
+ 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, const StaticInstPtr &inst)
+{
+ panic("Alignment fault when accessing virtual address %#x\n", vaddr);
}