Added mmap start and end so detailed CPU can know if an access is
[gem5.git] / sim / eventq.cc
index eab499bd90ca07c814d4c98bd48a46d2599e64b4..f975c5e974797927b0ddff58c175d790ae960fe7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2000-2003 The Regents of The University of Michigan
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -42,8 +42,6 @@
 
 using namespace std;
 
-const string Event::defaultName("event");
-
 //
 // Main Event Queue
 //
@@ -114,7 +112,7 @@ EventQueue::serviceOne()
     else
         event->clearFlags(Event::Squashed);
 
-    if (event->getFlags(Event::AutoDelete))
+    if (event->getFlags(Event::AutoDelete) && !event->scheduled())
         delete event;
 }
 
@@ -160,19 +158,13 @@ EventQueue::serialize(ostream &os)
     while (event) {
         if (event->getFlags(Event::AutoSerialize)) {
             eventPtrs.push_back(event);
-            numEvents++;
+            paramOut(os, csprintf("event%d", numEvents++), event->name());
         }
         event = event->next;
     }
 
     SERIALIZE_SCALAR(numEvents);
 
-    int i = 0;
-    for (std::list<Event *>::iterator it=eventPtrs.begin();
-         it != eventPtrs.end(); ++it) {
-        paramOut(os, csprintf("%s.eventPtr%d", name(), i++), (uintptr_t)*it);
-    }
-
     for (std::list<Event *>::iterator it=eventPtrs.begin();
          it != eventPtrs.end(); ++it) {
         (*it)->nameOut(os);
@@ -184,16 +176,15 @@ void
 EventQueue::unserialize(Checkpoint *cp, const std::string &section)
 {
     int numEvents;
-    uintptr_t ptr;
-
     UNSERIALIZE_SCALAR(numEvents);
 
+    std::string eventName;
     for (int i = 0; i < numEvents; i++) {
         // get the pointer value associated with the event
-        paramIn(cp, section, csprintf("%s.eventPtr%d", name(), i), ptr);
+        paramIn(cp, section, csprintf("event%d", i), eventName);
 
         // create the event based on its pointer value
-        Serializeable::create(cp, csprintf("%s_%x", Event::defaultName, ptr));
+        Serializable::create(cp, eventName);
     }
 }
 
@@ -217,6 +208,13 @@ EventQueue::dump()
     cprintf("============================================================\n");
 }
 
+extern "C"
+void
+dumpMainQueue()
+{
+    mainEventQueue.dump();
+}
+
 
 const char *
 Event::description()
@@ -244,16 +242,18 @@ Event::trace(const char *action)
 void
 Event::dump()
 {
+    cprintf("Event  (%s)\n", description());
+    cprintf("Flags: %#x\n", _flags);
 #if TRACING_ON
-    cprintf("   Created: %d\n", when_created);
+    cprintf("Created: %d\n", when_created);
 #endif
     if (scheduled()) {
 #if TRACING_ON
-        cprintf("   Scheduled at  %d\n", when_scheduled);
+        cprintf("Scheduled at  %d\n", when_scheduled);
 #endif
-        cprintf("   Scheduled for %d\n", when());
+        cprintf("Scheduled for %d, priority %d\n", when(), _priority);
     }
     else {
-        cprintf("   Not Scheduled\n");
+        cprintf("Not Scheduled\n");
     }
 }