Received: from eggs.gnu.org ([2001:4830:134:3::10]:52426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uvtfk-0004tY-Us for qemu-devel@nongnu.org; Sun, 07 Jul 2013 14:26:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uvtfi-0004og-JH for qemu-devel@nongnu.org; Sun, 07 Jul 2013 14:26:56 -0400 Received: from cantor2.suse.de ([195.135.220.15]:58089 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uvtfi-0004oS-5L for qemu-devel@nongnu.org; Sun, 07 Jul 2013 14:26:54 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 966CEA5359 for ; Sun, 7 Jul 2013 20:26:53 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 7 Jul 2013 20:25:58 +0200 Message-Id: <1373221591-17091-10-git-send-email-afaerber@suse.de> In-Reply-To: <1373221591-17091-1-git-send-email-afaerber@suse.de> References: <1373221591-17091-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH qom-cpu v2 09/42] cpu: Change cpu_single_step() argument to CPUState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= Use CPUState::env_ptr for now. Needed for GdbState::c_cpu. Signed-off-by: Andreas F=C3=A4rber --- 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 ae6eb24..4c9e921 100644 --- a/exec.c +++ b/exec.c @@ -585,10 +585,10 @@ void cpu_breakpoint_remove_all(CPUArchState *env, i= nt mask) =20 /* 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 =3D ENV_GET_CPU(env); + CPUArchState *env =3D cpu->env_ptr; =20 if (cpu->singlestep_enabled !=3D enabled) { cpu->singlestep_enabled =3D enabled; diff --git a/gdbstub.c b/gdbstub.c index ede5cb1..17da380 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -2153,7 +2153,7 @@ static int gdb_handle_packet(GDBState *s, const cha= r *line_buf) s->c_cpu =3D env; } if (res =3D=3D 's') { - cpu_single_step(s->c_cpu, sstep_flags); + cpu_single_step(ENV_GET_CPU(s->c_cpu), sstep_flags); } s->signal =3D res_signal; gdb_continue(s); @@ -2181,7 +2181,7 @@ static int gdb_handle_packet(GDBState *s, const cha= r *line_buf) addr =3D 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': @@ -2568,7 +2568,7 @@ send_packet: put_packet(s, buf); =20 /* disable single step if it was enabled */ - cpu_single_step(env, 0); + cpu_single_step(cpu, 0); } #endif =20 @@ -2761,6 +2761,7 @@ gdb_queuesig (void) int gdb_handlesig(CPUArchState *env, int sig) { + CPUState *cpu =3D ENV_GET_CPU(env); GDBState *s; char buf[256]; int n; @@ -2771,7 +2772,7 @@ gdb_handlesig(CPUArchState *env, int sig) } =20 /* disable single step if it was enabled */ - cpu_single_step(env, 0); + cpu_single_step(cpu, 0); tb_flush(env); =20 if (sig !=3D 0) { diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 6499cd0..1f3c002 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 *watc= hpoint); void cpu_watchpoint_remove_all(CPUArchState *env, int mask); =20 -#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) =20 /* Return the physical page corresponding to a virtual one. Use it diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 136482c..641be1c 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -496,6 +496,19 @@ void cpu_resume(CPUState *cpu); */ void qemu_init_vcpu(CPUState *cpu); =20 +#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 --=20 1.8.1.4