diff options
author | Andreas Färber <afaerber@suse.de> | 2012-02-11 17:26:17 +0100 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2012-04-30 11:32:10 +0200 |
commit | 339894bec9bb99aaeb695173006322c37a102408 (patch) | |
tree | a9e3aca247d098965ef4f00e2768e91b69c44f4a /target-sh4/translate.c | |
parent | 2c9b7d1ab4e06ab742f669366c70d97e54598c36 (diff) |
target-sh4: QOM'ify CPU
Embed CPUSH4State as first member of SuperHCPU.
Let CPUClass::reset() call cpu_state_reset() for now.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target-sh4/translate.c')
-rw-r--r-- | target-sh4/translate.c | 4 |
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); |