early_kernel_symbols = Param.Bool(False,
"enable early kernel symbol tables before MMU")
enable_context_switch_stats_dump = Param.Bool(False, "enable stats/task info dumping at context switch boundaries")
+
+ panic_on_panic = Param.Bool(False, "Trigger a gem5 panic if the " \
+ "guest kernel panics")
+ panic_on_oops = Param.Bool(False, "Trigger a gem5 panic if the " \
+ "guest kernel oopses")
LinuxArmSystem::LinuxArmSystem(Params *p)
: ArmSystem(p),
- enableContextSwitchStatsDump(p->enable_context_switch_stats_dump)
+ enableContextSwitchStatsDump(p->enable_context_switch_stats_dump),
+ kernelPanicEvent(NULL), kernelOopsEvent(NULL)
{
+ if (p->panic_on_panic) {
+ kernelPanicEvent = addKernelFuncEventOrPanic<PanicPCEvent>(
+ "panic", "Kernel panic in simulated kernel");
+ } else {
#ifndef NDEBUG
- kernelPanicEvent = addKernelFuncEventOrPanic<BreakPCEvent>("panic");
+ kernelPanicEvent = addKernelFuncEventOrPanic<BreakPCEvent>("panic");
#endif
+ }
+
+ if (p->panic_on_oops) {
+ kernelOopsEvent = addKernelFuncEventOrPanic<PanicPCEvent>(
+ "oops_exit", "Kernel oops in guest");
+ }
// With ARM udelay() is #defined to __udelay
uDelaySkipEvent = addKernelFuncEventOrPanic<UDelayEvent>(
void mapPid(ThreadContext* tc, uint32_t pid);
private:
-#ifndef NDEBUG
/** Event to halt the simulator if the kernel calls panic() */
- BreakPCEvent *kernelPanicEvent;
-#endif
+ PCEvent *kernelPanicEvent;
+
+ /** Event to halt the simulator if the kernel calls oopses */
+ PCEvent *kernelOopsEvent;
+
/**
* PC based event to skip udelay(<time>) calls and quiesce the
* processor for the appropriate amount of time. This is not functionally
}
}
+
+PanicPCEvent::PanicPCEvent(PCEventQueue *q, const std::string &desc, Addr pc)
+ : PCEvent(q, desc, pc)
+{
+}
+
+void
+PanicPCEvent::process(ThreadContext *tc)
+{
+ StringWrap name(tc->getCpuPtr()->name() + ".panic_event");
+ panic(descr());
+}
void sched_break_pc(Addr addr);
+class PanicPCEvent : public PCEvent
+{
+ public:
+ PanicPCEvent(PCEventQueue *q, const std::string &desc, Addr pc);
+ virtual void process(ThreadContext *tc);
+};
+
#endif // __PC_EVENT_HH__
system = FSConfig.makeArmSystem(self.mem_mode,
self.machine_type,
None, False)
+
+ # We typically want the simulator to panic if the kernel
+ # panics or oopses. This prevents the simulator from running
+ # an obviously failed test case until the end of time.
+ system.panic_on_panic = True
+ system.panic_on_oops = True
+
self.init_system(system)
return system