X86: Implement the STARTUP IPI.
authorGabe Black <gblack@eecs.umich.edu>
Sun, 19 Apr 2009 09:56:03 +0000 (02:56 -0700)
committerGabe Black <gblack@eecs.umich.edu>
Sun, 19 Apr 2009 09:56:03 +0000 (02:56 -0700)
src/arch/x86/faults.cc
src/arch/x86/faults.hh

index e2a4d8ca2b7d326fef116ca03a0db4bd5c45ff37..bef7e44141490a20d023ba1bc0150b9c1d755631 100644 (file)
@@ -282,6 +282,26 @@ namespace X86ISA
         tc->setNextMicroPC(romMicroPC(entry) + 1);
     }
 
+    void
+    StartupInterrupt::invoke(ThreadContext *tc)
+    {
+        DPRINTF(Faults, "Startup interrupt with vector %#x.\n", vector);
+        HandyM5Reg m5Reg = tc->readMiscReg(MISCREG_M5_REG);
+        if (m5Reg.mode != LegacyMode || m5Reg.submode != RealMode) {
+            panic("Startup IPI recived outside of real mode. "
+                    "Don't know what to do.");
+        }
+
+        tc->setMiscReg(MISCREG_CS, vector << 8);
+        tc->setMiscReg(MISCREG_CS_BASE, vector << 12);
+        tc->setMiscReg(MISCREG_CS_EFF_BASE, vector << 12);
+        // This has the base value pre-added.
+        tc->setMiscReg(MISCREG_CS_LIMIT, 0xffff);
+
+        tc->setPC(tc->readMiscReg(MISCREG_CS_BASE));
+        tc->setNextPC(tc->readPC() + sizeof(MachInst));
+    }
+
 #endif
 } // namespace X86ISA
 
index 54b92bd472386383b8bdbef67546483b4c37d9f4..0e573f051a3e0d472f9f74245b53152f7044d71e 100644 (file)
@@ -418,6 +418,16 @@ namespace X86ISA
         void invoke(ThreadContext * tc);
     };
 
+    class StartupInterrupt : public X86Interrupt
+    {
+      public:
+        StartupInterrupt(uint8_t _vector) :
+            X86Interrupt("Startup Interrupt", "#SIPI", _vector)
+        {}
+
+        void invoke(ThreadContext * tc);
+    };
+
     class SoftwareInterrupt : public X86Interrupt
     {
       public: