Sandipan Das has uploaded this change for review. (
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]>
---
M src/arch/power/decoder.hh
M src/arch/power/types.hh
2 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/src/arch/power/decoder.hh b/src/arch/power/decoder.hh
index 4e02ef7..c30014c 100644
--- a/src/arch/power/decoder.hh
+++ b/src/arch/power/decoder.hh
@@ -67,7 +67,7 @@
void
moreBytes(const PCState &pc, Addr fetchPC, MachInst inst)
{
- emi = betoh(inst);
+ emi = gtoh(inst, pc.byteOrder());
instDone = true;
}
diff --git a/src/arch/power/types.hh b/src/arch/power/types.hh
index a76e6e2..c5a8f0f 100644
--- a/src/arch/power/types.hh
+++ b/src/arch/power/types.hh
@@ -32,6 +32,7 @@
#include "arch/generic/types.hh"
#include "base/bitunion.hh"
#include "base/types.hh"
+#include "enums/ByteOrder.hh"
namespace PowerISA
{
@@ -94,7 +95,40 @@
Bitfield<19, 12> fxm;
EndBitUnion(ExtMachInst)
-typedef GenericISA::SimplePCState<MachInst> PCState;
+class PCState : public GenericISA::SimplePCState<MachInst>
+{
+ private:
+ typedef GenericISA::SimplePCState<MachInst> Base;
+ ByteOrder guestByteOrder = ByteOrder::big;
+
+ public:
+ PCState()
+ {}
+
+ void
+ set(Addr val)
+ {
+ Base::set(val);
+ npc(val + sizeof(MachInst));
+ }
+
+ PCState(Addr val)
+ {
+ set(val);
+ }
+
+ ByteOrder
+ byteOrder() const
+ {
+ return guestByteOrder;
+ }
+
+ void
+ byteOrder(ByteOrder order)
+ {
+ guestByteOrder = order;
+ }
+};
// typedef uint64_t LargestRead;
// // Need to use 64 bits to make sure that read requests get handled
properly
--
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: 1
Gerrit-Owner: Sandipan Das <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s