ARM: Add some support for wfi/wfe/yield/etc
authorAli Saidi <Ali.Saidi@ARM.com>
Wed, 2 Jun 2010 17:58:13 +0000 (12:58 -0500)
committerAli Saidi <Ali.Saidi@ARM.com>
Wed, 2 Jun 2010 17:58:13 +0000 (12:58 -0500)
src/arch/arm/isa.hh
src/arch/arm/isa/decoder/arm.isa
src/arch/arm/isa/includes.isa
src/arch/arm/isa/operands.isa
src/arch/arm/miscregs.hh

index ded463267b49b750819165ec4eeb9059fd515dcd..2d6a97fb66d70e213b899fa8590e962dbfd023a5 100644 (file)
@@ -119,6 +119,9 @@ namespace ArmISA
             /* One region, unified map. */
             miscRegs[MISCREG_MPUIR] = 0x100;
 
+            /* Start with an event in the mailbox */
+            miscRegs[MISCREG_SEV_MAILBOX] = 1;
+
             /*
              * Implemented = '5' from "M5",
              * Variant = 0,
index 4c5d71ad98f1a0752bb060551b45eab21eb7b292..f453d82993c1b7b5389abab48c9ccd66af3eca51 100644 (file)
@@ -86,10 +86,27 @@ format DataOp {
             0x9: decode RN {
                 0: decode IMM {
                     0: PredImmOp::nop({{ ; }});
-                    1: WarnUnimpl::yield();
-                    2: WarnUnimpl::wfe();
-                    3: WarnUnimpl::wfi();
-                    4: WarnUnimpl::sev();
+#if FULL_SYSTEM
+                    1: PredImmOp::yield({{ ; }});
+                    2: PredImmOp::wfe({{
+                        if (SevMailbox)
+                            SevMailbox = 0;
+                        else
+                            PseudoInst::quiesce(xc->tcBase());
+                    }}, IsNonSpeculative, IsQuiesce);
+                    3: PredImmOp::wfi({{
+                            PseudoInst::quiesce(xc->tcBase());
+                    }}, IsNonSpeculative, IsQuiesce);
+                    4: PredImmOp::sev({{
+                        // Need a way for O3 to not scoreboard these
+                        // accesses as pipeflushs
+                        System *sys = xc->tcBase()->getSystemPtr();
+                        for (int x = 0; x < sys->numContexts(); x++) {
+                            ThreadContext *oc = sys->getThreadContext(x);
+                            oc->setMiscReg(MISCREG_SEV_MAILBOX, 1);
+                        }
+                    }});
+#endif
                 }
                 default: PredImmOp::msr_i_cpsr({{
                             uint32_t newCpsr =
index 72c2e559a540105700ed4790d2554cfbe97cad4c..c20b16724fc9bb7574df9dbc1f9aa820af7f03e6 100644 (file)
@@ -76,6 +76,7 @@ output exec {{
 #include "arch/arm/isa_traits.hh"
 #include "arch/arm/utility.hh"
 #include "base/condcodes.hh"
+#include "sim/pseudo_inst.hh"
 
 #include <cmath>
 #if defined(linux)
index 53a0e78f9a5fe621caab81ad629e699ff7992214..9f4a0ca2f928b52732a16c7eba4dfd2fd7db49df 100644 (file)
@@ -176,6 +176,7 @@ def operands {{
     'Fpsid': ('ControlReg', 'uw', 'MISCREG_FPSID', None, 2),
     'Fpscr': ('ControlReg', 'uw', 'MISCREG_FPSCR', None, 2),
     'Fpexc': ('ControlReg', 'uw', 'MISCREG_FPEXC', None, 2),
+    'SevMailbox': ('ControlReg', 'uw', 'MISCREG_SEV_MAILBOX', None, 2),
     'NPC': ('NPC', 'ud', None, (None, None, 'IsControl'), 2,
             readNPC, writeNPC),
     'FNPC': ('NPC', 'ud', None, (None, None, 'IsControl'), 2,
index e3e2ca2c2cebac323ddaa5e5491c60374cf0d11c..81a448fd22a6327844ba1f1cb211a7c77eb76bd6 100644 (file)
@@ -80,6 +80,7 @@ namespace ArmISA
         MISCREG_FPEXC,
         MISCREG_MVFR0,
         MISCREG_MVFR1,
+        MISCREG_SEV_MAILBOX,
 
         // CP15 registers
         MISCREG_CP15_START,
@@ -159,7 +160,7 @@ namespace ArmISA
     const char * const miscRegName[NUM_MISCREGS] = {
         "cpsr", "spsr", "spsr_fiq", "spsr_irq", "spsr_svc",
         "spsr_mon", "spsr_und", "spsr_abt",
-        "fpsr", "fpsid", "fpscr", "fpexc",
+        "fpsr", "fpsid", "fpscr", "fpexc", "sev_mailbox",
         "sctlr", "dccisw", "dccimvac", "dccmvac",
         "contextidr", "tpidrurw", "tpidruro", "tpidrprw",
         "cp15isb", "cp15dsb", "cp15dmb", "cpacr",