enableContextSwitchStatsDump(p->enable_context_switch_stats_dump)
{
if (p->panic_on_panic) {
- kernelPanicEvent = addKernelFuncEventOrPanic<PanicPCEvent>(
+ kernelPanic = addKernelFuncEventOrPanic<PanicPCEvent>(
"panic", "Kernel panic in simulated kernel");
} else {
#ifndef NDEBUG
- kernelPanicEvent = addKernelFuncEventOrPanic<BreakPCEvent>("panic");
+ kernelPanic = addKernelFuncEventOrPanic<BreakPCEvent>("panic");
#endif
}
if (p->panic_on_oops) {
- kernelOopsEvent = addKernelFuncEventOrPanic<PanicPCEvent>(
+ kernelOops = addKernelFuncEventOrPanic<PanicPCEvent>(
"oops_exit", "Kernel oops in guest");
}
- uDelaySkipEvent = addKernelFuncEvent<UDelayEvent<ArmISA::SkipFunc>>(
+ skipUDelay = addKernelFuncEvent<SkipUDelay<ArmISA::SkipFunc>>(
"DELAY", "DELAY", 1000, 0);
}
FsFreebsd::~FsFreebsd()
{
- delete uDelaySkipEvent;
+ delete skipUDelay;
}
} // namespace ArmISA
private:
/** Event to halt the simulator if the kernel calls panic() */
- PCEvent *kernelPanicEvent = nullptr;
+ PCEvent *kernelPanic = nullptr;
/** Event to halt the simulator if the kernel calls oopses */
- PCEvent *kernelOopsEvent = nullptr;
+ PCEvent *kernelOops = nullptr;
/**
* PC based event to skip udelay(<time>) calls and quiesce the
* processor for the appropriate amount of time. This is not functionally
* required but does speed up simulation.
*/
- FreeBSD::UDelayEvent<SkipFunc> *uDelaySkipEvent = nullptr;
+ FreeBSD::SkipUDelay<SkipFunc> *skipUDelay = nullptr;
/** These variables store addresses of important data structures
* that are normaly kept coherent at boot with cache mainetence operations.
FsLinux::~FsLinux()
{
- delete uDelaySkipEvent;
- delete constUDelaySkipEvent;
+ delete skipUDelay;
+ delete skipConstUDelay;
+ delete kernelOops;
+ delete kernelPanic;
- delete dumpStatsPCEvent;
- delete debugPrintkEvent;
+ delete dumpStats;
+ delete debugPrintk;
}
void
auto *arm_sys = dynamic_cast<ArmSystem *>(system);
if (enableContextSwitchStatsDump) {
- if (!arm_sys->highestELIs64()) {
- dumpStatsPCEvent =
- addKernelFuncEvent<DumpStatsPCEvent>("__switch_to");
- } else {
- dumpStatsPCEvent =
- addKernelFuncEvent<DumpStatsPCEvent64>("__switch_to");
- }
+ if (!arm_sys->highestELIs64())
+ dumpStats = addKernelFuncEvent<DumpStats>("__switch_to");
+ else
+ dumpStats = addKernelFuncEvent<DumpStats64>("__switch_to");
- panic_if(!dumpStatsPCEvent, "dumpStatsPCEvent not created!");
+ panic_if(!dumpStats, "dumpStats not created!");
std::string task_filename = "tasks.txt";
taskFile = simout.create(name() + "." + task_filename);
const std::string dmesg_output = name() + ".dmesg";
if (params()->panic_on_panic) {
- kernelPanicEvent = addKernelFuncEventOrPanic<Linux::KernelPanicEvent>(
+ kernelPanic = addKernelFuncEventOrPanic<Linux::KernelPanic>(
"panic", "Kernel panic in simulated kernel", dmesg_output);
} else {
- kernelPanicEvent = addKernelFuncEventOrPanic<Linux::DmesgDumpEvent>(
+ kernelPanic = addKernelFuncEventOrPanic<Linux::DmesgDump>(
"panic", "Kernel panic in simulated kernel", dmesg_output);
}
if (params()->panic_on_oops) {
- kernelOopsEvent = addKernelFuncEventOrPanic<Linux::KernelPanicEvent>(
+ kernelOops = addKernelFuncEventOrPanic<Linux::KernelPanic>(
"oops_exit", "Kernel oops in guest", dmesg_output);
} else {
- kernelOopsEvent = addKernelFuncEventOrPanic<Linux::DmesgDumpEvent>(
+ kernelOops = addKernelFuncEventOrPanic<Linux::DmesgDump>(
"oops_exit", "Kernel oops in guest", dmesg_output);
}
// With ARM udelay() is #defined to __udelay
// newer kernels use __loop_udelay and __loop_const_udelay symbols
- uDelaySkipEvent = addKernelFuncEvent<UDelayEvent<SkipFunc>>(
+ skipUDelay = addKernelFuncEvent<SkipUDelay<SkipFunc>>(
"__loop_udelay", "__udelay", 1000, 0);
- if (!uDelaySkipEvent)
- uDelaySkipEvent = addKernelFuncEventOrPanic<UDelayEvent<SkipFunc>>(
+ if (!skipUDelay)
+ skipUDelay = addKernelFuncEventOrPanic<SkipUDelay<SkipFunc>>(
"__udelay", "__udelay", 1000, 0);
// constant arguments to udelay() have some precomputation done ahead of
// time. Constant comes from code.
- constUDelaySkipEvent = addKernelFuncEvent<UDelayEvent<SkipFunc>>(
+ skipConstUDelay = addKernelFuncEvent<SkipUDelay<SkipFunc>>(
"__loop_const_udelay", "__const_udelay", 1000, 107374);
- if (!constUDelaySkipEvent)
- constUDelaySkipEvent =
- addKernelFuncEventOrPanic<UDelayEvent<SkipFunc>>(
- "__const_udelay", "__const_udelay", 1000, 107374);
+ if (!skipConstUDelay) {
+ skipConstUDelay = addKernelFuncEventOrPanic<SkipUDelay<SkipFunc>>(
+ "__const_udelay", "__const_udelay", 1000, 107374);
+ }
- debugPrintkEvent =
- addKernelFuncEvent<DebugPrintkEvent<SkipFunc>>("dprintk");
+ debugPrintk = addKernelFuncEvent<DebugPrintk<SkipFunc>>("dprintk");
}
void
* r2 = thread_info of the next process to run
*/
void
-DumpStatsPCEvent::getTaskDetails(ThreadContext *tc, uint32_t &pid,
+DumpStats::getTaskDetails(ThreadContext *tc, uint32_t &pid,
uint32_t &tgid, std::string &next_task_str, int32_t &mm) {
Linux::ThreadInfo ti(tc);
* r1 = task_struct of next process to run
*/
void
-DumpStatsPCEvent64::getTaskDetails(ThreadContext *tc, uint32_t &pid,
+DumpStats64::getTaskDetails(ThreadContext *tc, uint32_t &pid,
uint32_t &tgid, std::string &next_task_str, int32_t &mm) {
Linux::ThreadInfo ti(tc);
* "__switch_to" is called to change running tasks.
*/
void
-DumpStatsPCEvent::process(ThreadContext *tc)
+DumpStats::process(ThreadContext *tc)
{
uint32_t pid = 0;
uint32_t tgid = 0;
namespace ArmISA
{
-class DumpStatsPCEvent;
+class DumpStats;
class FsLinux : public ArmISA::FsWorkload
{
* PC based event to skip the dprink() call and emulate its
* functionality
*/
- Linux::DebugPrintkEvent<SkipFunc> *debugPrintkEvent = nullptr;
+ Linux::DebugPrintk<SkipFunc> *debugPrintk = nullptr;
- DumpStatsPCEvent *dumpStatsPCEvent = nullptr;
+ DumpStats *dumpStats = nullptr;
public:
/** Boilerplate params code */
private:
/** Event to halt the simulator if the kernel calls panic() */
- PCEvent *kernelPanicEvent = nullptr;
+ PCEvent *kernelPanic = nullptr;
/** Event to halt the simulator if the kernel calls oopses */
- PCEvent *kernelOopsEvent = nullptr;
+ PCEvent *kernelOops = nullptr;
/**
* PC based event to skip udelay(<time>) calls and quiesce the
* processor for the appropriate amount of time. This is not functionally
* required but does speed up simulation.
*/
- Linux::UDelayEvent<SkipFunc> *uDelaySkipEvent = nullptr;
+ Linux::SkipUDelay<SkipFunc> *skipUDelay = nullptr;
/** Another PC based skip event for const_udelay(). Similar to the udelay
* skip, but this function precomputes the first multiply that is done
* in the generic case since the parameter is known at compile time.
* Thus we need to do some division to get back to us.
*/
- Linux::UDelayEvent<SkipFunc> *constUDelaySkipEvent = nullptr;
-
+ Linux::SkipUDelay<SkipFunc> *skipConstUDelay = nullptr;
};
-class DumpStatsPCEvent : public PCEvent
+class DumpStats : public PCEvent
{
public:
- DumpStatsPCEvent(PCEventScope *s, const std::string &desc, Addr addr)
+ DumpStats(PCEventScope *s, const std::string &desc, Addr addr)
: PCEvent(s, desc, addr)
{}
};
-class DumpStatsPCEvent64 : public DumpStatsPCEvent
+class DumpStats64 : public DumpStats
{
public:
- DumpStatsPCEvent64(PCEventScope *s, const std::string &desc, Addr addr)
- : DumpStatsPCEvent(s, desc, addr)
- {}
+ using DumpStats::DumpStats;
+
private:
void getTaskDetails(ThreadContext *tc, uint32_t &pid, uint32_t &tgid,
std::string &next_task_str, int32_t &mm) override;
void
-LinuxMipsSystem::SkipDelayLoopEvent::process(ThreadContext *tc)
+LinuxMipsSystem::SkipDelayLoop::process(ThreadContext *tc)
{
MipsISA::SkipFunc::process(tc);
// calculate and set loops_per_jiffy
private:
using SkipFunc = MipsISA::SkipFunc;
- class SkipDelayLoopEvent : public SkipFunc
+ class SkipDelayLoop : public SkipFunc
{
public:
- SkipDelayLoopEvent(PCEventScope *s, const std::string &desc, Addr addr)
- : SkipFunc(s, desc, addr) {}
- virtual void process(ThreadContext *tc);
+ SkipDelayLoop(PCEventScope *s, const std::string &desc, Addr addr) :
+ SkipFunc(s, desc, addr)
+ {}
+ void process(ThreadContext *tc) override;
};
class PrintThreadInfo : public PCEvent
{
public:
- PrintThreadInfo(PCEventScope *s, const std::string &desc, Addr addr)
- : PCEvent(s, desc, addr) {}
- virtual void process(ThreadContext *tc);
+ PrintThreadInfo(PCEventScope *s, const std::string &desc, Addr addr) :
+ PCEvent(s, desc, addr)
+ {}
+ void process(ThreadContext *tc) override;
};
#include "sim/arguments.hh"
#include "sim/system.hh"
-namespace FreeBSD {
+namespace FreeBSD
+{
void
onUDelay(ThreadContext *tc, uint64_t div, uint64_t mul)
{
- int arg_num;
-
- arg_num = 0;
+ int arg_num = 0;
// Get the time in native size
uint64_t time = TheISA::getArgument(tc, arg_num, (uint16_t)-1, false);
- //DPRINTFN("DELAY(%d)\n", time);
-
// convert parameter to ns
if (div)
time /= div;
#include "kern/system_events.hh"
-namespace FreeBSD {
+namespace FreeBSD
+{
void onUDelay(ThreadContext *tc, uint64_t div, uint64_t mul);
* See descriptions of argDivToNs and argMultToNs below.
*/
template <typename Base>
-class UDelayEvent : public Base
+class SkipUDelay : public Base
{
private:
/** value to divide arg by to create ns. This is present beacues the linux
uint64_t argMultToNs;
public:
- UDelayEvent(PCEventScope *s, const std::string &desc, Addr addr,
- uint64_t mult, uint64_t div)
- : Base(s, desc, addr), argDivToNs(div), argMultToNs(mult) {}
+ SkipUDelay(PCEventScope *s, const std::string &desc, Addr addr,
+ uint64_t mult, uint64_t div) :
+ Base(s, desc, addr), argDivToNs(div), argMultToNs(mult)
+ {}
void
process(ThreadContext *tc) override
#include "sim/core.hh"
#include "sim/system.hh"
-namespace Linux {
+namespace Linux
+{
void
onDebugPrintk(ThreadContext *tc)
}
void
-DmesgDumpEvent::process(ThreadContext *tc)
+DmesgDump::process(ThreadContext *tc)
{
inform("Dumping kernel dmesg buffer to %s...\n", fname);
OutputStream *os = simout.create(fname);
}
void
-KernelPanicEvent::process(ThreadContext *tc)
+KernelPanic::process(ThreadContext *tc)
{
inform("Dumping kernel dmesg buffer to %s...\n", fname);
OutputStream *os = simout.create(fname);
#include "kern/system_events.hh"
-namespace Linux {
+namespace Linux
+{
void onDebugPrintk(ThreadContext *tc);
template <typename Base>
-class DebugPrintkEvent : public Base
+class DebugPrintk : public Base
{
public:
- DebugPrintkEvent(PCEventScope *s, const std::string &desc, Addr addr)
- : Base(s, desc, addr) {}
- virtual void
- process(ThreadContext *tc)
+ using Base::Base;
+ void
+ process(ThreadContext *tc) override
{
onDebugPrintk(tc);
Base::process(tc);
* limitations. Most importantly, the kernel's address mappings must
* be available to the translating proxy.
*/
-class DmesgDumpEvent : public PCEvent
+class DmesgDump : public PCEvent
{
protected:
std::string fname;
public:
- DmesgDumpEvent(PCEventScope *s, const std::string &desc, Addr addr,
- const std::string &_fname)
- : PCEvent(s, desc, addr), fname(_fname) {}
- virtual void process(ThreadContext *tc);
+ DmesgDump(PCEventScope *s, const std::string &desc, Addr addr,
+ const std::string &_fname) :
+ PCEvent(s, desc, addr), fname(_fname)
+ {}
+ void process(ThreadContext *tc) override;
};
/**
* limitations. Most importantly, the kernel's address mappings must
* be available to the translating proxy.
*/
-class KernelPanicEvent : public PCEvent
+class KernelPanic : public PCEvent
{
protected:
std::string fname;
public:
- KernelPanicEvent(PCEventScope *s, const std::string &desc, Addr addr,
- const std::string &_fname)
- : PCEvent(s, desc, addr), fname(_fname) {}
- virtual void process(ThreadContext *tc);
+ KernelPanic(PCEventScope *s, const std::string &desc, Addr addr,
+ const std::string &_fname) :
+ PCEvent(s, desc, addr), fname(_fname)
+ {}
+ void process(ThreadContext *tc) override;
};
void onUDelay(ThreadContext *tc, uint64_t div, uint64_t mul);
* See descriptions of argDivToNs and argMultToNs below.
*/
template <typename Base>
-class UDelayEvent : public Base
+class SkipUDelay : public Base
{
private:
- /** value to divide arg by to create ns. This is present beacues the linux
+ /**
+ * Value to divide arg by to create ns. This is present beacues the linux
* kernel code sometime precomputes the first multiply that is done in
* udelay() if the parameter is a constant. We need to undo it so here is
- * how. */
+ * how.
+ */
uint64_t argDivToNs;
- /** value to multiple arg by to create ns. Nominally, this is 1000 to
+ /**
+ * Value to multiple arg by to create ns. Nominally, this is 1000 to
* convert us to ns, but since linux can do some preprocessing of constant
- * values something else might be required. */
+ * values something else might be required.
+ */
uint64_t argMultToNs;
public:
- UDelayEvent(PCEventScope *s, const std::string &desc, Addr addr,
- uint64_t mult, uint64_t div)
- : Base(s, desc, addr), argDivToNs(div), argMultToNs(mult) {}
+ SkipUDelay(PCEventScope *s, const std::string &desc, Addr addr,
+ uint64_t mult, uint64_t div) :
+ Base(s, desc, addr), argDivToNs(div), argMultToNs(mult)
+ {}
- virtual void
- process(ThreadContext *tc)
+ void
+ process(ThreadContext *tc) override
{
onUDelay(tc, argDivToNs, argMultToNs);
Base::process(tc);
}
};
-}
+} // namespace Linux
-#endif
+#endif // __KERN_LINUX_EVENTS_HH__
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef __SYSTEM_EVENTS_HH__
-#define __SYSTEM_EVENTS_HH__
+#ifndef __KERN_SYSTEM_EVENTS_HH__
+#define __KERN_SYSTEM_EVENTS_HH__
#include "cpu/pc_event.hh"
virtual void returnFromFuncIn(ThreadContext *tc) = 0;
public:
- SkipFuncBase(PCEventScope *s, const std::string &desc, Addr addr)
- : PCEvent(s, desc, addr)
+ SkipFuncBase(PCEventScope *s, const std::string &desc, Addr addr) :
+ PCEvent(s, desc, addr)
{}
void process(ThreadContext *tc) override;
};
-#endif // __SYSTEM_EVENTS_HH__
+#endif // __KERN_SYSTEM_EVENTS_HH__