From e441be1b82171651308c22eac01c854e7813c2dd Mon Sep 17 00:00:00 2001
From: Gabe Black <gblack@eecs.umich.edu>
Date: Thu, 26 Oct 2006 20:22:23 -0400
Subject: Change the default function from setMiscRegWithEffect to setMiscReg

--HG--
extra : convert_revision : bedf422d51a52b009390b1e94f5330f752be2b87
---
 src/arch/sparc/miscregfile.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/arch/sparc/miscregfile.cc')

diff --git a/src/arch/sparc/miscregfile.cc b/src/arch/sparc/miscregfile.cc
index 8041e45c0..efaa22f67 100644
--- a/src/arch/sparc/miscregfile.cc
+++ b/src/arch/sparc/miscregfile.cc
@@ -470,7 +470,7 @@ Fault MiscRegFile::setRegWithEffect(int miscReg,
 
         /** Floating Point Status Register */
         case MISCREG_FSR:
-          panic("Floating Point not implemented\n");
+          setReg(miscReg, val);
         default:
 #if FULL_SYSTEM
               setFSRegWithEffect(miscReg, val, tc);
-- 
cgit v1.2.3


From 2cb190d1e3854f3d82b88ccd9b6b6365b87c331d Mon Sep 17 00:00:00 2001
From: Gabe Black <gblack@eecs.umich.edu>
Date: Thu, 26 Oct 2006 22:48:02 -0400
Subject: Reorganized the MiscRegFile

--HG--
extra : convert_revision : 088112c9b8a4ea09c8015da5a0b65ed2fc9398d2
---
 src/arch/sparc/miscregfile.cc | 163 +++++++++++++-----------------------------
 1 file changed, 49 insertions(+), 114 deletions(-)

(limited to 'src/arch/sparc/miscregfile.cc')

diff --git a/src/arch/sparc/miscregfile.cc b/src/arch/sparc/miscregfile.cc
index efaa22f67..ada3c18e7 100644
--- a/src/arch/sparc/miscregfile.cc
+++ b/src/arch/sparc/miscregfile.cc
@@ -221,8 +221,6 @@ MiscReg MiscRegFile::readRegWithEffect(int miscReg,
           }
           return tc->getCpuPtr()->curCycle() - tickFields.counter |
               tickFields.npt << 63;
-        case MISCREG_PC:
-          return tc->readPC();
         case MISCREG_FPRS:
           fault = new UnimpFault("FPU not implemented\n");
           return 0;
@@ -280,112 +278,115 @@ Fault MiscRegFile::setReg(int miscReg, const MiscReg &val)
     switch (miscReg) {
         case MISCREG_Y:
           y = val;
-          return NoFault;
+          break;
         case MISCREG_CCR:
           ccr = val;
-          return NoFault;
+          break;
         case MISCREG_ASI:
           asi = val;
-          return NoFault;
+          break;
         case MISCREG_FPRS:
           fprs = val;
-          return NoFault;
+          break;
         case MISCREG_TICK:
-           tick = val;
-          return NoFault;
+          tick = val;
+          break;
         case MISCREG_PCR:
         case MISCREG_PIC:
           panic("ASR number %d not implemented\n", miscReg - AsrStart);
         case MISCREG_GSR:
           gsr = val;
+          break;
         case MISCREG_SOFTINT:
-           softint = val;
-          return NoFault;
+          softint = val;
+          break;
         case MISCREG_TICK_CMPR:
-           tick_cmpr = val;
-          return NoFault;
+          tick_cmpr = val;
+          break;
         case MISCREG_STICK:
-           stick = val;
-          return NoFault;
+          stick = val;
+          break;
         case MISCREG_STICK_CMPR:
-           stick_cmpr = val;
-          return NoFault;
+          stick_cmpr = val;
+          break;
 
         /** Privilged Registers */
         case MISCREG_TPC:
           tpc[tl-1] = val;
-          return NoFault;
+          break;
         case MISCREG_TNPC:
           tnpc[tl-1] = val;
-          return NoFault;
+          break;
         case MISCREG_TSTATE:
           tstate[tl-1] = val;
-          return NoFault;
+          break;
         case MISCREG_TT:
           tt[tl-1] = val;
-          return NoFault;
+          break;
         case MISCREG_PRIVTICK:
           panic("Priviliged access to tick regesiters not implemented\n");
         case MISCREG_TBA:
-          tba = val;
-          return NoFault;
+          // clear lower 7 bits on writes.
+          tba = val & ULL(~0x7FFF);
+          break;
         case MISCREG_PSTATE:
           pstate = val;
-          return NoFault;
+          break;
         case MISCREG_TL:
           tl = val;
-          return NoFault;
+          break;
         case MISCREG_PIL:
           pil = val;
-          return NoFault;
+          break;
         case MISCREG_CWP:
           cwp = val;
-          return NoFault;
+          break;
         case MISCREG_CANSAVE:
           cansave = val;
-          return NoFault;
+          break;
         case MISCREG_CANRESTORE:
           canrestore = val;
-          return NoFault;
+          break;
         case MISCREG_CLEANWIN:
           cleanwin = val;
-          return NoFault;
+          break;
         case MISCREG_OTHERWIN:
           otherwin = val;
-          return NoFault;
+          break;
         case MISCREG_WSTATE:
           wstate = val;
-          return NoFault;
+          break;
         case MISCREG_GL:
           gl = val;
-          return NoFault;
+          break;
 
         /** Hyper privileged registers */
         case MISCREG_HPSTATE:
           hpstate = val;
-          return NoFault;
+          break;
         case MISCREG_HTSTATE:
           htstate[tl-1] = val;
-          return NoFault;
+          break;
         case MISCREG_HINTP:
           panic("HINTP not implemented\n");
         case MISCREG_HTBA:
           htba = val;
-          return NoFault;
+          break;
         case MISCREG_STRAND_STS_REG:
           strandStatusReg = val;
-          return NoFault;
+          break;
         case MISCREG_HSTICK_CMPR:
           hstick_cmpr = val;
-          return NoFault;
+          break;
 
         /** Floating Point Status Register */
         case MISCREG_FSR:
           fsr = val;
-          return NoFault;
+          break;
         default:
           panic("Miscellaneous register %d not implemented\n", miscReg);
     }
+    return NoFault;
 }
 
 Fault MiscRegFile::setRegWithEffect(int miscReg,
@@ -393,91 +394,25 @@ Fault MiscRegFile::setRegWithEffect(int miscReg,
 {
     const uint64_t Bit64 = (1ULL << 63);
     switch (miscReg) {
-        case MISCREG_Y:
-        case MISCREG_CCR:
-        case MISCREG_ASI:
-          setReg(miscReg, val);
-          return NoFault;
-        case MISCREG_PRIVTICK:
         case MISCREG_TICK:
-          if (isNonPriv())
-              return new PrivilegedOpcode;
-          if (isPriv())
-              return new PrivilegedAction;
           tickFields.counter = tc->getCpuPtr()->curCycle() - val  & ~Bit64;
           tickFields.npt = val & Bit64 ? 1 : 0;
-           return NoFault;
-        case MISCREG_PC:
-           return new IllegalInstruction;
+          break;
         case MISCREG_FPRS:
-           return new UnimpFault("FPU not implemented\n");
+          //Configure the fpu based on the fprs
+          break;
         case MISCREG_PCR:
-           return new UnimpFault("Performance Instrumentation not impl\n");
-        case MISCREG_PIC:
-           return new UnimpFault("Performance Instrumentation not impl\n");
-        case MISCREG_GSR:
-           return setReg(miscReg, val);
-
-        /** Privilged Registers */
-        case MISCREG_TPC:
-        case MISCREG_TNPC:
-        case MISCREG_TSTATE:
-        case MISCREG_TT:
-          if (tl == 0)
-              return new IllegalInstruction;
-          setReg(miscReg, val);
-          return NoFault;
-
-        case MISCREG_TBA:
-          // clear lower 7 bits on writes.
-          setReg(miscReg, val & ULL(~0x7FFF));
-          return NoFault;
-
-        case MISCREG_PSTATE:
-          setReg(miscReg, val);
-          return NoFault;
-
-        case MISCREG_TL:
-          if (isHyperPriv() && val > MaxTL)
-              setReg(miscReg, MaxTL);
-          else if (isPriv() && !isHyperPriv() && val > MaxPTL)
-              setReg(miscReg, MaxPTL);
-          else
-              setReg(miscReg, val);
-          return NoFault;
-
+          //Set up performance counting based on pcr value
+          break;
         case MISCREG_CWP:
           tc->changeRegFileContext(CONTEXT_CWP, val);
-        case MISCREG_CANSAVE:
-        case MISCREG_CANRESTORE:
-        case MISCREG_CLEANWIN:
-        case MISCREG_OTHERWIN:
-        case MISCREG_WSTATE:
-          setReg(miscReg, val);
-          return NoFault;
-
+          break;
         case MISCREG_GL:
-          int newval;
-          if (isHyperPriv() && val > MaxGL)
-              newval = MaxGL;
-          else if (isPriv() && !isHyperPriv() && val > MaxPGL)
-              newval =  MaxPGL;
-          else
-              newval = val;
-          tc->changeRegFileContext(CONTEXT_GLOBALS, newval);
-          setReg(miscReg, newval);
-          return NoFault;
-
-        /** Floating Point Status Register */
-        case MISCREG_FSR:
-          setReg(miscReg, val);
-        default:
-#if FULL_SYSTEM
-              setFSRegWithEffect(miscReg, val, tc);
-#else
-              return new IllegalInstruction;
-#endif
+          tc->changeRegFileContext(CONTEXT_GLOBALS, val);
+          break;
     }
+    setReg(miscReg, val);
+    return NoFault;
 }
 
 void MiscRegFile::serialize(std::ostream & os)
-- 
cgit v1.2.3


From 944bfde6b34a27f2438e38f7d870532ed6c0447a Mon Sep 17 00:00:00 2001
From: Gabe Black <gblack@eecs.umich.edu>
Date: Fri, 27 Oct 2006 01:36:42 -0400
Subject: Clean up MiscRegFile

--HG--
extra : convert_revision : 3bc792596c99df3a5c2c82da58b801a63ccf6ddb
---
 src/arch/sparc/miscregfile.cc | 65 ++++---------------------------------------
 1 file changed, 6 insertions(+), 59 deletions(-)

(limited to 'src/arch/sparc/miscregfile.cc')

diff --git a/src/arch/sparc/miscregfile.cc b/src/arch/sparc/miscregfile.cc
index ada3c18e7..bf4572878 100644
--- a/src/arch/sparc/miscregfile.cc
+++ b/src/arch/sparc/miscregfile.cc
@@ -202,78 +202,27 @@ MiscReg MiscRegFile::readReg(int miscReg)
     }
 }
 
-MiscReg MiscRegFile::readRegWithEffect(int miscReg,
-        Fault &fault, ThreadContext * tc)
+MiscReg MiscRegFile::readRegWithEffect(int miscReg, ThreadContext * tc)
 {
-    fault = NoFault;
     switch (miscReg) {
-        case MISCREG_Y:
-        case MISCREG_CCR:
-        case MISCREG_ASI:
-          return readReg(miscReg);
-
         case MISCREG_TICK:
         case MISCREG_PRIVTICK:
-          // Check  for reading privilege
-          if (tickFields.npt && !isNonPriv()) {
-              fault = new PrivilegedAction;
-              return 0;
-          }
           return tc->getCpuPtr()->curCycle() - tickFields.counter |
               tickFields.npt << 63;
         case MISCREG_FPRS:
-          fault = new UnimpFault("FPU not implemented\n");
-          return 0;
+          panic("FPU not implemented\n");
         case MISCREG_PCR:
-          fault = new UnimpFault("Performance Instrumentation not impl\n");
-          return 0;
         case MISCREG_PIC:
-          fault = new UnimpFault("Performance Instrumentation not impl\n");
-          return 0;
-        case MISCREG_GSR:
-          return readReg(miscReg);
-
-        /** Privilged Registers */
-        case MISCREG_TPC:
-        case MISCREG_TNPC:
-        case MISCREG_TSTATE:
-        case MISCREG_TT:
-          if (tl == 0) {
-              fault = new IllegalInstruction;
-              return 0;
-          } // NOTE THE FALL THROUGH!
-        case MISCREG_PSTATE:
-        case MISCREG_TL:
-          return readReg(miscReg);
-
-        case MISCREG_TBA:
-          return readReg(miscReg) & ULL(~0x7FFF);
-
-        case MISCREG_PIL:
-
-        case MISCREG_CWP:
-        case MISCREG_CANSAVE:
-        case MISCREG_CANRESTORE:
-        case MISCREG_CLEANWIN:
-        case MISCREG_OTHERWIN:
-        case MISCREG_WSTATE:
-        case MISCREG_GL:
-          return readReg(miscReg);
+          panic("Performance Instrumentation not impl\n");
 
         /** Floating Point Status Register */
         case MISCREG_FSR:
           panic("Floating Point not implemented\n");
-        default:
-#if FULL_SYSTEM
-          return readFSRegWithEffect(miscReg, fault, tc);
-#else
-          fault = new IllegalInstruction;
-          return 0;
-#endif
     }
+    return readReg(miscReg);
 }
 
-Fault MiscRegFile::setReg(int miscReg, const MiscReg &val)
+void MiscRegFile::setReg(int miscReg, const MiscReg &val)
 {
     switch (miscReg) {
         case MISCREG_Y:
@@ -386,10 +335,9 @@ Fault MiscRegFile::setReg(int miscReg, const MiscReg &val)
         default:
           panic("Miscellaneous register %d not implemented\n", miscReg);
     }
-    return NoFault;
 }
 
-Fault MiscRegFile::setRegWithEffect(int miscReg,
+void MiscRegFile::setRegWithEffect(int miscReg,
         const MiscReg &val, ThreadContext * tc)
 {
     const uint64_t Bit64 = (1ULL << 63);
@@ -412,7 +360,6 @@ Fault MiscRegFile::setRegWithEffect(int miscReg,
           break;
     }
     setReg(miscReg, val);
-    return NoFault;
 }
 
 void MiscRegFile::serialize(std::ostream & os)
-- 
cgit v1.2.3