diff options
author | Steve Reinhardt <stever@eecs.umich.edu> | 2005-09-24 14:20:29 -0400 |
---|---|---|
committer | Steve Reinhardt <stever@eecs.umich.edu> | 2005-09-24 14:20:29 -0400 |
commit | d60de7122da3a90a0204853f633d34d93dcc622f (patch) | |
tree | f924b3f340c67c752efd7648b8e1f7ce7958425d /cpu | |
parent | b15a7aaf5e2099a3d13061c63246bed8378d2e2f (diff) | |
download | gem5-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 'cpu')
-rw-r--r-- | cpu/pc_event.cc | 8 | ||||
-rw-r--r-- | cpu/pc_event.hh | 61 |
2 files changed, 18 insertions, 51 deletions
diff --git a/cpu/pc_event.cc b/cpu/pc_event.cc index c3bb3dbe6..83fbc3e2d 100644 --- a/cpu/pc_event.cc +++ b/cpu/pc_event.cc @@ -117,8 +117,9 @@ PCEventQueue::equal_range(Addr pc) return std::equal_range(pc_map.begin(), pc_map.end(), pc, MapCompare()); } -BreakPCEvent::BreakPCEvent(PCEventQueue *q, const std::string &desc, bool del) - : PCEvent(q, desc), remove(del) +BreakPCEvent::BreakPCEvent(PCEventQueue *q, const std::string &desc, Addr addr, + bool del) + : PCEvent(q, desc, addr), remove(del) { } @@ -137,8 +138,7 @@ extern "C" void sched_break_pc_sys(System *sys, Addr addr) { - PCEvent *event = new BreakPCEvent(&sys->pcEventQueue, "debug break", true); - event->schedule(addr); + new BreakPCEvent(&sys->pcEventQueue, "debug break", addr, true); } extern "C" diff --git a/cpu/pc_event.hh b/cpu/pc_event.hh index 65ef0a088..7fa3902cc 100644 --- a/cpu/pc_event.hh +++ b/cpu/pc_event.hh @@ -47,25 +47,17 @@ class PCEvent Addr evpc; public: - PCEvent() : queue(0), evpc(badpc) { } - - PCEvent(const std::string &desc) - : description(desc), queue(0), evpc(badpc) { } - - PCEvent(PCEventQueue *q, Addr pc = badpc) : queue(q), evpc(pc) { } - - PCEvent(PCEventQueue *q, const std::string &desc, Addr pc = badpc) - : description(desc), queue(q), evpc(pc) { } + PCEvent(PCEventQueue *q, const std::string &desc, Addr pc); virtual ~PCEvent() { if (queue) remove(); } + // for DPRINTF + virtual const std::string name() const { return description; } + std::string descr() const { return description; } Addr pc() const { return evpc; } bool remove(); - bool schedule(); - bool schedule(Addr pc); - bool schedule(PCEventQueue *q, Addr pc); virtual void process(ExecContext *xc) = 0; }; @@ -120,47 +112,21 @@ class PCEventQueue void dump() const; }; -inline bool -PCEvent::remove() -{ - if (!queue) - panic("cannot remove an uninitialized event;"); - - return queue->remove(this); -} -inline bool -PCEvent::schedule() +inline +PCEvent::PCEvent(PCEventQueue *q, const std::string &desc, Addr pc) + : description(desc), queue(q), evpc(pc) { - if (!queue || evpc == badpc) - panic("cannot schedule an uninitialized event;"); - - return queue->schedule(this); -} - -inline bool -PCEvent::schedule(Addr pc) -{ - if (evpc != badpc) - panic("cannot switch PC"); - evpc = pc & ~0x3; - - return schedule(); + queue->schedule(this); } inline bool -PCEvent::schedule(PCEventQueue *q, Addr pc) +PCEvent::remove() { - if (queue) - panic("cannot switch event queues"); - - if (evpc != badpc) - panic("cannot switch addresses"); - - queue = q; - evpc = pc & ~0x3; + if (!queue) + panic("cannot remove an uninitialized event;"); - return schedule(); + return queue->remove(this); } class BreakPCEvent : public PCEvent @@ -169,7 +135,8 @@ class BreakPCEvent : public PCEvent bool remove; public: - BreakPCEvent(PCEventQueue *q, const std::string &desc, bool del = false); + BreakPCEvent(PCEventQueue *q, const std::string &desc, Addr addr, + bool del = false); virtual void process(ExecContext *xc); }; |