arch, base, dev, kern, sym: FreeBSD support
[gem5.git] / src / arch / arm / linux / system.hh
index 12c86db25c6a5ef582a13468157bf0ac784b5b15..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,17 +70,76 @@ 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();
 
-    /** Initialize the CPU for booting */
+    void initState();
+
+    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
+     * required but does speed up simulation.
+     */
+    Linux::UDelayEvent *uDelaySkipEvent;
+
+    /** Another PC based skip event for const_udelay(). Similar to the udelay
+     * skip, but this function precomputes the first multiply that is done
+     * in the generic case since the parameter is known at compile time.
+     * Thus we need to do some division to get back to us.
+     */
+    Linux::UDelayEvent *constUDelaySkipEvent;
+
+    /** These variables store addresses of important data structures
+     * that are normaly kept coherent at boot with cache mainetence operations.
+     * Since these operations aren't supported in gem5, we keep them coherent
+     * by making them uncacheable until all processors in the system boot.
+     */
+    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__