summaryrefslogtreecommitdiff
path: root/sim/system.hh
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 /sim/system.hh
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 'sim/system.hh')
-rw-r--r--sim/system.hh51
1 files changed, 49 insertions, 2 deletions
diff --git a/sim/system.hh b/sim/system.hh
index 870805e4c..c4ecc9458 100644
--- a/sim/system.hh
+++ b/sim/system.hh
@@ -33,6 +33,7 @@
#include <vector>
#include "base/statistics.hh"
+#include "base/loader/symtab.hh"
#include "cpu/pc_event.hh"
#include "kern/system_events.hh"
#include "sim/sim_object.hh"
@@ -45,7 +46,6 @@ class ObjectFile;
class PhysicalMemory;
class Platform;
class RemoteGDB;
-class SymbolTable;
namespace Kernel { class Binning; }
class System : public SimObject
@@ -68,7 +68,7 @@ class System : public SimObject
return numcpus;
}
- /** kernel Symbol table */
+ /** kernel symbol table */
SymbolTable *kernelSymtab;
/** console symbol table */
@@ -102,6 +102,53 @@ class System : public SimObject
BreakPCEvent *consolePanicEvent;
#endif
+ protected:
+
+ /**
+ * Fix up an address used to match PCs for hooking simulator
+ * events on to target function executions. See comment in
+ * system.cc for details.
+ */
+ Addr fixFuncEventAddr(Addr addr);
+
+ /**
+ * Add a function-based event to the given function, to be looked
+ * up in the specified symbol table.
+ */
+ template <class T>
+ T *System::addFuncEvent(SymbolTable *symtab, const char *lbl)
+ {
+ Addr addr;
+
+ if (symtab->findAddress(lbl, addr)) {
+ T *ev = new T(&pcEventQueue, lbl, fixFuncEventAddr(addr));
+ return ev;
+ }
+
+ return NULL;
+ }
+
+ /** Add a function-based event to kernel code. */
+ template <class T>
+ T *System::addKernelFuncEvent(const char *lbl)
+ {
+ return addFuncEvent<T>(kernelSymtab, lbl);
+ }
+
+ /** Add a function-based event to PALcode. */
+ template <class T>
+ T *System::addPalFuncEvent(const char *lbl)
+ {
+ return addFuncEvent<T>(palSymtab, lbl);
+ }
+
+ /** Add a function-based event to the console code. */
+ template <class T>
+ T *System::addConsoleFuncEvent(const char *lbl)
+ {
+ return addFuncEvent<T>(consoleSymtab, lbl);
+ }
+
public:
std::vector<RemoteGDB *> remoteGDB;
std::vector<GDBListener *> gdbListen;