From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KCKjV-0002ml-4v for qemu-devel@nongnu.org; Fri, 27 Jun 2008 16:39:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KCKjU-0002mU-Il for qemu-devel@nongnu.org; Fri, 27 Jun 2008 16:39:48 -0400 Received: from [199.232.76.173] (port=48158 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KCKjU-0002mL-BY for qemu-devel@nongnu.org; Fri, 27 Jun 2008 16:39:48 -0400 Received: from mx1.redhat.com ([66.187.233.31]:55923) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KCKjU-0007xz-Kv for qemu-devel@nongnu.org; Fri, 27 Jun 2008 16:39:48 -0400 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m5RKdg5I014176 for ; Fri, 27 Jun 2008 16:39:42 -0400 Received: from pobox-2.corp.redhat.com (pobox-2.corp.redhat.com [10.11.255.15]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m5RKdfUa005380 for ; Fri, 27 Jun 2008 16:39:41 -0400 Received: from localhost.localdomain (vpn-4-80.str.redhat.com [10.32.4.80]) by pobox-2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m5RKdadZ004563 for ; Fri, 27 Jun 2008 16:39:40 -0400 From: Glauber Costa Date: Fri, 27 Jun 2008 17:38:04 -0300 Message-Id: <1214599103-13846-2-git-send-email-gcosta@redhat.com> In-Reply-To: <1214599103-13846-1-git-send-email-gcosta@redhat.com> References: <1214599103-13846-1-git-send-email-gcosta@redhat.com> Subject: [Qemu-devel] [PATCH 01/20] split kqemu_init into two Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org we separate kqemu_init() into a part that depends on env, and other that does not. The later can be initialized earlier --- exec.c | 5 ++++- kqemu.c | 10 +++++++--- target-i386/helper.c | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/exec.c b/exec.c index 48600e4..f459abe 100644 --- a/exec.c +++ b/exec.c @@ -433,6 +433,9 @@ void cpu_exec_init_all(unsigned long tb_size) #if !defined(CONFIG_USER_ONLY) io_mem_init(); #endif +#ifdef USE_KQEMU + kqemu_start(); +#endif } void cpu_exec_init(CPUState *env) @@ -2078,7 +2081,7 @@ void cpu_register_physical_memory(target_phys_addr_t start_addr, #ifdef USE_KQEMU /* XXX: should not depend on cpu context */ env = first_cpu; - if (env->kqemu_enabled) { + if (env && env->kqemu_enabled) { kqemu_set_phys_mem(start_addr, size, phys_offset); } #endif diff --git a/kqemu.c b/kqemu.c index 4783aa2..9b52237 100644 --- a/kqemu.c +++ b/kqemu.c @@ -150,7 +150,7 @@ static void kqemu_update_cpuid(CPUState *env) accelerated code */ } -int kqemu_init(CPUState *env) +int kqemu_start(void) { struct kqemu_init kinit; int ret, version; @@ -230,8 +230,6 @@ int kqemu_init(CPUState *env) kqemu_fd = KQEMU_INVALID_FD; return -1; } - kqemu_update_cpuid(env); - env->kqemu_enabled = kqemu_allowed; nb_pages_to_flush = 0; nb_ram_pages_to_update = 0; @@ -239,6 +237,12 @@ int kqemu_init(CPUState *env) return 0; } +void kqemu_init_env(CPUState *env) +{ + kqemu_update_cpuid(env); + env->kqemu_enabled = kqemu_allowed; +} + void kqemu_flush_page(CPUState *env, target_ulong addr) { #if defined(DEBUG) diff --git a/target-i386/helper.c b/target-i386/helper.c index 1625007..2834171 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -113,7 +113,7 @@ CPUX86State *cpu_x86_init(const char *cpu_model) } cpu_reset(env); #ifdef USE_KQEMU - kqemu_init(env); + kqemu_init_env(env); #endif return env; } -- 1.5.5.1