aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--target-arm/translate.c7
-rw-r--r--target-i386/helper2.c8
-rw-r--r--target-mips/translate.c5
-rw-r--r--target-ppc/translate_init.c4
4 files changed, 7 insertions, 17 deletions
diff --git a/target-arm/translate.c b/target-arm/translate.c
index afb9b57c89..601db555aa 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -2199,13 +2199,10 @@ CPUARMState *cpu_arm_init(void)
{
CPUARMState *env;
- cpu_exec_init();
-
- env = malloc(sizeof(CPUARMState));
+ env = qemu_mallocz(sizeof(CPUARMState));
if (!env)
return NULL;
- memset(env, 0, sizeof(CPUARMState));
- cpu_single_env = env;
+ cpu_exec_init(env);
return env;
}
diff --git a/target-i386/helper2.c b/target-i386/helper2.c
index 60335909a2..943ff5907b 100644
--- a/target-i386/helper2.c
+++ b/target-i386/helper2.c
@@ -47,12 +47,11 @@ CPUX86State *cpu_x86_init(void)
CPUX86State *env;
static int inited;
- cpu_exec_init();
-
- env = malloc(sizeof(CPUX86State));
+ env = qemu_mallocz(sizeof(CPUX86State));
if (!env)
return NULL;
- memset(env, 0, sizeof(CPUX86State));
+ cpu_exec_init(env);
+
/* init various static tables */
if (!inited) {
inited = 1;
@@ -135,7 +134,6 @@ CPUX86State *cpu_x86_init(void)
env->cpuid_features |= CPUID_MTRR | CPUID_CLFLUSH | CPUID_MCA;
#endif
}
- cpu_single_env = env;
cpu_reset(env);
#ifdef USE_KQEMU
kqemu_init(env);
diff --git a/target-mips/translate.c b/target-mips/translate.c
index 2dc33af728..71b101be32 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -1694,10 +1694,10 @@ CPUMIPSState *cpu_mips_init (void)
{
CPUMIPSState *env;
- cpu_exec_init();
env = qemu_mallocz(sizeof(CPUMIPSState));
if (!env)
return NULL;
+ cpu_exec_init(env);
tlb_flush(env, 1);
/* Minimal init */
env->PC = 0xBFC00000;
@@ -1722,8 +1722,5 @@ CPUMIPSState *cpu_mips_init (void)
env->CP0_Debug = (1 << CP0DB_CNT) | (0x1 << CP0DB_VER);
env->CP0_PRid = MIPS_CPU;
env->exception_index = EXCP_NONE;
-
- cpu_single_env = env;
-
return env;
}
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 624527d5f9..012c34f73d 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -1081,11 +1081,10 @@ CPUPPCState *cpu_ppc_init(void)
{
CPUPPCState *env;
- cpu_exec_init();
-
env = qemu_mallocz(sizeof(CPUPPCState));
if (!env)
return NULL;
+ cpu_exec_init(env);
tlb_flush(env, 1);
#if defined (DO_SINGLE_STEP) && 0
/* Single step trace mode */
@@ -1101,7 +1100,6 @@ CPUPPCState *cpu_ppc_init(void)
#endif
do_compute_hflags(env);
env->reserve = -1;
- cpu_single_env = env;
return env;
}