qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 01/21] split kqemu_init into two


From: Glauber Costa
Subject: [Qemu-devel] [PATCH 01/21] split kqemu_init into two
Date: Wed, 15 Oct 2008 19:54:58 -0200

From: Glauber Costa <address@hidden>

we separate kqemu_init() into a part that depends on env,
and other that does not. The later can be initialized earlier

Signed-off-by: Glauber Costa <address@hidden>
Signed-off-by: Dmitry Baryshkov <address@hidden>
---
 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 f1fcec8..1cad0be 100644
--- a/exec.c
+++ b/exec.c
@@ -495,6 +495,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
 }
 
 #if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY)
@@ -2207,7 +2210,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 94c5c74..ee8cc86 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





reply via email to

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