cpu: Change cpu_single_step() argument to CPUState
authorAndreas Färber <afaerber@suse.de>
Mon, 24 Jun 2013 16:41:06 +0000 (18:41 +0200)
committerAndreas Färber <afaerber@suse.de>
Tue, 23 Jul 2013 00:41:32 +0000 (02:41 +0200)
Use CPUState::env_ptr for now.

Needed for GdbState::c_cpu.

Signed-off-by: Andreas Färber <afaerber@suse.de>
exec.c
gdbstub.c
include/exec/cpu-all.h
include/qom/cpu.h

diff --git a/exec.c b/exec.c
index 30b676d7e591052857f113c6d35df420d1613cca..9cd936c5dfa1eea23282ba34981ce89454f6d850 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -585,10 +585,10 @@ void cpu_breakpoint_remove_all(CPUArchState *env, int mask)
 
 /* enable or disable single step mode. EXCP_DEBUG is returned by the
    CPU loop after each instruction */
-void cpu_single_step(CPUArchState *env, int enabled)
+void cpu_single_step(CPUState *cpu, int enabled)
 {
 #if defined(TARGET_HAS_ICE)
-    CPUState *cpu = ENV_GET_CPU(env);
+    CPUArchState *env = cpu->env_ptr;
 
     if (cpu->singlestep_enabled != enabled) {
         cpu->singlestep_enabled = enabled;
index 6ddff91f149c3130e30509af26edd094b78d4acc..8e23509d3f1342a0dac42e278293d0e3db6d900f 100644 (file)
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -2154,7 +2154,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
                     s->c_cpu = env;
                 }
                 if (res == 's') {
-                    cpu_single_step(s->c_cpu, sstep_flags);
+                    cpu_single_step(ENV_GET_CPU(s->c_cpu), sstep_flags);
                 }
                 s->signal = res_signal;
                 gdb_continue(s);
@@ -2182,7 +2182,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
             addr = strtoull(p, (char **)&p, 16);
             gdb_set_cpu_pc(s, addr);
         }
-        cpu_single_step(s->c_cpu, sstep_flags);
+        cpu_single_step(ENV_GET_CPU(s->c_cpu), sstep_flags);
         gdb_continue(s);
        return RS_IDLE;
     case 'F':
@@ -2570,7 +2570,7 @@ send_packet:
     put_packet(s, buf);
 
     /* disable single step if it was enabled */
-    cpu_single_step(env, 0);
+    cpu_single_step(cpu, 0);
 }
 #endif
 
@@ -2763,6 +2763,7 @@ gdb_queuesig (void)
 int
 gdb_handlesig(CPUArchState *env, int sig)
 {
+    CPUState *cpu = ENV_GET_CPU(env);
     GDBState *s;
     char buf[256];
     int n;
@@ -2773,7 +2774,7 @@ gdb_handlesig(CPUArchState *env, int sig)
     }
 
     /* disable single step if it was enabled */
-    cpu_single_step(env, 0);
+    cpu_single_step(cpu, 0);
     tb_flush(env);
 
     if (sig != 0) {
index 5084202217569afef50711c170ac16d14867bf3f..b48db0317b2db5e9f7030dae13a9ad9ccfeffe56 100644 (file)
@@ -428,12 +428,6 @@ int cpu_watchpoint_remove(CPUArchState *env, target_ulong addr,
 void cpu_watchpoint_remove_by_ref(CPUArchState *env, CPUWatchpoint *watchpoint);
 void cpu_watchpoint_remove_all(CPUArchState *env, int mask);
 
-#define SSTEP_ENABLE  0x1  /* Enable simulated HW single stepping */
-#define SSTEP_NOIRQ   0x2  /* Do not use IRQ while single stepping */
-#define SSTEP_NOTIMER 0x4  /* Do not Timers while single stepping */
-
-void cpu_single_step(CPUArchState *env, int enabled);
-
 #if !defined(CONFIG_USER_ONLY)
 
 /* Return the physical page corresponding to a virtual one. Use it
index 94302a415ecdfa85abd0b1e3944e48174e31577b..43a52e459fa03608eba23b26895b73c501c885a9 100644 (file)
@@ -510,6 +510,19 @@ void cpu_resume(CPUState *cpu);
  */
 void qemu_init_vcpu(CPUState *cpu);
 
+#define SSTEP_ENABLE  0x1  /* Enable simulated HW single stepping */
+#define SSTEP_NOIRQ   0x2  /* Do not use IRQ while single stepping */
+#define SSTEP_NOTIMER 0x4  /* Do not Timers while single stepping */
+
+/**
+ * cpu_single_step:
+ * @cpu: CPU to the flags for.
+ * @enabled: Flags to enable.
+ *
+ * Enables or disables single-stepping for @cpu.
+ */
+void cpu_single_step(CPUState *cpu, int enabled);
+
 #ifdef CONFIG_SOFTMMU
 extern const struct VMStateDescription vmstate_cpu_common;
 #else