SPARC: Keep a copy of the current ASI in the decoder.
authorGabe Black <gblack@eecs.umich.edu>
Sat, 5 Jan 2013 00:09:45 +0000 (18:09 -0600)
committerGabe Black <gblack@eecs.umich.edu>
Sat, 5 Jan 2013 00:09:45 +0000 (18:09 -0600)
Committed by: Nilay Vaish <nilay@cs.wisc.edu>

src/arch/sparc/decoder.hh
src/arch/sparc/isa.cc
src/arch/sparc/process.cc
src/arch/sparc/utility.cc
src/sim/syscall_emul.cc

index ea079328664f784c4f712c2210254125ea112ca5..f85d5e4de77803df7af6014e6ad9363337a27b46 100644 (file)
@@ -49,9 +49,10 @@ class Decoder
     // The extended machine instruction being generated
     ExtMachInst emi;
     bool instDone;
+    MiscReg asi;
 
   public:
-    Decoder(ThreadContext * _tc) : tc(_tc), instDone(false)
+    Decoder(ThreadContext * _tc) : tc(_tc), instDone(false), asi(0)
     {}
 
     ThreadContext *
@@ -86,8 +87,7 @@ class Decoder
         // into all the execute functions
         if (inst & (1 << 13)) {
             emi |= (static_cast<ExtMachInst>(
-                        tc->readMiscRegNoEffect(MISCREG_ASI))
-                    << (sizeof(MachInst) * 8));
+                        asi << (sizeof(MachInst) * 8)));
         } else {
             emi |= (static_cast<ExtMachInst>(bits(inst, 12, 5))
                     << (sizeof(MachInst) * 8));
@@ -107,6 +107,12 @@ class Decoder
         return instDone;
     }
 
+    void
+    setContext(MiscReg _asi)
+    {
+        asi = _asi;
+    }
+
   protected:
     /// A cache of decoded instruction objects.
     static GenericISA::BasicDecodeCache defaultCache;
index 291e25cec854db6a38af74de8e0253fa3cde2152..4cfb93b0d5e158480ded5639d5452e235c1ddbf1 100644 (file)
@@ -549,6 +549,9 @@ ISA::setMiscReg(int miscReg, MiscReg val, ThreadContext * tc)
     MiscReg new_val = val;
 
     switch (miscReg) {
+      case MISCREG_ASI:
+        tc->getDecodePtr()->setContext(val);
+        break;
       case MISCREG_STICK:
       case MISCREG_TICK:
         // stick and tick are same thing on niagra
index 9377fe7d060a3cbfb9c0b3b14fff8d818221c6f4..456b8b94aeed2e8c02b9c29ceaacf600e97c279f 100644 (file)
@@ -145,7 +145,7 @@ SparcLiveProcess::initState()
     // Set the trap level to 0
     tc->setMiscRegNoEffect(MISCREG_TL, 0);
     // Set the ASI register to something fixed
-    tc->setMiscRegNoEffect(MISCREG_ASI, ASI_PRIMARY);
+    tc->setMiscReg(MISCREG_ASI, ASI_PRIMARY);
 
     /*
      * T1 specific registers
index b9a07b57b42ef59d7ff3fb26c8ceaa48e2fb2673..d99ef4aa018b7474fadc49261ee2357922857f6f 100644 (file)
@@ -94,7 +94,7 @@ copyMiscRegs(ThreadContext *src, ThreadContext *dest)
 //            src->readMiscRegNoEffect(MISCREG_Y));
 //    dest->setMiscRegNoEffect(MISCREG_CCR,
 //            src->readMiscRegNoEffect(MISCREG_CCR));
-    dest->setMiscRegNoEffect(MISCREG_ASI,
+    dest->setMiscReg(MISCREG_ASI,
             src->readMiscRegNoEffect(MISCREG_ASI));
     dest->setMiscRegNoEffect(MISCREG_TICK,
             src->readMiscRegNoEffect(MISCREG_TICK));
index 9e53645f58a16e4c5693ef8e25df59f359f394b5..779e567f5b14da05c6d55b24915d8679bf554424 100644 (file)
@@ -810,7 +810,7 @@ cloneFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
             ctc->setMiscReg(MISCREG_CWP, 0);
             ctc->setIntReg(NumIntArchRegs + 7, 0);
             ctc->setMiscRegNoEffect(MISCREG_TL, 0);
-            ctc->setMiscRegNoEffect(MISCREG_ASI, ASI_PRIMARY);
+            ctc->setMiscReg(MISCREG_ASI, ASI_PRIMARY);
 
             for (int y = 8; y < 32; y++)
                 ctc->setIntReg(y, tc->readIntReg(y));