[PATCH 02/13] [PATCH] split kqemu_init into two

Glauber Costa
2008-05-15T14:09:22Z

we separate kqemu_init() into a part that depends on env,
and other that does not. The later can be initialized earlier
---
exec.c | 3 +++
kqemu.c | 10 +++++++---
target-i386/helper2.c | 2 +-
3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/exec.c b/exec.c
index 5384460..dfedfc3 100644
--- a/exec.c
+++ b/exec.c
@@ -334,6 +334,9 @@ void exec_init(void)
code_gen_ptr = code_gen_buffer;
page_init();
io_mem_init();
+#ifdef USE_KQEMU
+ kqemu_start();
+#endif
}

void cpu_exec_init(CPUState *env)
diff --git a/kqemu.c b/kqemu.c
index 88592ee..0e38d52 100644
--- a/kqemu.c
+++ b/kqemu.c
@@ -159,7 +159,7 @@ static void kqemu_update_cpuid(CPUState *env)
accelerated code */
}

-int kqemu_init(CPUState *env)
+int kqemu_start(void)
{
struct kqemu_init init;
int ret, version;
@@ -238,13 +238,17 @@ 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;
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/helper2.c b/target-i386/helper2.c
index 6cf218f..1c0fcdb 100644
--- a/target-i386/helper2.c
+++ b/target-i386/helper2.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;