Patchwork [07/12] target-m68k: QOM'ify CPU reset

login
register
mail settings
Submitter Andreas Färber
Date April 25, 2012, 2:23 p.m.
Message ID <1335363821-26219-8-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/155040/
State New
Headers show

Comments

Andreas Färber - April 25, 2012, 2:23 p.m.
Move code from cpu_state_reset() into QOM m68k_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Laurent Vivier <Laurent@Vivier.EU>
Tested-by: Laurent Vivier <Laurent@Vivier.EU>
---
 target-m68k/cpu.c    |   16 +++++++++++++++-
 target-m68k/helper.c |   18 ++----------------
 2 files changed, 17 insertions(+), 17 deletions(-)

Patch

diff --git a/target-m68k/cpu.c b/target-m68k/cpu.c
index 457c5c1..e599ece 100644
--- a/target-m68k/cpu.c
+++ b/target-m68k/cpu.c
@@ -29,9 +29,23 @@  static void m68k_cpu_reset(CPUState *s)
     M68kCPUClass *mcc = M68K_CPU_GET_CLASS(cpu);
     CPUM68KState *env = &cpu->env;
 
+    if (qemu_loglevel_mask(CPU_LOG_RESET)) {
+        qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
+        log_cpu_state(env, 0);
+    }
+
     mcc->parent_reset(s);
 
-    cpu_state_reset(env);
+    memset(env, 0, offsetof(CPUM68KState, breakpoints));
+#if !defined(CONFIG_USER_ONLY)
+    env->sr = 0x2700;
+#endif
+    m68k_switch_sp(env);
+    /* ??? FP regs should be initialized to NaN.  */
+    env->cc_op = CC_OP_FLAGS;
+    /* TODO: We should set PC from the interrupt vector.  */
+    env->pc = 0;
+    tlb_flush(env, 1);
 }
 
 static void m68k_cpu_class_init(ObjectClass *c, void *data)
diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index e91acdb..69fb147 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -145,21 +145,7 @@  static int cpu_m68k_set_model(CPUM68KState *env, const char *name)
 
 void cpu_state_reset(CPUM68KState *env)
 {
-    if (qemu_loglevel_mask(CPU_LOG_RESET)) {
-        qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
-        log_cpu_state(env, 0);
-    }
-
-    memset(env, 0, offsetof(CPUM68KState, breakpoints));
-#if !defined (CONFIG_USER_ONLY)
-    env->sr = 0x2700;
-#endif
-    m68k_switch_sp(env);
-    /* ??? FP regs should be initialized to NaN.  */
-    env->cc_op = CC_OP_FLAGS;
-    /* TODO: We should set PC from the interrupt vector.  */
-    env->pc = 0;
-    tlb_flush(env, 1);
+    cpu_reset(ENV_GET_CPU(env));
 }
 
 CPUM68KState *cpu_m68k_init(const char *cpu_model)
@@ -183,7 +169,7 @@  CPUM68KState *cpu_m68k_init(const char *cpu_model)
         return NULL;
     }
 
-    cpu_state_reset(env);
+    cpu_reset(ENV_GET_CPU(env));
     qemu_init_vcpu(env);
     return env;
 }