From nobody Mon Feb 9 05:01:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493979480232749.2451442457748; Fri, 5 May 2017 03:18:00 -0700 (PDT) Received: from localhost ([::1]:46052 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6aJC-0005V5-DJ for importer@patchew.org; Fri, 05 May 2017 06:17:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6aF9-0002DE-La for qemu-devel@nongnu.org; Fri, 05 May 2017 06:13:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6aF7-0006bl-W7 for qemu-devel@nongnu.org; Fri, 05 May 2017 06:13:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21835) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d6aF7-0006bT-Mx for qemu-devel@nongnu.org; Fri, 05 May 2017 06:13:45 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8E617C0467E5; Fri, 5 May 2017 10:13:44 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-116-145.ams2.redhat.com [10.36.116.145]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v45ADbkL026855; Fri, 5 May 2017 06:13:43 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8E617C0467E5 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=pbonzini@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8E617C0467E5 From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 5 May 2017 12:13:20 +0200 Message-Id: <20170505101337.4650-5-pbonzini@redhat.com> In-Reply-To: <20170505101337.4650-1-pbonzini@redhat.com> References: <20170505101337.4650-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 05 May 2017 10:13:44 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 04/21] target/i386: Add GDB XML register description support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Abdallah Bouassida Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Abdallah Bouassida This patch implements XML target description support for X86 and X86-64 architectures in the GDB stub, as the way with ARM and PowerPC: - gdb-xml/32bit-core.xml & gdb-xml/64bit-core.xml: Adding the XML target description files, these files are picked from GDB source code. - configure: Define gdb_xml_files for X86 targets. - target/i386/cpu.c: Define gdb_core_xml_file and gdb_arch_name to add XML awareness for this architecture, modify the gdb_num_core_regs to fit the registers number defined in each XML file. Signed-off-by: Abdallah Bouassida Message-Id: <2b3c8119-1602-28c7-eab4-296593877103@lauterbach.com> Signed-off-by: Paolo Bonzini --- configure | 2 ++ gdb-xml/i386-32bit-core.xml | 65 ++++++++++++++++++++++++++++++++++++++++ gdb-xml/i386-64bit-core.xml | 73 +++++++++++++++++++++++++++++++++++++++++= ++++ target/i386/cpu.c | 21 ++++++++++--- 4 files changed, 157 insertions(+), 4 deletions(-) create mode 100644 gdb-xml/i386-32bit-core.xml create mode 100644 gdb-xml/i386-64bit-core.xml diff --git a/configure b/configure index 48a9370cc6..ff2c81f2c7 100755 --- a/configure +++ b/configure @@ -6023,9 +6023,11 @@ TARGET_ABI_DIR=3D"" =20 case "$target_name" in i386) + gdb_xml_files=3D"i386-32bit-core.xml" ;; x86_64) TARGET_BASE_ARCH=3Di386 + gdb_xml_files=3D"i386-64bit-core.xml" ;; alpha) mttcg=3D"yes" diff --git a/gdb-xml/i386-32bit-core.xml b/gdb-xml/i386-32bit-core.xml new file mode 100644 index 0000000000..7aeeeca3b2 --- /dev/null +++ b/gdb-xml/i386-32bit-core.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb-xml/i386-64bit-core.xml b/gdb-xml/i386-64bit-core.xml new file mode 100644 index 0000000000..5088d84ceb --- /dev/null +++ b/gdb-xml/i386-64bit-core.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 13c0985f11..7e87031fad 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -2577,6 +2577,15 @@ out: return ret; } =20 +static gchar *x86_gdb_arch_name(CPUState *cs) +{ +#ifdef TARGET_X86_64 + return g_strdup("i386:x86-64"); +#else + return g_strdup("i386"); +#endif +} + X86CPU *cpu_x86_init(const char *cpu_model) { return X86_CPU(cpu_generic_init(TYPE_X86_CPU, cpu_model)); @@ -4056,10 +4065,14 @@ static void x86_cpu_common_class_init(ObjectClass *= oc, void *data) cc->write_elf32_qemunote =3D x86_cpu_write_elf32_qemunote; cc->vmsd =3D &vmstate_x86_cpu; #endif - /* CPU_NB_REGS * 2 =3D general regs + xmm regs - * 25 =3D eip, eflags, 6 seg regs, st[0-7], fctrl,...,fop, mxcsr. - */ - cc->gdb_num_core_regs =3D CPU_NB_REGS * 2 + 25; + cc->gdb_arch_name =3D x86_gdb_arch_name; +#ifdef TARGET_X86_64 + cc->gdb_core_xml_file =3D "i386-64bit-core.xml"; + cc->gdb_num_core_regs =3D 40; +#else + cc->gdb_core_xml_file =3D "i386-32bit-core.xml"; + cc->gdb_num_core_regs =3D 32; +#endif #ifndef CONFIG_USER_ONLY cc->debug_excp_handler =3D breakpoint_handler; #endif --=20 2.12.2