arch, base, dev, kern, sym: FreeBSD support
[gem5.git] / src / arch / arm / linux / system.hh
index 54681096bd2e5c7a252727a54310fb4102525458..32e3568b3455430af7dc58951848b99089e35f62 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010 ARM Limited
+ * Copyright (c) 2010-2013 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
 #ifndef __ARCH_ARM_LINUX_SYSTEM_HH__
 #define __ARCH_ARM_LINUX_SYSTEM_HH__
 
+#include <cstdio>
+#include <map>
 #include <string>
 #include <vector>
 
 #include "arch/arm/system.hh"
+#include "base/output.hh"
 #include "kern/linux/events.hh"
 #include "params/LinuxArmSystem.hh"
+#include "sim/core.hh"
 
-class LinuxArmSystem : public ArmSystem
+class DumpStatsPCEvent;
+
+class LinuxArmSystem : public GenericArmSystem
 {
   protected:
-    static const int ParamsList =  0x100;
+    DumpStatsPCEvent *dumpStatsPCEvent;
 
   public:
     /** Boilerplate params code */
@@ -64,6 +70,20 @@ class LinuxArmSystem : public ArmSystem
         return dynamic_cast<const Params *>(_params);
     }
 
+    /** When enabled, dump stats/task info on context switches for
+     *  Streamline and per-thread cache occupancy studies, etc. */
+    bool enableContextSwitchStatsDump;
+
+    /** This map stores a mapping of OS process IDs to internal Task IDs. The
+     * mapping is done because the stats system doesn't tend to like vectors
+     * that are much greater than 1000 items and the entire process space is
+     * 65K. */
+    std::map<uint32_t, uint32_t> taskMap;
+
+    /** This is a file that is placed in the run directory that prints out
+     * mappings between taskIds and OS process IDs */
+    std::ostream* taskFile;
+
     LinuxArmSystem(Params *p);
     ~LinuxArmSystem();
 
@@ -71,11 +91,19 @@ class LinuxArmSystem : public ArmSystem
 
     bool adderBootUncacheable(Addr a);
 
+    void startup();
+
+    /** This function creates a new task Id for the given pid.
+     * @param tc thread context that is currentyl executing  */
+    void mapPid(ThreadContext* tc, uint32_t pid);
+
   private:
-#ifndef NDEBUG
     /** Event to halt the simulator if the kernel calls panic()  */
-    BreakPCEvent *kernelPanicEvent;
-#endif
+    PCEvent *kernelPanicEvent;
+
+    /** Event to halt the simulator if the kernel calls oopses  */
+    PCEvent *kernelOopsEvent;
+
     /**
      * PC based event to skip udelay(<time>) calls and quiesce the
      * processor for the appropriate amount of time. This is not functionally
@@ -98,7 +126,20 @@ class LinuxArmSystem : public ArmSystem
     Addr secDataPtrAddr;
     Addr secDataAddr;
     Addr penReleaseAddr;
+    Addr pen64ReleaseAddr;
+    Addr bootReleaseAddr;
 };
 
+class DumpStatsPCEvent : public PCEvent
+{
+  public:
+    DumpStatsPCEvent(PCEventQueue *q, const std::string &desc, Addr addr)
+        : PCEvent(q, desc, addr)
+    {}
+
+    virtual void process(ThreadContext* tc);
+};
+
+
 #endif // __ARCH_ARM_LINUX_SYSTEM_HH__