qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 3/4] move halted state setting to inside of cpu_x86_


From: Glauber Costa
Subject: [Qemu-devel] [PATCH 3/4] move halted state setting to inside of cpu_x86_init
Date: Thu, 7 May 2009 14:51:02 -0400

cpus other than the first one starting at the halted state
is a safe assumption to anyone. Move it to exec.c, in common
cpu initialization code. Also, we need to keep this state when
we reset the cpu.

Signed-off-by: Glauber Costa <address@hidden>
---
 exec.c               |    4 ++++
 hw/pc.c              |    2 --
 hw/sun4m.c           |    2 --
 target-i386/helper.c |    4 ++++
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/exec.c b/exec.c
index c5c9280..84a8e48 100644
--- a/exec.c
+++ b/exec.c
@@ -567,6 +567,10 @@ void cpu_exec_init(CPUState *env)
     register_savevm("cpu", cpu_index, CPU_SAVE_VERSION,
                     cpu_save, cpu_load, env);
 #endif
+#if !defined(CONFIG_USER_ONLY)
+    /* cpu 0 can run, others start at halted state */
+    env->halted = !!cpu_index;
+#endif
 }
 
 static inline void invalidate_page_bitmap(PageDesc *p)
diff --git a/hw/pc.c b/hw/pc.c
index b726c17..06d1fca 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -849,8 +849,6 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
             fprintf(stderr, "Unable to find x86 CPU definition\n");
             exit(1);
         }
-        if (i != 0)
-            env->halted = 1;
         if (pci_enabled) {
             apic_init(env);
         }
diff --git a/hw/sun4m.c b/hw/sun4m.c
index 1f1efd0..856b636 100644
--- a/hw/sun4m.c
+++ b/hw/sun4m.c
@@ -403,7 +403,6 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, 
ram_addr_t RAM_size,
             qemu_register_reset(main_cpu_reset, env);
         } else {
             qemu_register_reset(secondary_cpu_reset, env);
-            env->halted = 1;
         }
         cpu_irqs[i] = qemu_allocate_irqs(cpu_set_irq, envs[i], MAX_PILS);
         env->prom_addr = hwdef->slavio_base;
@@ -1193,7 +1192,6 @@ static void sun4d_hw_init(const struct sun4d_hwdef 
*hwdef, ram_addr_t RAM_size,
             qemu_register_reset(main_cpu_reset, env);
         } else {
             qemu_register_reset(secondary_cpu_reset, env);
-            env->halted = 1;
         }
         cpu_irqs[i] = qemu_allocate_irqs(cpu_set_irq, envs[i], MAX_PILS);
         env->prom_addr = hwdef->slavio_base;
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 2c11cd3..3131757 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -506,6 +506,10 @@ void cpu_reset(CPUX86State *env)
     env->dr[7] = DR7_FIXED_1;
     cpu_breakpoint_remove_all(env, BP_CPU);
     cpu_watchpoint_remove_all(env, BP_CPU);
+#if !defined(CONFIG_USER_ONLY)
+    /* cpu 0 can run, others start at halted state */
+    env->halted = !!env->cpu_index;
+#endif
 }
 
 static void main_cpu_reset(void *_env)
-- 
1.5.6.6





reply via email to

[Prev in Thread] Current Thread [Next in Thread]