Boris Shingarov has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/40940 )

Change subject: arch-power: Add byte order attribute for PC state
......................................................................

arch-power: Add byte order attribute for PC state

This adds byte order as an attribute for PC state by
introducing a new PCState class. The decoder can now
fetch instructions bytes in the specified byte order
in preparation for multi-mode support.

Change-Id: I917333df88114a733cc5a8077cc420d5328f608b
Signed-off-by: Sandipan Das <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40940
Reviewed-by: Boris Shingarov <[email protected]>
Maintainer: Boris Shingarov <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/arch/power/decoder.hh
M src/arch/power/pcstate.hh
2 files changed, 37 insertions(+), 2 deletions(-)

Approvals:
  Boris Shingarov: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/arch/power/decoder.hh b/src/arch/power/decoder.hh
index 4e0c92b..20726a0 100644
--- a/src/arch/power/decoder.hh
+++ b/src/arch/power/decoder.hh
@@ -68,7 +68,7 @@
     void
     moreBytes(const PCState &pc, Addr fetchPC)
     {
-        emi = betoh(emi);
+        emi = gtoh(emi, pc.byteOrder());
         instDone = true;
     }

diff --git a/src/arch/power/pcstate.hh b/src/arch/power/pcstate.hh
index 9553c73..d0757839 100644
--- a/src/arch/power/pcstate.hh
+++ b/src/arch/power/pcstate.hh
@@ -30,6 +30,8 @@
 #define __ARCH_POWER_PCSTATE_HH__

 #include "arch/generic/types.hh"
+#include "arch/power/types.hh"
+#include "enums/ByteOrder.hh"

 namespace gem5
 {
@@ -37,7 +39,40 @@
 namespace PowerISA
 {

-typedef GenericISA::SimplePCState<4> PCState;
+class PCState : public GenericISA::SimplePCState<4>
+{
+  private:
+    typedef GenericISA::SimplePCState<4> Base;
+    ByteOrder guestByteOrder = ByteOrder::big;
+
+  public:
+    PCState()
+    {}
+
+    void
+    set(Addr val)
+    {
+        Base::set(val);
+        npc(val + 4);
+    }
+
+    PCState(Addr val)
+    {
+        set(val);
+    }
+
+    ByteOrder
+    byteOrder() const
+    {
+        return guestByteOrder;
+    }
+
+    void
+    byteOrder(ByteOrder order)
+    {
+        guestByteOrder = order;
+    }
+};

 } // namespace PowerISA
 } // namespace gem5

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40940
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: I917333df88114a733cc5a8077cc420d5328f608b
Gerrit-Change-Number: 40940
Gerrit-PatchSet: 11
Gerrit-Owner: Sandipan Das <[email protected]>
Gerrit-Reviewer: Boris Shingarov <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to