From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:49350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QEdyu-00015p-UK for qemu-devel@nongnu.org; Tue, 26 Apr 2011 04:50:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QEdyt-0003tJ-Tq for qemu-devel@nongnu.org; Tue, 26 Apr 2011 04:50:52 -0400 Received: from thoth.sbs.de ([192.35.17.2]:17116) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QEdyt-0003t5-Gc for qemu-devel@nongnu.org; Tue, 26 Apr 2011 04:50:51 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by thoth.sbs.de (8.13.6/8.13.6) with ESMTP id p3Q8olYP032174 for ; Tue, 26 Apr 2011 10:50:47 +0200 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id p3Q8olN1001132 for ; Tue, 26 Apr 2011 10:50:47 +0200 Message-ID: <4DB68768.3050700@siemens.com> Date: Tue, 26 Apr 2011 10:50:48 +0200 From: Jan Kiszka MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] target-i386: Initialize CPUState::halted in cpu_reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Instead of having an extra reset function at machine level and special code for processing INIT, move the initialization of halted into the cpu reset handler. Signed-off-by: Jan Kiszka --- hw/pc.c | 12 ++---------- target-i386/helper.c | 5 ++++- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 6939c04..8ef86db 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -913,14 +913,6 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level) } } -static void pc_cpu_reset(void *opaque) -{ - CPUState *env = opaque; - - cpu_reset(env); - env->halted = !cpu_is_bsp(env); -} - static CPUState *pc_new_cpu(const char *cpu_model) { CPUState *env; @@ -934,8 +926,8 @@ static CPUState *pc_new_cpu(const char *cpu_model) env->cpuid_apic_id = env->cpu_index; env->apic_state = apic_init(env, env->cpuid_apic_id); } - qemu_register_reset(pc_cpu_reset, env); - pc_cpu_reset(env); + qemu_register_reset((QEMUResetHandler *)cpu_reset, env); + cpu_reset(env); return env; } diff --git a/target-i386/helper.c b/target-i386/helper.c index 89df997..56cca96 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -106,6 +106,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) + env->halted = !cpu_is_bsp(env); +#endif } void cpu_x86_close(CPUX86State *env) @@ -1282,7 +1286,6 @@ void do_cpu_init(CPUState *env) env->interrupt_request = sipi; env->pat = pat; apic_init_reset(env->apic_state); - env->halted = !cpu_is_bsp(env); } void do_cpu_sipi(CPUState *env)