qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 06/32] split kqemu_init into two


From: Glauber Costa
Subject: [Qemu-devel] [PATCH 06/32] split kqemu_init into two
Date: Thu, 23 Oct 2008 12:18:50 -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-all.h           |    1 -
 exec.c               |    5 ++++-
 kqemu.c              |   10 +++++++---
 target-i386/helper.c |    2 +-
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/exec-all.h b/exec-all.h
index c10248b..9ea9b4e 100644
--- a/exec-all.h
+++ b/exec-all.h
@@ -365,7 +365,6 @@ static inline int can_do_io(CPUState *env)
 
 #define MSR_QPI_COMMBASE 0xfabe0010
 
-int kqemu_init(CPUState *env);
 int kqemu_cpu_exec(CPUState *env);
 void kqemu_flush_page(CPUState *env, target_ulong addr);
 void kqemu_flush(CPUState *env, int global);
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 d2bfd05..11f8c8a 100644
--- a/kqemu.c
+++ b/kqemu.c
@@ -151,7 +151,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;
@@ -231,8 +231,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;
 
@@ -240,6 +238,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 c2e1a88..b36e391 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]