Gabe Black has submitted this change. ( 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
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/42603
Reviewed-by: Daniel Carvalho <oda...@yahoo.com.br>
Reviewed-by: Bobby R. Bruce <bbr...@ucdavis.edu>
Reviewed-by: Boris Shingarov <shinga...@gmail.com>
Maintainer: Bobby R. Bruce <bbr...@ucdavis.edu>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/arch/sparc/insts/integer.hh
M src/arch/sparc/tlb.cc
2 files changed, 3 insertions(+), 5 deletions(-)

Approvals:
  Boris Shingarov: Looks good to me, but someone else must approve
  Daniel Carvalho: Looks good to me, approved
  Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



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 380b365..167ff03 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: 4
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Boris Shingarov <shinga...@gmail.com>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to