Received: from eggs.gnu.org ([2001:4830:134:3::10]:43733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Sk5-00056W-0L for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:54:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1Sk3-0005Mh-AN for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:54:24 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49821 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Sk2-0005MX-W3 for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:54:23 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 61B57A51FE for ; Tue, 23 Jul 2013 04:54:22 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Tue, 23 Jul 2013 04:53:54 +0200 Message-Id: <1374548036-14471-23-git-send-email-afaerber@suse.de> In-Reply-To: <1374548036-14471-1-git-send-email-afaerber@suse.de> References: <1374548036-14471-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] [PULL 22/24] cpu: Move gdb_regs field from CPU_COMMON 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?= Prepares for changing gdb_register_coprocessor() argument to CPUState. Signed-off-by: Andreas F=C3=A4rber --- gdbstub.c | 11 ++++++----- include/exec/cpu-defs.h | 2 -- include/qom/cpu.h | 2 ++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index ee31603..e58d06e 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1840,7 +1840,7 @@ static const char *get_feature_xml(const char *p, c= onst char **newp) /* Generate the XML description for this CPU. */ if (!target_xml[0]) { GDBRegisterState *r; - CPUArchState *env =3D first_cpu->env_ptr; + CPUState *cpu =3D first_cpu; =20 snprintf(target_xml, sizeof(target_xml), "" @@ -1849,7 +1849,7 @@ static const char *get_feature_xml(const char *p, c= onst char **newp) "", GDB_CORE_XML); =20 - for (r =3D env->gdb_regs; r; r =3D r->next) { + for (r =3D cpu->gdb_regs; r; r =3D r->next) { pstrcat(target_xml, sizeof(target_xml), "xml); pstrcat(target_xml, sizeof(target_xml), "\"/>"); @@ -1875,7 +1875,7 @@ static int gdb_read_register(CPUState *cpu, uint8_t= *mem_buf, int reg) if (reg < NUM_CORE_REGS) return cpu_gdb_read_register(env, mem_buf, reg); =20 - for (r =3D env->gdb_regs; r; r =3D r->next) { + for (r =3D cpu->gdb_regs; r; r =3D r->next) { if (r->base_reg <=3D reg && reg < r->base_reg + r->num_regs) { return r->get_reg(env, mem_buf, reg - r->base_reg); } @@ -1891,7 +1891,7 @@ static int gdb_write_register(CPUState *cpu, uint8_= t *mem_buf, int reg) if (reg < NUM_CORE_REGS) return cpu_gdb_write_register(env, mem_buf, reg); =20 - for (r =3D env->gdb_regs; r; r =3D r->next) { + for (r =3D cpu->gdb_regs; r; r =3D r->next) { if (r->base_reg <=3D reg && reg < r->base_reg + r->num_regs) { return r->set_reg(env, mem_buf, reg - r->base_reg); } @@ -1910,11 +1910,12 @@ void gdb_register_coprocessor(CPUArchState * env, gdb_reg_cb get_reg, gdb_reg_cb set_reg, int num_regs, const char *xml, int g_pos) { + CPUState *cpu =3D ENV_GET_CPU(env); GDBRegisterState *s; GDBRegisterState **p; static int last_reg =3D NUM_CORE_REGS; =20 - p =3D &env->gdb_regs; + p =3D &cpu->gdb_regs; while (*p) { /* Check for duplicates. */ if (strcmp((*p)->xml, xml) =3D=3D 0) diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h index 12b1ca7..b5b93db 100644 --- a/include/exec/cpu-defs.h +++ b/include/exec/cpu-defs.h @@ -174,8 +174,6 @@ typedef struct CPUWatchpoint { QTAILQ_HEAD(watchpoints_head, CPUWatchpoint) watchpoints; = \ CPUWatchpoint *watchpoint_hit; = \ = \ - struct GDBRegisterState *gdb_regs; = \ - = \ /* Core interrupt code */ = \ sigjmp_buf jmp_env; = \ int exception_index; = \ diff --git a/include/qom/cpu.h b/include/qom/cpu.h index f71ec2d..daf1835 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -141,6 +141,7 @@ struct kvm_run; * @singlestep_enabled: Flags for single-stepping. * @env_ptr: Pointer to subclass-specific CPUArchState field. * @current_tb: Currently executing TB. + * @gdb_regs: Additional GDB registers. * @next_cpu: Next CPU sharing TB cache. * @kvm_fd: vCPU file descriptor for KVM. * @@ -175,6 +176,7 @@ struct CPUState { =20 void *env_ptr; /* CPUArchState */ struct TranslationBlock *current_tb; + struct GDBRegisterState *gdb_regs; CPUState *next_cpu; =20 int kvm_fd; --=20 1.8.1.4