aboutsummaryrefslogtreecommitdiff
path: root/target-m68k/helper.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2012-04-15 00:35:50 +0200
committerAndreas Färber <afaerber@suse.de>2012-04-30 11:32:10 +0200
commitb9e7a234343501e2498680fd7bc0cd2aad947560 (patch)
tree9f2541fcf9b88cfc2ebc6d0b89e651b60d5d902a /target-m68k/helper.c
parent2b4b49065670b46b424a329da5d35838180fc209 (diff)
target-m68k: QOM'ify CPU
Embed CPUM68KState as first member of QOM M68kCPU. Drop cpu_m68k_close() in favor of object_delete(). Let CPUClass::reset() call cpu_state_reset() for now. Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Laurent Vivier <Laurent@Vivier.EU> Tested-by: Laurent Vivier <Laurent@Vivier.EU>
Diffstat (limited to 'target-m68k/helper.c')
-rw-r--r--target-m68k/helper.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index 1feed9be67..e91acdbf0d 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -164,10 +164,12 @@ void cpu_state_reset(CPUM68KState *env)
CPUM68KState *cpu_m68k_init(const char *cpu_model)
{
+ M68kCPU *cpu;
CPUM68KState *env;
static int inited;
- env = g_malloc0(sizeof(CPUM68KState));
+ cpu = M68K_CPU(object_new(TYPE_M68K_CPU));
+ env = &cpu->env;
cpu_exec_init(env);
if (!inited) {
inited = 1;
@@ -177,7 +179,7 @@ CPUM68KState *cpu_m68k_init(const char *cpu_model)
env->cpu_model_str = cpu_model;
if (cpu_m68k_set_model(env, cpu_model) < 0) {
- cpu_m68k_close(env);
+ object_delete(OBJECT(cpu));
return NULL;
}
@@ -186,11 +188,6 @@ CPUM68KState *cpu_m68k_init(const char *cpu_model)
return env;
}
-void cpu_m68k_close(CPUM68KState *env)
-{
- g_free(env);
-}
-
void cpu_m68k_flush_flags(CPUM68KState *env, int cc_op)
{
int flags;