qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PULL 13/24] cpu: Change cpu_single_step() argument to CPUState
Date: Tue, 23 Jul 2013 04:53:45 +0200	[thread overview]
Message-ID: <1374548036-14471-14-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1374548036-14471-1-git-send-email-afaerber@suse.de>

Use CPUState::env_ptr for now.

Needed for GdbState::c_cpu.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 exec.c                 |  4 ++--
 gdbstub.c              |  9 +++++----
 include/exec/cpu-all.h |  6 ------
 include/qom/cpu.h      | 13 +++++++++++++
 4 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/exec.c b/exec.c
index 30b676d..9cd936c 100644
--- 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;
diff --git a/gdbstub.c b/gdbstub.c
index 6ddff91..8e23509 100644
--- 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) {
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 5084202..b48db03 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -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
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 94302a4..43a52e4 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -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
-- 
1.8.1.4

  parent reply	other threads:[~2013-07-23  2:54 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23  2:53 [Qemu-devel] [PULL 00/24] QOM CPUState patch queue 2013-07-22 Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 01/24] gdbstub: Change GDBState::query_cpu to CPUState Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 02/24] cpu: Introduce vaddr type Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 03/24] HACKING: Document vaddr type usage Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 04/24] cpu: Introduce CPUClass::set_pc() for gdb_set_cpu_pc() Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 05/24] target-m68k: Implement CPUClass::set_pc() Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 06/24] target-moxie: " Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 07/24] target-unicore32: " Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 08/24] cpu: Introduce CPUClass::synchronize_from_tb() for cpu_pc_from_tb() Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 09/24] target-alpha: Copy singlestep_enabled to DisasContext Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 10/24] target-alpha: Copy implver " Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 11/24] cpu: Move singlestep_enabled field from CPU_COMMON to CPUState Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 12/24] gdbstub: Update gdb_handlesig() and gdb_signalled() Coding Style Andreas Färber
2013-07-23  2:53 ` Andreas Färber [this message]
2013-07-23  2:53 ` [Qemu-devel] [PULL 14/24] kvm: Change kvm_{insert, remove}_breakpoint() argument to CPUState Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 15/24] gdbstub: Change syscall callback " Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 16/24] gdbstub: Change gdb_handlesig() " Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 17/24] gdbstub: Change gdb_{read, write}_register() " Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 18/24] cpu: Turn cpu_get_phys_page_debug() into a CPUClass hook Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 19/24] exec: Change cpu_memory_rw_debug() argument to CPUState Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 20/24] cpu: Introduce CPUClass::memory_rw_debug() for target_memory_rw_debug() Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 21/24] gdbstub: Change GDBState::{c, g}_cpu and find_cpu() to CPUState Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 22/24] cpu: Move gdb_regs field from CPU_COMMON " Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 23/24] gdbstub: Change gdb_register_coprocessor() argument " Andreas Färber
2013-07-23  2:53 ` [Qemu-devel] [PULL 24/24] linux-user: Use X86CPU property to retrieve CPUID family Andreas Färber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1374548036-14471-14-git-send-email-afaerber@suse.de \
    --to=afaerber@suse.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).