From 0bf46a40a1fe22e35df344af1a8825f3b47a91e0 Mon Sep 17 00:00:00 2001 From: aliguori Date: Fri, 24 Apr 2009 18:03:41 +0000 Subject: qemu: introduce qemu_init_vcpu (Marcelo Tosatti) Signed-off-by: Marcelo Tosatti Signed-off-by: Anthony Liguori git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7242 c046a42c-6fe2-441c-8c8c-71466251a162 --- qemu-common.h | 6 ++++++ target-alpha/translate.c | 1 + target-arm/helper.c | 1 + target-cris/translate.c | 1 + target-i386/helper.c | 5 +++-- target-m68k/helper.c | 1 + target-mips/translate.c | 1 + target-ppc/helper.c | 3 +-- target-sh4/translate.c | 1 + target-sparc/helper.c | 1 + vl.c | 9 +++++++++ 11 files changed, 26 insertions(+), 4 deletions(-) diff --git a/qemu-common.h b/qemu-common.h index ee963c11de..e6a555e531 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -189,6 +189,12 @@ void qemu_service_io(void); /* Force QEMU to process pending events */ void qemu_notify_event(void); +#ifdef CONFIG_USER_ONLY +#define qemu_init_vcpu(env) do { } while (0) +#else +void qemu_init_vcpu(void *env); +#endif + typedef struct QEMUIOVector { struct iovec *iov; int niov; diff --git a/target-alpha/translate.c b/target-alpha/translate.c index 00751f5174..4cd24d847f 100644 --- a/target-alpha/translate.c +++ b/target-alpha/translate.c @@ -2505,6 +2505,7 @@ CPUAlphaState * cpu_alpha_init (const char *cpu_model) env->ipr[IPR_SISR] = 0; env->ipr[IPR_VIRBND] = -1ULL; + qemu_init_vcpu(env); return env; } diff --git a/target-arm/helper.c b/target-arm/helper.c index 34641428df..701629af3a 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -267,6 +267,7 @@ CPUARMState *cpu_arm_init(const char *cpu_model) gdb_register_coprocessor(env, vfp_gdb_get_reg, vfp_gdb_set_reg, 19, "arm-vfp.xml", 0); } + qemu_init_vcpu(env); return env; } diff --git a/target-cris/translate.c b/target-cris/translate.c index d9256ca423..e12be4ef11 100644 --- a/target-cris/translate.c +++ b/target-cris/translate.c @@ -3405,6 +3405,7 @@ CPUCRISState *cpu_cris_init (const char *cpu_model) cpu_exec_init(env); cpu_reset(env); + qemu_init_vcpu(env); if (tcg_initialized) return env; diff --git a/target-i386/helper.c b/target-i386/helper.c index f107d5022f..a070e08a6c 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1692,7 +1692,8 @@ CPUX86State *cpu_x86_init(const char *cpu_model) #ifdef CONFIG_KQEMU kqemu_init(env); #endif - if (kvm_enabled()) - kvm_init_vcpu(env); + + qemu_init_vcpu(env); + return env; } diff --git a/target-m68k/helper.c b/target-m68k/helper.c index 493498e9b4..ad28322443 100644 --- a/target-m68k/helper.c +++ b/target-m68k/helper.c @@ -180,6 +180,7 @@ CPUM68KState *cpu_m68k_init(const char *cpu_model) } cpu_reset(env); + qemu_init_vcpu(env); return env; } diff --git a/target-mips/translate.c b/target-mips/translate.c index e8ecb6e415..e96fe60fd2 100644 --- a/target-mips/translate.c +++ b/target-mips/translate.c @@ -8551,6 +8551,7 @@ CPUMIPSState *cpu_mips_init (const char *cpu_model) env->cpu_model_str = cpu_model; mips_tcg_init(); cpu_reset(env); + qemu_init_vcpu(env); return env; } diff --git a/target-ppc/helper.c b/target-ppc/helper.c index a0d884ee1e..f1663ce3d9 100644 --- a/target-ppc/helper.c +++ b/target-ppc/helper.c @@ -2831,8 +2831,7 @@ CPUPPCState *cpu_ppc_init (const char *cpu_model) cpu_ppc_register_internal(env, def); cpu_ppc_reset(env); - if (kvm_enabled()) - kvm_init_vcpu(env); + qemu_init_vcpu(env); return env; } diff --git a/target-sh4/translate.c b/target-sh4/translate.c index aa3b9d4396..fc3633a6c3 100644 --- a/target-sh4/translate.c +++ b/target-sh4/translate.c @@ -290,6 +290,7 @@ CPUSH4State *cpu_sh4_init(const char *cpu_model) cpu_sh4_reset(env); cpu_sh4_register(env, def); tlb_flush(env, 1); + qemu_init_vcpu(env); return env; } diff --git a/target-sparc/helper.c b/target-sparc/helper.c index b39b16272b..428f97d530 100644 --- a/target-sparc/helper.c +++ b/target-sparc/helper.c @@ -723,6 +723,7 @@ CPUSPARCState *cpu_sparc_init(const char *cpu_model) return NULL; } cpu_reset(env); + qemu_init_vcpu(env); return env; } diff --git a/vl.c b/vl.c index a0dcdea96e..74404647d4 100644 --- a/vl.c +++ b/vl.c @@ -3731,6 +3731,15 @@ static int qemu_init_main_loop(void) return qemu_event_init(); } +void qemu_init_vcpu(void *_env) +{ + CPUState *env = _env; + + if (kvm_enabled()) + kvm_init_vcpu(env); + return; +} + #ifdef _WIN32 static void host_main_loop_wait(int *timeout) { -- cgit v1.2.3