Copy implementations
[gem5.git] / arch / alpha / ev5.cc
index cc33f6890d8b8e4c47f5d06647bcf2ecc0e96f23..aaa81a58d8e110467ac537ec9c6ffc4faf31fd93 100644 (file)
@@ -47,12 +47,11 @@ void
 AlphaISA::initCPU(RegFile *regs)
 {
     initIPRs(regs);
-}
+    // CPU comes up with PAL regs enabled
+    swap_palshadow(regs, true);
 
-void
-m5_exit()
-{
-    static SimExitEvent event("m5_exit instruction encountered");
+    regs->pc = regs->ipr[IPR_PAL_BASE] + fault_addr[Reset_Fault];
+    regs->npc = regs->pc + sizeof(MachInst);
 }
 
 ////////////////////////////////////////////////////////////////////////
@@ -97,6 +96,7 @@ AlphaISA::initIPRs(RegFile *regs)
 
     bzero((char *)ipr, NumInternalProcRegs * sizeof(InternalProcReg));
     ipr[IPR_PAL_BASE] = PAL_BASE;
+    ipr[IPR_MCSR] = 0x6;
 }
 
 
@@ -168,11 +168,11 @@ ExecContext::hwrei()
     if (!PC_PAL(regs.pc))
         return Unimplemented_Opcode_Fault;
 
-    kernelStats.hwrei();
-
-    regs.npc = ipr[AlphaISA::IPR_EXC_ADDR];
+    setNextPC(ipr[AlphaISA::IPR_EXC_ADDR]);
 
     if (!misspeculating()) {
+        kernelStats.hwrei();
+
         if ((ipr[AlphaISA::IPR_EXC_ADDR] & 1) == 0)
             AlphaISA::swap_palshadow(&regs, false);
 
@@ -240,7 +240,9 @@ ExecContext::readIpr(int idx, Fault &fault)
       case AlphaISA::IPR_VA:
         // SFX: unlocks interrupt status registers
         retval = ipr[idx];
-        regs.intrlock = false;
+
+        if (!misspeculating())
+            regs.intrlock = false;
         break;
 
       case AlphaISA::IPR_VA_FORM:
@@ -253,7 +255,7 @@ ExecContext::readIpr(int idx, Fault &fault)
 
       case AlphaISA::IPR_DTB_PTE:
         {
-            AlphaISA::PTE &pte = dtb->index();
+            AlphaISA::PTE &pte = dtb->index(!misspeculating());
 
             retval |= ((u_int64_t)pte.ppn & ULL(0x7ffffff)) << 32;
             retval |= ((u_int64_t)pte.xre & ULL(0xf)) << 8;
@@ -551,11 +553,9 @@ ExecContext::simPalCheck(int palFunc)
 
     switch (palFunc) {
       case PAL::halt:
-        if (!misspeculating()) {
-            setStatus(Halted);
-            if (--System::numSystemsRunning == 0)
-                new SimExitEvent("all cpus halted");
-        }
+        halt();
+        if (--System::numSystemsRunning == 0)
+            new SimExitEvent("all cpus halted");
         break;
 
       case PAL::bpt: