Yu-hsin Wang has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/69177?usp=email )

Change subject: fastmodel: skip vector registers update in remote gdb
......................................................................

fastmodel: skip vector registers update in remote gdb

iris::ThreadContext doesn't implement the write interface for vector
registers. Skip that part in fastmodel remote_gdb to make updating
common registers work at least.

Change-Id: Ifa071f5dff4bdeee7361ae824b4b76e0b2805460
---
M src/arch/arm/fastmodel/remote_gdb.cc
M src/arch/arm/fastmodel/remote_gdb.hh
M src/arch/arm/remote_gdb.hh
M src/base/remote_gdb.hh
4 files changed, 64 insertions(+), 16 deletions(-)



diff --git a/src/arch/arm/fastmodel/remote_gdb.cc b/src/arch/arm/fastmodel/remote_gdb.cc
index e13fee8..d8dddad 100644
--- a/src/arch/arm/fastmodel/remote_gdb.cc
+++ b/src/arch/arm/fastmodel/remote_gdb.cc
@@ -27,13 +27,42 @@
 #include "arch/arm/fastmodel/remote_gdb.hh"

 #include "arch/arm/fastmodel/iris/thread_context.hh"
+#include "arch/arm/utility.hh"
+#include "base/trace.hh"
+#include "debug/GDBAcc.hh"

 namespace gem5 {

+using namespace ArmISA;
+
 namespace fastmodel {

+void
+FastmodelRemoteGDB::AArch64GdbRegCache::setRegs(ThreadContext *context) const
+{
+    DPRINTF(GDBAcc, "setRegs in remotegdb \n");
+
+    for (int i = 0; i < 31; ++i)
+        context->setReg(int_reg::x(i), r.x[i]);
+    auto pc_state = context->pcState().as<PCState>();
+    pc_state.set(r.pc);
+    context->pcState(pc_state);
+    context->setMiscRegNoEffect(MISCREG_CPSR, r.cpsr);
+    // Update the stack pointer. This should be done after
+    // updating CPSR/PSTATE since that might affect how SPX gets
+    // mapped.
+    context->setReg(int_reg::Spx, r.spx);
+
+ // Remove the vector registers update in FastmodelRemoteGDB since it's not
+    // implemented in iris::ThreadContext.
+    warn("Skip update vector registers in remotegdb\n");
+
+    context->setMiscRegNoEffect(MISCREG_FPSR, r.fpsr);
+    context->setMiscRegNoEffect(MISCREG_FPCR, r.fpcr);
+}
+
 FastmodelRemoteGDB::FastmodelRemoteGDB(System *_system, int port)
-    : gem5::ArmISA::RemoteGDB(_system, port)
+    : gem5::ArmISA::RemoteGDB(_system, port), regCache64(this)
 {
 }

@@ -57,5 +86,14 @@
     return true;
 }

+BaseGdbRegCache*
+FastmodelRemoteGDB::gdbRegs()
+{
+    if (inAArch64(context()))
+        return &regCache64;
+    else
+        return &regCache32;
+}
+
 }  // namespace fastmodel
 }  // namespace gem5
diff --git a/src/arch/arm/fastmodel/remote_gdb.hh b/src/arch/arm/fastmodel/remote_gdb.hh
index 93cf882..75dc658 100644
--- a/src/arch/arm/fastmodel/remote_gdb.hh
+++ b/src/arch/arm/fastmodel/remote_gdb.hh
@@ -36,14 +36,24 @@
 namespace fastmodel
 {

-class FastmodelRemoteGDB : public gem5::ArmISA::RemoteGDB
+class FastmodelRemoteGDB : public ArmISA::RemoteGDB
 {
   public:
     FastmodelRemoteGDB(System *_system, int port);

-  private:
+  protected:
+    class AArch64GdbRegCache : public ArmISA::RemoteGDB::AArch64GdbRegCache
+    {
+      using ArmISA::RemoteGDB::AArch64GdbRegCache::AArch64GdbRegCache;
+      public:
+        void setRegs(ThreadContext*) const override;
+    };
+
     bool readBlob(Addr vaddr, size_t size, char *data) override;
     bool writeBlob(Addr vaddr, size_t size, const char *data) override;
+    BaseGdbRegCache* gdbRegs() override;
+
+    AArch64GdbRegCache regCache64;
 };

 }  // namespace fastmodel
diff --git a/src/arch/arm/remote_gdb.hh b/src/arch/arm/remote_gdb.hh
index 8e512a4..aeb2db6 100644
--- a/src/arch/arm/remote_gdb.hh
+++ b/src/arch/arm/remote_gdb.hh
@@ -68,7 +68,7 @@
     class AArch32GdbRegCache : public BaseGdbRegCache
     {
       using BaseGdbRegCache::BaseGdbRegCache;
-      private:
+      protected:
         struct GEM5_PACKED
         {
           uint32_t gpr[16];
@@ -77,12 +77,12 @@
           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;
+        char *data() const override { return (char *)&r; }
+        size_t size() const override { return sizeof(r); }
+        void getRegs(ThreadContext*) override;
+        void setRegs(ThreadContext*) const override;
         const std::string
-        name() const
+        name() const override
         {
             return gdb->name() + ".AArch32GdbRegCache";
         }
@@ -91,7 +91,7 @@
     class AArch64GdbRegCache : public BaseGdbRegCache
     {
       using BaseGdbRegCache::BaseGdbRegCache;
-      private:
+      protected:
         struct GEM5_PACKED
         {
           uint64_t x[31];
@@ -103,12 +103,12 @@
           uint32_t fpcr;
         } r;
       public:
-        char *data() const { return (char *)&r; }
-        size_t size() const { return sizeof(r); }
-        void getRegs(ThreadContext*);
-        void setRegs(ThreadContext*) const;
+        char *data() const override { return (char *)&r; }
+        size_t size() const override { return sizeof(r); }
+        void getRegs(ThreadContext*) override;
+        void setRegs(ThreadContext*) const override;
         const std::string
-        name() const
+        name() const override
         {
             return gdb->name() + ".AArch64GdbRegCache";
         }
diff --git a/src/base/remote_gdb.hh b/src/base/remote_gdb.hh
index 7981a13..80c108b 100644
--- a/src/base/remote_gdb.hh
+++ b/src/base/remote_gdb.hh
@@ -188,7 +188,7 @@
             return nullptr;
     }

-  private:
+  protected:
     /*
      * Connection to the external GDB.
      */

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/69177?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ifa071f5dff4bdeee7361ae824b4b76e0b2805460
Gerrit-Change-Number: 69177
Gerrit-PatchSet: 1
Gerrit-Owner: Yu-hsin Wang <yuhsi...@google.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org

Reply via email to