aboutsummaryrefslogtreecommitdiff
path: root/target-sh4/translate.c
diff options
context:
space:
mode:
Diffstat (limited to 'target-sh4/translate.c')
-rw-r--r--target-sh4/translate.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/target-sh4/translate.c b/target-sh4/translate.c
index a337beb9ef..6309e85b69 100644
--- a/target-sh4/translate.c
+++ b/target-sh4/translate.c
@@ -267,13 +267,15 @@ static void cpu_register(CPUSH4State *env, const sh4_def_t *def)
CPUSH4State *cpu_sh4_init(const char *cpu_model)
{
+ SuperHCPU *cpu;
CPUSH4State *env;
const sh4_def_t *def;
def = cpu_sh4_find_by_name(cpu_model);
if (!def)
return NULL;
- env = g_malloc0(sizeof(CPUSH4State));
+ cpu = SUPERH_CPU(object_new(TYPE_SUPERH_CPU));
+ env = &cpu->env;
env->features = def->features;
cpu_exec_init(env);
env->movcal_backup_tail = &(env->movcal_backup);