arch-power: Add multi-mode debugging support
[gem5.git] / src / arch / power / remote_gdb.hh
index 3bb726e52a48e4e8e1d9c569783cbc7768dedfe7..50b4f795749ed457af68547fc1d09d6373667a77 100644 (file)
@@ -49,7 +49,7 @@ class RemoteGDB : public BaseRemoteGDB
     {
       using BaseGdbRegCache::BaseGdbRegCache;
       private:
-        struct {
+        struct M5_ATTR_PACKED {
             uint32_t gpr[NumIntArchRegs];
             uint64_t fpr[NumFloatArchRegs];
             uint32_t pc;
@@ -58,7 +58,9 @@ class RemoteGDB : public BaseRemoteGDB
             uint32_t lr;
             uint32_t ctr;
             uint32_t xer;
+            uint32_t fpscr;
         } r;
+
       public:
         char *data() const { return (char *)&r; }
         size_t size() const { return sizeof(r); }
@@ -71,16 +73,47 @@ class RemoteGDB : public BaseRemoteGDB
         }
     };
 
-    PowerGdbRegCache regCache;
+    class Power64GdbRegCache : public BaseGdbRegCache
+    {
+      using BaseGdbRegCache::BaseGdbRegCache;
+      private:
+        struct M5_ATTR_PACKED {
+            uint64_t gpr[NumIntArchRegs];
+            uint64_t fpr[NumFloatArchRegs];
+            uint64_t pc;
+            uint64_t msr;
+            uint32_t cr;
+            uint64_t lr;
+            uint64_t ctr;
+            uint32_t xer;
+            uint32_t fpscr;
+        } r;
+
+      public:
+        char *data() const { return (char *)&r; }
+        size_t size() const { return sizeof(r); }
+        void getRegs(ThreadContext*);
+        void setRegs(ThreadContext*) const;
+        const std::string
+        name() const
+        {
+            return gdb->name() + ".Power64GdbRegCache";
+        }
+    };
+
+    PowerGdbRegCache regCache32;
+    Power64GdbRegCache regCache64;
 
   public:
     RemoteGDB(System *_system, ThreadContext *tc, int _port);
     BaseGdbRegCache *gdbRegs();
+
     std::vector<std::string>
     availableFeatures() const
     {
         return {"qXfer:features:read+"};
     };
+
     bool getXferFeaturesRead(const std::string &annex, std::string &output);
 };