From nobody Wed Jun 26 06:16:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linux.ibm.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547581348688549.1956652261052; Tue, 15 Jan 2019 11:42:28 -0800 (PST) Received: from localhost ([127.0.0.1]:34397 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjUbT-0003EJ-39 for importer@patchew.org; Tue, 15 Jan 2019 14:42:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjUXM-0008Tj-Ns for qemu-devel@nongnu.org; Tue, 15 Jan 2019 14:38:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjUXK-0000Ge-Cr for qemu-devel@nongnu.org; Tue, 15 Jan 2019 14:38:12 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51908) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjUXH-00007N-TO for qemu-devel@nongnu.org; Tue, 15 Jan 2019 14:38:10 -0500 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id x0FJZcqD103021 for ; Tue, 15 Jan 2019 14:38:01 -0500 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0a-001b2d01.pphosted.com with ESMTP id 2q1nbw9q2h-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 15 Jan 2019 14:38:01 -0500 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 15 Jan 2019 19:37:59 -0000 Received: from b01cxnp23033.gho.pok.ibm.com (9.57.198.28) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 15 Jan 2019 19:37:56 -0000 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x0FJbtm923199824 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 15 Jan 2019 19:37:55 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AD07AAE05F; Tue, 15 Jan 2019 19:37:55 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F13AEAE060; Tue, 15 Jan 2019 19:37:54 +0000 (GMT) Received: from farosas.linux.ibm.com.br.ibm.com (unknown [9.86.26.11]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 15 Jan 2019 19:37:54 +0000 (GMT) From: Fabiano Rosas To: qemu-devel@nongnu.org Date: Tue, 15 Jan 2019 17:37:48 -0200 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190115193750.17234-1-farosas@linux.ibm.com> References: <20190115193750.17234-1-farosas@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19011519-0064-0000-0000-0000039718D1 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010413; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000274; SDB=6.01146952; UDB=6.00597411; IPR=6.00927244; MB=3.00025142; MTD=3.00000008; XFM=3.00000015; UTC=2019-01-15 19:37:58 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19011519-0065-0000-0000-00003C0C3F11 Message-Id: <20190115193750.17234-2-farosas@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-01-15_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901150156 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v3 1/3] target/ppc: Add SPRs XML generation code for gdbstub 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: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" A following patch will add support for handling the Special Purpose Registers (SPR) in GDB via gdbstub. For that purpose, GDB needs to be provided with an XML description of the registers (see gdb-xml directory). This patch adds the code that generates the XML dynamically based on the SPRs already defined in the machine. This eliminates the need for several XML files to match each possible ppc machine. A "group" is defined so that the GDB command `info registers spr` can be used. Signed-off-by: Fabiano Rosas --- target/ppc/cpu.h | 8 +++++++ target/ppc/gdbstub.c | 54 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 486abaf99b..34f0d2d419 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -230,6 +230,7 @@ struct ppc_spr_t { void (*oea_write)(DisasContext *ctx, int spr_num, int gpr_num); void (*hea_read)(DisasContext *ctx, int gpr_num, int spr_num); void (*hea_write)(DisasContext *ctx, int spr_num, int gpr_num); + unsigned int gdb_id; #endif const char *name; target_ulong default_value; @@ -1053,6 +1054,9 @@ struct CPUPPCState { /* Special purpose registers */ target_ulong spr[1024]; ppc_spr_t spr_cb[1024]; +#if !defined(CONFIG_USER_ONLY) + const char *gdb_spr_xml; +#endif /* Vector status and control register */ uint32_t vscr; /* VSX registers (including FP and AVR) */ @@ -1267,6 +1271,10 @@ int ppc_cpu_gdb_read_register(CPUState *cpu, uint8_t= *buf, int reg); int ppc_cpu_gdb_read_register_apple(CPUState *cpu, uint8_t *buf, int reg); int ppc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); int ppc_cpu_gdb_write_register_apple(CPUState *cpu, uint8_t *buf, int reg); +#ifndef CONFIG_USER_ONLY +int ppc_gdb_gen_spr_xml(CPUState *cpu); +const char *ppc_gdb_get_dynamic_xml(CPUState *cs, const char *xml_name); +#endif int ppc64_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs, int cpuid, void *opaque); int ppc32_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cs, diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index 19565b584d..ce4b728028 100644 --- a/target/ppc/gdbstub.c +++ b/target/ppc/gdbstub.c @@ -319,3 +319,57 @@ int ppc_cpu_gdb_write_register_apple(CPUState *cs, uin= t8_t *mem_buf, int n) } return r; } + +#ifndef CONFIG_USER_ONLY +int ppc_gdb_gen_spr_xml(CPUState *cs) +{ + PowerPCCPU *cpu =3D POWERPC_CPU(cs); + CPUPPCState *env =3D &cpu->env; + GString *s =3D g_string_new(NULL); + unsigned int num_regs =3D 0; + int i; + + g_string_printf(s, ""); + g_string_append_printf(s, "= "); + g_string_append_printf(s, ""); + + for (i =3D 0; i < ARRAY_SIZE(env->spr_cb); i++) { + ppc_spr_t *spr =3D &env->spr_cb[i]; + + if (!spr->name) { + continue; + } + + g_string_append_printf(s, "name, -1)); + g_string_append_printf(s, " bitsize=3D\"%d\"", TARGET_LONG_BITS); + g_string_append_printf(s, " group=3D\"spr\"/>"); + + /* + * GDB identifies registers based on the order they are + * presented in the XML. These ids will not match QEMU's + * representation (which follows the PowerISA). + * + * Store the position of the current register description so + * we can make the correspondence later. + */ + spr->gdb_id =3D num_regs; + num_regs++; + } + + g_string_append_printf(s, ""); + env->gdb_spr_xml =3D g_string_free(s, false); + return num_regs; +} + +const char *ppc_gdb_get_dynamic_xml(CPUState *cs, const char *xml_name) +{ + PowerPCCPU *cpu =3D POWERPC_CPU(cs); + CPUPPCState *env =3D &cpu->env; + + if (strcmp(xml_name, "power-spr.xml") =3D=3D 0) { + return env->gdb_spr_xml; + } + return NULL; +} +#endif --=20 2.17.1 From nobody Wed Jun 26 06:16:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linux.ibm.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547581473653374.8238993473931; Tue, 15 Jan 2019 11:44:33 -0800 (PST) Received: from localhost ([127.0.0.1]:35032 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjUdU-0005OD-I0 for importer@patchew.org; Tue, 15 Jan 2019 14:44:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjUXK-0008Sa-1U for qemu-devel@nongnu.org; Tue, 15 Jan 2019 14:38:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjUXE-0000AS-2a for qemu-devel@nongnu.org; Tue, 15 Jan 2019 14:38:05 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:57438 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjUXD-00009G-RY for qemu-devel@nongnu.org; Tue, 15 Jan 2019 14:38:03 -0500 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id x0FJaQ8R045072 for ; Tue, 15 Jan 2019 14:38:03 -0500 Received: from e14.ny.us.ibm.com (e14.ny.us.ibm.com [129.33.205.204]) by mx0a-001b2d01.pphosted.com with ESMTP id 2q1jbp57b1-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 15 Jan 2019 14:38:01 -0500 Received: from localhost by e14.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 15 Jan 2019 19:38:01 -0000 Received: from b01cxnp22035.gho.pok.ibm.com (9.57.198.25) by e14.ny.us.ibm.com (146.89.104.201) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 15 Jan 2019 19:37:59 -0000 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x0FJbwLf26018016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 15 Jan 2019 19:37:58 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 032F3AE062; Tue, 15 Jan 2019 19:37:58 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 29FC1AE064; Tue, 15 Jan 2019 19:37:57 +0000 (GMT) Received: from farosas.linux.ibm.com.br.ibm.com (unknown [9.86.26.11]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 15 Jan 2019 19:37:56 +0000 (GMT) From: Fabiano Rosas To: qemu-devel@nongnu.org Date: Tue, 15 Jan 2019 17:37:49 -0200 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190115193750.17234-1-farosas@linux.ibm.com> References: <20190115193750.17234-1-farosas@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19011519-0052-0000-0000-00000378CE1A X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010413; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000274; SDB=6.01146952; UDB=6.00597411; IPR=6.00927244; MB=3.00025142; MTD=3.00000008; XFM=3.00000015; UTC=2019-01-15 19:38:00 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19011519-0053-0000-0000-00005F7A7C01 Message-Id: <20190115193750.17234-3-farosas@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-01-15_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=961 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901150156 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v3 2/3] target/ppc: Add GDB callbacks for SPRs 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: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" These will be used to let GDB know about PPC's Special Purpose Registers (SPR). They take an index based on the order the registers appear in the XML file sent by QEMU to GDB. This index does not match the actual location of the registers in the env->spr array so the gdb_find_spr_idx function does that conversion. Signed-off-by: Fabiano Rosas --- target/ppc/translate_init.inc.c | 54 ++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.in= c.c index ade06cc773..9c6c935204 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -9483,6 +9483,55 @@ static bool avr_need_swap(CPUPPCState *env) #endif } =20 +#if !defined(CONFIG_USER_ONLY) +static int gdb_find_spr_idx(CPUPPCState *env, int n) +{ + int i; + + for (i =3D 0; i < ARRAY_SIZE(env->spr_cb); i++) { + ppc_spr_t *spr =3D &env->spr_cb[i]; + + if (spr->name && spr->gdb_id =3D=3D n) { + return i; + } + } + return -1; +} + +static int gdb_get_spr_reg(CPUPPCState *env, uint8_t *mem_buf, int n) +{ + int reg; + int len; + + reg =3D gdb_find_spr_idx(env, n); + if (reg < 0) { + return 0; + } + + len =3D TARGET_LONG_SIZE; + stn_p(mem_buf, len, env->spr[reg]); + ppc_maybe_bswap_register(env, mem_buf, len); + return len; +} + +static int gdb_set_spr_reg(CPUPPCState *env, uint8_t *mem_buf, int n) +{ + int reg; + int len; + + reg =3D gdb_find_spr_idx(env, n); + if (reg < 0) { + return 0; + } + + len =3D TARGET_LONG_SIZE; + ppc_maybe_bswap_register(env, mem_buf, len); + env->spr[reg] =3D ldn_p(mem_buf, len); + + return len; +} +#endif + static int gdb_get_float_reg(CPUPPCState *env, uint8_t *mem_buf, int n) { if (n < 32) { @@ -9712,7 +9761,10 @@ static void ppc_cpu_realize(DeviceState *dev, Error = **errp) gdb_register_coprocessor(cs, gdb_get_vsx_reg, gdb_set_vsx_reg, 32, "power-vsx.xml", 0); } - +#ifndef CONFIG_USER_ONLY + gdb_register_coprocessor(cs, gdb_get_spr_reg, gdb_set_spr_reg, + ppc_gdb_gen_spr_xml(cs), "power-spr.xml", 0); +#endif qemu_init_vcpu(cs); =20 pcc->parent_realize(dev, errp); --=20 2.17.1 From nobody Wed Jun 26 06:16:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linux.ibm.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547581537158328.62895032127904; Tue, 15 Jan 2019 11:45:37 -0800 (PST) Received: from localhost ([127.0.0.1]:35285 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjUeR-000630-Qp for importer@patchew.org; Tue, 15 Jan 2019 14:45:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60053) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjUXN-0008UQ-Bv for qemu-devel@nongnu.org; Tue, 15 Jan 2019 14:38:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjUXL-0000I5-6Q for qemu-devel@nongnu.org; Tue, 15 Jan 2019 14:38:13 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:39982 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjUXK-0000Cu-Am for qemu-devel@nongnu.org; Tue, 15 Jan 2019 14:38:11 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id x0FJaGvv091526 for ; Tue, 15 Jan 2019 14:38:07 -0500 Received: from e14.ny.us.ibm.com (e14.ny.us.ibm.com [129.33.205.204]) by mx0b-001b2d01.pphosted.com with ESMTP id 2q1jqam56d-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 15 Jan 2019 14:38:06 -0500 Received: from localhost by e14.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 15 Jan 2019 19:38:04 -0000 Received: from b01cxnp22036.gho.pok.ibm.com (9.57.198.26) by e14.ny.us.ibm.com (146.89.104.201) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 15 Jan 2019 19:38:01 -0000 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x0FJc0Of23986176 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 15 Jan 2019 19:38:00 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 49312AE064; Tue, 15 Jan 2019 19:38:00 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 704EAAE060; Tue, 15 Jan 2019 19:37:59 +0000 (GMT) Received: from farosas.linux.ibm.com.br.ibm.com (unknown [9.86.26.11]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 15 Jan 2019 19:37:59 +0000 (GMT) From: Fabiano Rosas To: qemu-devel@nongnu.org Date: Tue, 15 Jan 2019 17:37:50 -0200 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190115193750.17234-1-farosas@linux.ibm.com> References: <20190115193750.17234-1-farosas@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19011519-0052-0000-0000-00000378CE1D X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010413; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000274; SDB=6.01146952; UDB=6.00597411; IPR=6.00927244; MB=3.00025142; MTD=3.00000008; XFM=3.00000015; UTC=2019-01-15 19:38:03 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19011519-0053-0000-0000-00005F7A7C06 Message-Id: <20190115193750.17234-4-farosas@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-01-15_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=987 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901150156 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v3 3/3] target/ppc: Enable reporting of SPRs to GDB 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: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This allows reading and writing of SPRs via GDB: (gdb) p/x $srr1 $1 =3D 0x8000000002803033 (gdb) p/x $pvr $2 =3D 0x4b0201 (gdb) set $pvr=3D0x4b0000 (gdb) p/x $pvr $3 =3D 0x4b0000 They can also be shown as a group: (gdb) info reg spr Signed-off-by: Fabiano Rosas --- target/ppc/translate_init.inc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.in= c.c index 9c6c935204..ebf202e54d 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -10527,7 +10527,9 @@ static void ppc_cpu_class_init(ObjectClass *oc, voi= d *data) #endif =20 cc->gdb_num_core_regs =3D 71; - +#ifndef CONFIG_USER_ONLY + cc->gdb_get_dynamic_xml =3D ppc_gdb_get_dynamic_xml; +#endif #ifdef USE_APPLE_GDB cc->gdb_read_register =3D ppc_cpu_gdb_read_register_apple; cc->gdb_write_register =3D ppc_cpu_gdb_write_register_apple; --=20 2.17.1