From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShKVm-0002HS-H5 for qemu-devel@nongnu.org; Wed, 20 Jun 2012 09:00:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ShKVc-0002nk-Iy for qemu-devel@nongnu.org; Wed, 20 Jun 2012 08:59:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31680) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShKVc-0002na-BV for qemu-devel@nongnu.org; Wed, 20 Jun 2012 08:59:44 -0400 From: Igor Mammedov Date: Wed, 20 Jun 2012 14:59:21 +0200 Message-Id: <1340197164-9574-3-git-send-email-imammedo@redhat.com> In-Reply-To: <1340197164-9574-1-git-send-email-imammedo@redhat.com> References: <1340197164-9574-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH 2/5] target-i386: move tcg initialization into x86_cpu_initfn() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, aliguori@us.ibm.com, ehabkost@redhat.com, jan.kiszka@siemens.com, mtosatti@redhat.com, mdroth@linux.vnet.ibm.com, blauwirbel@gmail.com, avi@redhat.com, pbonzini@redhat.com, afaerber@suse.de In order to make cpu object not depended on external ad-hoc initialization routines, move tcg initialization from cpu_x86_init inside cpu object x86_cpu_initfn(). Signed-off-by: Igor Mammedov --- target-i386/cpu.c | 10 ++++++++++ target-i386/cpu.h | 1 + target-i386/helper.c | 11 +---------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 0b61162..7ace126 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1708,6 +1708,7 @@ static void x86_cpu_initfn(Object *obj) { X86CPU *cpu = X86_CPU(obj); CPUX86State *env = &cpu->env; + static int inited; cpu_exec_init(env); @@ -1737,6 +1738,15 @@ static void x86_cpu_initfn(Object *obj) x86_cpuid_set_tsc_freq, NULL, NULL, NULL); env->cpuid_apic_id = env->cpu_index; + + /* init various static tables used in TCG mode */ + if (tcg_enabled() && !inited) { + inited = 1; + optimize_flags_init(); +#ifndef CONFIG_USER_ONLY + cpu_set_debug_excp_handler(breakpoint_handler); +#endif + } } static void x86_cpu_common_class_init(ObjectClass *oc, void *data) diff --git a/target-i386/cpu.h b/target-i386/cpu.h index bcf663e..80dcb49 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -933,6 +933,7 @@ static inline int hw_breakpoint_len(unsigned long dr7, int index) void hw_breakpoint_insert(CPUX86State *env, int index); void hw_breakpoint_remove(CPUX86State *env, int index); int check_hw_breakpoints(CPUX86State *env, int force_dr6_update); +void breakpoint_handler(CPUX86State *env); /* will be suppressed */ void cpu_x86_update_cr0(CPUX86State *env, uint32_t new_cr0); diff --git a/target-i386/helper.c b/target-i386/helper.c index b9384f6..c52ec13 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -941,7 +941,7 @@ int check_hw_breakpoints(CPUX86State *env, int force_dr6_update) return hit_enabled; } -static void breakpoint_handler(CPUX86State *env) +void breakpoint_handler(CPUX86State *env) { CPUBreakpoint *bp; @@ -1151,20 +1151,11 @@ X86CPU *cpu_x86_init(const char *cpu_model) { X86CPU *cpu; CPUX86State *env; - static int inited; cpu = X86_CPU(object_new(TYPE_X86_CPU)); env = &cpu->env; env->cpu_model_str = cpu_model; - /* init various static tables used in TCG mode */ - if (tcg_enabled() && !inited) { - inited = 1; - optimize_flags_init(); -#ifndef CONFIG_USER_ONLY - cpu_set_debug_excp_handler(breakpoint_handler); -#endif - } if (cpu_x86_register(cpu, cpu_model) < 0) { object_delete(OBJECT(cpu)); return NULL; -- 1.7.10.2