summaryrefslogtreecommitdiff
path: root/kern/linux
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2005-09-24 14:20:29 -0400
committerSteve Reinhardt <stever@eecs.umich.edu>2005-09-24 14:20:29 -0400
commitd60de7122da3a90a0204853f633d34d93dcc622f (patch)
treef924b3f340c67c752efd7648b8e1f7ce7958425d /kern/linux
parentb15a7aaf5e2099a3d13061c63246bed8378d2e2f (diff)
downloadgem5-d60de7122da3a90a0204853f633d34d93dcc622f.tar.xz
Add functions to System object to set up function-based events,
including automatically fixing up addresses to deal with optionally executed Alpha gp update prolog. SConscript: Remove freebsd_events.cc and linux_events.cc. base/remote_gdb.cc: cpu/pc_event.cc: kern/system_events.cc: kern/system_events.hh: PCEvents now schedule themselves in constructor. cpu/pc_event.hh: PCEvents now schedule themselves in the constructor. Get rid of constructor versions that don't take an address and all the schedule() methods that are now unnecessary. kern/freebsd/freebsd_system.cc: kern/freebsd/freebsd_system.hh: Use new System methods to schedule function-based events. Move FreeBSD-specific function event classes into FreebsdSystem. kern/linux/linux_system.cc: kern/linux/linux_system.hh: Use new System methods to schedule function-based events. Move Linux-specific function event classes into LinuxSystem. kern/tru64/tru64_events.hh: PCEvents now schedule themselves in constructor. Add DebugPrintfrEvent to encapsulate raw setting as new type (to work better with new System function-event method.) kern/tru64/tru64_system.cc: Use new System methods to schedule function-based events. kern/tru64/tru64_system.hh: Add DebugPrintfrEvent to encapsulate raw setting as new type (to work better with new System function-event method.) sim/system.cc: sim/system.hh: Add functions to set up function-based events, including automatically fixing up addresses to deal with optionally executed Alpha gp update prolog. --HG-- extra : convert_revision : c2cf09144297b6602afe755a34a0a2227023783f
Diffstat (limited to 'kern/linux')
-rw-r--r--kern/linux/linux_system.cc118
-rw-r--r--kern/linux/linux_system.hh34
2 files changed, 94 insertions, 58 deletions
diff --git a/kern/linux/linux_system.cc b/kern/linux/linux_system.cc
index e3b9990c5..addce0389 100644
--- a/kern/linux/linux_system.cc
+++ b/kern/linux/linux_system.cc
@@ -38,12 +38,14 @@
#include "base/loader/symtab.hh"
#include "cpu/exec_context.hh"
#include "cpu/base.hh"
-#include "kern/linux/linux_events.hh"
#include "kern/linux/linux_system.hh"
+#include "kern/linux/linux_threadinfo.hh"
+#include "kern/linux/printk.hh"
#include "mem/functional/memory_control.hh"
#include "mem/functional/physical.hh"
#include "sim/builder.hh"
#include "dev/platform.hh"
+#include "targetarch/arguments.hh"
#include "targetarch/vtophys.hh"
using namespace std;
@@ -106,80 +108,57 @@ LinuxSystem::LinuxSystem(Params *p)
panic("could not find dp264_mv\n");
#ifndef NDEBUG
- kernelPanicEvent = new BreakPCEvent(&pcEventQueue, "kernel panic");
- if (kernelSymtab->findAddress("panic", addr))
- kernelPanicEvent->schedule(addr);
- else
+ kernelPanicEvent = addKernelFuncEvent<BreakPCEvent>("panic");
+ if (!kernelPanicEvent)
panic("could not find kernel symbol \'panic\'");
+
#if 0
- kernelDieEvent = new BreakPCEvent(&pcEventQueue, "die if kernel");
- if (kernelSymtab->findAddress("die_if_kernel", addr))
- kernelDieEvent->schedule(addr);
- else
+ kernelDieEvent = addKernelFuncEvent<BreakPCEvent>("die_if_kernel");
+ if (!kernelDieEvent)
panic("could not find kernel symbol \'die_if_kernel\'");
#endif
#endif
/**
- * Any time ide_delay_50ms, calibarte_delay or
+v * Any time ide_delay_50ms, calibarte_delay or
* determine_cpu_caches is called just skip the
* function. Currently determine_cpu_caches only is used put
* information in proc, however if that changes in the future we
* will have to fill in the cache size variables appropriately.
*/
- skipIdeDelay50msEvent = new SkipFuncEvent(&pcEventQueue, "ide_delay_50ms");
- if (kernelSymtab->findAddress("ide_delay_50ms", addr))
- skipIdeDelay50msEvent->schedule(addr+sizeof(MachInst));
-
- skipDelayLoopEvent = new LinuxSkipDelayLoopEvent(&pcEventQueue,
- "calibrate_delay");
- if (kernelSymtab->findAddress("calibrate_delay", addr)) {
- skipDelayLoopEvent->schedule(addr + 3 * sizeof(MachInst));
- }
-
- skipCacheProbeEvent = new SkipFuncEvent(&pcEventQueue,
- "determine_cpu_caches");
- if (kernelSymtab->findAddress("determine_cpu_caches", addr))
- skipCacheProbeEvent->schedule(addr+sizeof(MachInst));
-
- debugPrintkEvent = new DebugPrintkEvent(&pcEventQueue, "dprintk");
- if (kernelSymtab->findAddress("dprintk", addr))
- debugPrintkEvent->schedule(addr+8);
-
- idleStartEvent = new IdleStartEvent(&pcEventQueue, "cpu_idle", this);
- if (kernelSymtab->findAddress("cpu_idle", addr))
- idleStartEvent->schedule(addr);
-
- printThreadEvent = new PrintThreadInfo(&pcEventQueue, "threadinfo");
- if (kernelSymtab->findAddress("alpha_switch_to", addr) && DTRACE(Thread))
- printThreadEvent->schedule(addr + sizeof(MachInst) * 6);
- intStartEvent = new InterruptStartEvent(&pcEventQueue, "intStartEvent");
+ skipIdeDelay50msEvent =
+ addKernelFuncEvent<SkipFuncEvent>("ide_delay_50ms");
+ skipDelayLoopEvent =
+ addKernelFuncEvent<SkipDelayLoopEvent>("calibrate_delay");
+ skipCacheProbeEvent =
+ addKernelFuncEvent<SkipFuncEvent>("determine_cpu_caches");
+ debugPrintkEvent = addKernelFuncEvent<DebugPrintkEvent>("dprintk");
+ idleStartEvent = addKernelFuncEvent<IdleStartEvent>("cpu_idle");
+
+ if (kernelSymtab->findAddress("alpha_switch_to", addr) && DTRACE(Thread)) {
+ printThreadEvent = new PrintThreadInfo(&pcEventQueue, "threadinfo",
+ addr + sizeof(MachInst) * 6);
+ } else {
+ printThreadEvent = NULL;
+ }
if (params->bin_int) {
- if (palSymtab->findAddress("sys_int_21", addr))
- intStartEvent->schedule(addr + sizeof(MachInst) * 2);
- else
+ intStartEvent = addPalFuncEvent<InterruptStartEvent>("sys_int_21");
+ if (!intStartEvent)
panic("could not find symbol: sys_int_21\n");
- intEndEvent = new InterruptEndEvent(&pcEventQueue, "intEndEvent");
- if (palSymtab->findAddress("rti_to_kern", addr))
- intEndEvent->schedule(addr) ;
- else
+ intEndEvent = addPalFuncEvent<InterruptEndEvent>("rti_to_kern");
+ if (!intEndEvent)
panic("could not find symbol: rti_to_kern\n");
- intEndEvent2 = new InterruptEndEvent(&pcEventQueue, "intEndEvent2");
- if (palSymtab->findAddress("rti_to_user", addr))
- intEndEvent2->schedule(addr);
- else
+ intEndEvent2 = addPalFuncEvent<InterruptEndEvent>("rti_to_user");
+ if (!intEndEvent2)
panic("could not find symbol: rti_to_user\n");
-
- intEndEvent3 = new InterruptEndEvent(&pcEventQueue, "intEndEvent3");
- if (kernelSymtab->findAddress("do_softirq", addr))
- intEndEvent3->schedule(addr + sizeof(MachInst) * 2);
- else
+ intEndEvent3 = addKernelFuncEvent<InterruptEndEvent>("do_softirq");
+ if (!intEndEvent3)
panic("could not find symbol: do_softirq\n");
}
}
@@ -218,6 +197,39 @@ LinuxSystem::setDelayLoop(ExecContext *xc)
}
}
+void
+LinuxSystem::SkipDelayLoopEvent::process(ExecContext *xc)
+{
+ SkipFuncEvent::process(xc);
+ // calculate and set loops_per_jiffy
+ ((LinuxSystem *)xc->system)->setDelayLoop(xc);
+}
+
+void
+LinuxSystem::DebugPrintkEvent::process(ExecContext *xc)
+{
+ if (DTRACE(DebugPrintf)) {
+ if (!raw) {
+ StringWrap name(xc->system->name() + ".dprintk");
+ DPRINTFN("");
+ }
+
+ AlphaArguments args(xc);
+ Printk(args);
+ SkipFuncEvent::process(xc);
+ }
+}
+
+void
+LinuxSystem::PrintThreadInfo::process(ExecContext *xc)
+{
+ Linux::ThreadInfo ti(xc);
+
+ DPRINTF(Thread, "Currently Executing Thread %s, pid %d, started at: %d\n",
+ ti.curTaskName(), ti.curTaskPID(), ti.curTaskStart());
+}
+
+
BEGIN_DECLARE_SIM_OBJECT_PARAMS(LinuxSystem)
Param<Tick> boot_cpu_frequency;
diff --git a/kern/linux/linux_system.hh b/kern/linux/linux_system.hh
index 2ddddbc1a..f883bef93 100644
--- a/kern/linux/linux_system.hh
+++ b/kern/linux/linux_system.hh
@@ -32,10 +32,6 @@
class ExecContext;
class BreakPCEvent;
-class DebugPrintkEvent;
-class BreakPCEvent;
-class LinuxSkipDelayLoopEvent;
-class SkipFuncEvent;
class IdleStartEvent;
class PrintThreadInfo;
@@ -47,6 +43,34 @@ class PrintThreadInfo;
class LinuxSystem : public System
{
private:
+ class SkipDelayLoopEvent : public SkipFuncEvent
+ {
+ public:
+ SkipDelayLoopEvent(PCEventQueue *q, const std::string &desc, Addr addr)
+ : SkipFuncEvent(q, desc, addr) {}
+ virtual void process(ExecContext *xc);
+ };
+
+ class DebugPrintkEvent : public SkipFuncEvent
+ {
+ private:
+ bool raw;
+
+ public:
+ DebugPrintkEvent(PCEventQueue *q, const std::string &desc, Addr addr,
+ bool r = false)
+ : SkipFuncEvent(q, desc, addr), raw(r) {}
+ virtual void process(ExecContext *xc);
+ };
+
+ class PrintThreadInfo : public PCEvent
+ {
+ public:
+ PrintThreadInfo(PCEventQueue *q, const std::string &desc, Addr addr)
+ : PCEvent(q, desc, addr) {}
+ virtual void process(ExecContext *xc);
+ };
+
/**
* Addresses defining where the kernel bootloader places various
* elements. Details found in include/asm-alpha/system.h
@@ -94,7 +118,7 @@ class LinuxSystem : public System
* Skip calculate_delay_loop() rather than waiting for this to be
* calculated
*/
- LinuxSkipDelayLoopEvent *skipDelayLoopEvent;
+ SkipDelayLoopEvent *skipDelayLoopEvent;
/**
* Event to print information about thread switches if the trace flag