Merge zizzer.eecs.umich.edu:/z/m5/Bitkeeper/m5
[gem5.git] / cpu / pc_event.hh
index 645138fddc8b22bfbe293b274e218907fbf95127..7fa3902ccd272ad017a892f3d3409f7ba6981730 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2002-2005 The Regents of The University of Michigan
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
 
 #include <vector>
 
-#include "targetarch/mem_req.hh"
+#include "mem/mem_req.hh"
 
 class ExecContext;
 class PCEventQueue;
@@ -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;
-
-    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;
+    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);
 };