diff mbox

[qom-cpu,41/59] target-mips: Abstract helper_dvpe() with qemu_for_each_cpu()

Message ID 1370805206-26574-42-git-send-email-afaerber@suse.de
State New
Headers show

Commit Message

Andreas Färber June 9, 2013, 7:13 p.m. UTC
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-mips/op_helper.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)
diff mbox

Patch

diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c
index f6838ec..077e81c 100644
--- a/target-mips/op_helper.c
+++ b/target-mips/op_helper.c
@@ -1694,21 +1694,24 @@  target_ulong helper_emt(void)
     return 0;
 }
 
+static void helper_dvpe_one(CPUState *cs, void *data)
+{
+    MIPSCPU *self_cpu = data;
+    MIPSCPU *cpu = MIPS_CPU(cs);
+
+    if (cpu == self_cpu) {
+        return;
+    }
+    cpu->env.mvp->CP0_MVPControl &= ~(1 << CP0MVPCo_EVP);
+    mips_vpe_sleep(cpu);
+}
+
 target_ulong helper_dvpe(CPUMIPSState *env)
 {
-    CPUMIPSState *other_cpu_env = first_cpu;
     target_ulong prev = env->mvp->CP0_MVPControl;
 
-    do {
-        /* Turn off all VPEs except the one executing the dvpe.  */
-        if (other_cpu_env != env) {
-            MIPSCPU *other_cpu = mips_env_get_cpu(other_cpu_env);
-
-            other_cpu_env->mvp->CP0_MVPControl &= ~(1 << CP0MVPCo_EVP);
-            mips_vpe_sleep(other_cpu);
-        }
-        other_cpu_env = other_cpu_env->next_cpu;
-    } while (other_cpu_env);
+    /* Turn off all VPEs except the one executing the dvpe.  */
+    qemu_for_each_cpu(helper_dvpe_one, mips_env_get_cpu(env));
     return prev;
 }