Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/42603 )

Change subject: arch-sparc: Fix some bit manipulation bugs.
......................................................................

arch-sparc: Fix some bit manipulation bugs.

Several sext<> calls had an off by one sign bit index, which is really
the size of the number which is being sign extended. Also, two calls in
arch/sparc/tlb.cc seemed to assume that the argument to that function
was modified in place, where really the new value is returned
separately. Move the call to sext so its return value is used and not
thrown away.

Change-Id: I86cb81ad243558e1a0d33def7f3eebe6973d6800
---
M src/arch/sparc/insts/integer.hh
M src/arch/sparc/tlb.cc
2 files changed, 3 insertions(+), 5 deletions(-)



diff --git a/src/arch/sparc/insts/integer.hh b/src/arch/sparc/insts/integer.hh
index 1438cfd..a38bebe 100644
--- a/src/arch/sparc/insts/integer.hh
+++ b/src/arch/sparc/insts/integer.hh
@@ -94,7 +94,7 @@
 {
   protected:
IntOpImm11(const char *mnem, ExtMachInst _machInst, OpClass __opClass) : - IntOpImm(mnem, _machInst, __opClass, sext<10>(bits(_machInst, 10, 0))) + IntOpImm(mnem, _machInst, __opClass, sext<11>(bits(_machInst, 10, 0)))
     {}
 };

diff --git a/src/arch/sparc/tlb.cc b/src/arch/sparc/tlb.cc
index 46e03e3..09c8a98 100644
--- a/src/arch/sparc/tlb.cc
+++ b/src/arch/sparc/tlb.cc
@@ -1238,8 +1238,7 @@
             itb->sfsr = data;
             break;
           case 0x30:
-            sext<59>(bits(data, 59,0));
-            itb->tag_access = data;
+            itb->tag_access = sext<60>(bits(data, 59,0));
             break;
           default:
             goto doMmuWriteError;
@@ -1315,8 +1314,7 @@
             sfsr = data;
             break;
           case 0x30:
-            sext<59>(bits(data, 59,0));
-            tag_access = data;
+            tag_access = sext<60>(bits(data, 59,0));
             break;
           case 0x80:
             tc->setMiscReg(MISCREG_MMU_PART_ID, data);

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/42603
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: I86cb81ad243558e1a0d33def7f3eebe6973d6800
Gerrit-Change-Number: 42603
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[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

Reply via email to