From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M28gj-0001pf-Br for qemu-devel@nongnu.org; Thu, 07 May 2009 14:51:21 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M28ge-0001k7-AJ for qemu-devel@nongnu.org; Thu, 07 May 2009 14:51:20 -0400 Received: from [199.232.76.173] (port=35419 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M28gd-0001jp-QS for qemu-devel@nongnu.org; Thu, 07 May 2009 14:51:15 -0400 Received: from mx2.redhat.com ([66.187.237.31]:59149) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M28ga-0007GJ-Gv for qemu-devel@nongnu.org; Thu, 07 May 2009 14:51:15 -0400 From: Glauber Costa Date: Thu, 7 May 2009 14:51:02 -0400 Message-Id: <1241722263-26541-4-git-send-email-glommer@redhat.com> In-Reply-To: <1241722263-26541-3-git-send-email-glommer@redhat.com> References: <1241722263-26541-1-git-send-email-glommer@redhat.com> <1241722263-26541-2-git-send-email-glommer@redhat.com> <1241722263-26541-3-git-send-email-glommer@redhat.com> Subject: [Qemu-devel] [PATCH 3/4] move halted state setting to inside of cpu_x86_init List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com 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 --- 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