target/arm: Support MVE in gdbstub
cover target/arm: Support MVE in gdbstub
This patchset's aim is to report MVE to gdb via the gdbstub. That is done by the final patch, which is an RFC because the gdb patches to support it are not yet upstream and so the XML format isn't final. (Sending the XML works fine with a GDB without the MVE support; you just don't get the auto-generated pseudo-registers that display the Q-regs, so all you see is the S and D reg versions of the data.)
Patches 1 through 4 are cleanup of the arm gdbstub related code of various kinds; this part of the series should be OK to go into QEMU as soon as it's reviewed.
Luis: you'll find that with this entire patchset a GDB built with your patches doesn't crash, because in patch 4 I stopped QEMU reporting FPSID and FPEXC in the org.gnu.gdb.arm.vfp XML feature.
thanks
-- PMM
Peter Maydell (5):
configs: Don't include 32-bit-only GDB XML in aarch64 linux configs target/arm: Fix coding style issues in gdbstub code in helper.c target/arm: Move gdbstub related code out of helper.c target/arm: Don't put FPEXC and FPSID in org.gnu.gdb.arm.vfp XML [RFC] target/arm: Advertise MVE to gdb when present
configs/targets/aarch64-linux-user.mak | 2 +- configs/targets/aarch64-softmmu.mak | 2 +- configs/targets/aarch64_be-linux-user.mak | 2 +- configs/targets/arm-linux-user.mak | 2 +- configs/targets/arm-softmmu.mak | 2 +- configs/targets/armeb-linux-user.mak | 2 +- target/arm/internals.h | 7 + target/arm/gdbstub.c | 179 +++++++++++++++ target/arm/gdbstub64.c | 140 ++++++++++++ target/arm/helper.c | 262 ---------------------- gdb-xml/arm-m-profile-mve.xml | 19 ++ gdb-xml/arm-neon.xml | 2 - gdb-xml/arm-vfp-sysregs.xml | 17 ++ gdb-xml/arm-vfp.xml | 2 - gdb-xml/arm-vfp3.xml | 2 - 15 files changed, 368 insertions(+), 274 deletions(-) create mode 100644 gdb-xml/arm-m-profile-mve.xml create mode 100644 gdb-xml/arm-vfp-sysregs.xml
Signature · 1 line
2.20.1
PATCH 1/5 configs: Don't include 32-bit-only GDB XML in aarch64 linux configs
The aarch64-linux QEMU usermode binaries can never run 32-bit code, so they do not need to include the GDB XML for it. (arm_cpu_register_gdb_regs_for_features() will not use these XML files if the CPU has ARM_FEATURE_AARCH64, so we will not advertise to gdb that we have them.)
--- configs/targets/aarch64-linux-user.mak | 2 +- configs/targets/aarch64_be-linux-user.mak | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
configs/targets/aarch64-linux-user.mak +1 -1
@@ -1,5 +1,5 @@ TARGET_ARCH=aarch64 TARGET_BASE_ARCH=arm -TARGET_XML_FILES= gdb-xml/aarch64-core.xml gdb-xml/aarch64-fpu.xml gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml +TARGET_XML_FILES= gdb-xml/aarch64-core.xml gdb-xml/aarch64-fpu.xml TARGET_HAS_BFLT=y CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y
configs/targets/aarch64_be-linux-user.mak +1 -1
@@ -1,6 +1,6 @@ TARGET_ARCH=aarch64 TARGET_BASE_ARCH=arm TARGET_WORDS_BIGENDIAN=y -TARGET_XML_FILES= gdb-xml/aarch64-core.xml gdb-xml/aarch64-fpu.xml gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml +TARGET_XML_FILES= gdb-xml/aarch64-core.xml gdb-xml/aarch64-fpu.xml TARGET_HAS_BFLT=y CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y
Signature · 1 line
2.20.1
Re: [PATCH 1/5] configs: Don't include 32-bit-only GDB XML in aarch64 linux configs
Quoted 11 lines · Peter Maydell
The aarch64-linux QEMU usermode binaries can never run 32-bit code, so they do not need to include the GDB XML for it. (
arm_cpu_register_gdb_regs_for_features()will not use these XML files if the CPU hasARM_FEATURE_AARCH64, so we will not advertise to gdb that we have them.)Signed-off-by Peter Maydell<[email protected]>--- configs/targets/aarch64-linux-user.mak | 2 +- configs/targets/aarch64_be-linux-user.mak | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
r~
PATCH 2/5 target/arm: Fix coding style issues in gdbstub code in helper.c
In reply to Peter MaydellWe're going to move this code to a different file; fix the coding style first so checkpatch doesn't complain. This includes deleting the spurious 'break' statements after returns in the vfp_gdb_get_reg() function.
--- target/arm/helper.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
target/arm/helper.c +16 -7
@@ -72,9 +72,12 @@ static int vfp_gdb_get_reg(CPUARMState *env, GByteArray *buf, int reg) } }switch (reg - nregs) { -case 0 :return gdb_get_reg32 (buf, env->vfp.xregs[ARM_VFP_FPSID ]);break ; -case 1 :return gdb_get_reg32 (buf,vfp_get_fpscr (env));break ; -case 2 :return gdb_get_reg32 (buf, env->vfp.xregs[ARM_VFP_FPEXC ]);break ; +case 0 : +return gdb_get_reg32 (buf, env->vfp.xregs[ARM_VFP_FPSID ]); +case 1 : +return gdb_get_reg32 (buf,vfp_get_fpscr (env)); +case 2 : +return gdb_get_reg32 (buf, env->vfp.xregs[ARM_VFP_FPEXC ]); }return 0 ; }
@@ -98,9 +101,15 @@ static int vfp_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg) } }switch (reg - nregs) { -case 0 : env->vfp.xregs[ARM_VFP_FPSID ] =ldl_p (buf);return 4 ; -case 1 :vfp_set_fpscr (env,ldl_p (buf));return 4 ; -case 2 : env->vfp.xregs[ARM_VFP_FPEXC ] =ldl_p (buf) & (1 <<30 );return 4 ; +case 0 : + env->vfp.xregs[ARM_VFP_FPSID ] =ldl_p (buf); +return 4 ; +case 1 : +vfp_set_fpscr (env,ldl_p (buf)); +return 4 ; +case 2 : + env->vfp.xregs[ARM_VFP_FPEXC ] =ldl_p (buf) & (1 <<30 ); +return 4 ; }return 0 ; }
@@ -119,7 +128,7 @@ static int aarch64_fpu_gdb_get_reg(CPUARMState *env, GByteArray *buf, int reg)return gdb_get_reg32 (buf,vfp_get_fpsr (env));case 33 :/* FPCR */ -return gdb_get_reg32 (buf,vfp_get_fpcr (env)); +return gdb_get_reg32 (buf,vfp_get_fpcr (env));default :return 0 ; }
Signature · 1 line
2.20.1
Re: [PATCH 2/5] target/arm: Fix coding style issues in gdbstub code in helper.c
Quoted 9 lines · Peter Maydell
We're going to move this code to a different file; fix the coding style first so checkpatch doesn't complain. This includes deleting the spurious 'break' statements after returns in the
vfp_gdb_get_reg()function.Signed-off-by Peter Maydell <[email protected]>--- target/arm/helper.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
Re: [PATCH 2/5] target/arm: Fix coding style issues in gdbstub code in helper.c
In reply to Peter MaydellQuoted 9 lines · Peter Maydell
We're going to move this code to a different file; fix the coding style first so checkpatch doesn't complain. This includes deleting the spurious 'break' statements after returns in the
vfp_gdb_get_reg()function.Signed-off-by Peter Maydell<[email protected]>--- target/arm/helper.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
r~
PATCH 3/5 target/arm: Move gdbstub related code out of helper.c
In reply to Peter MaydellCurrently helper.c includes some code which is part of the arm target's gdbstub support. This code has a better home: in gdbstub.c and gdbstub64.c. Move it there.
Because aarch64_fpu_gdb_get_reg() and aarch64_fpu_gdb_set_reg() move into gdbstub64.c, this means that they're now compiled only for TARGET_AARCH64 rather than always. That is the only case when they would ever be used, but it does mean that the ifdef in arm_cpu_register_gdb_regs_for_features() needs to be adjusted to match.
--- target/arm/internals.h | 7 ++ target/arm/gdbstub.c | 130 ++++++++++++++++++++ target/arm/gdbstub64.c | 140 +++++++++++++++++++++ target/arm/helper.c | 271 ----------------------------------------- 4 files changed, 277 insertions(+), 271 deletions(-)
target/arm/internals.h +7 -0
@@ -1226,4 +1226,11 @@ enum MVEECIState { /* All other values reserved */ }; +#ifdef TARGET_AARCH64 +int arm_gdb_get_svereg (CPUARMState *env,GByteArray *buf,int reg); +int arm_gdb_set_svereg (CPUARMState *env,uint8_t *buf,int reg); +int aarch64_fpu_gdb_get_reg (CPUARMState *env,GByteArray *buf,int reg); +int aarch64_fpu_gdb_set_reg (CPUARMState *env,uint8_t *buf,int reg); +#endif +#endif
target/arm/gdbstub.c +130 -0
145 lines not on this page · raw message
target/arm/gdbstub64.c +140 -0
150 lines not on this page · raw message
target/arm/helper.c +0 -271
295 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [PATCH 3/5] target/arm: Move gdbstub related code out of helper.c
Quoted 11 lines · Peter Maydell
Currently
helper.cincludes some code which is part of the arm target's gdbstub support. This code has a better home: ingdbstub.candgdbstub64.c. Move it there.Because
aarch64_fpu_gdb_get_reg()andaarch64_fpu_gdb_set_reg()move intogdbstub64.c, this means that they're now compiled only forTARGET_AARCH64rather than always. That is the only case when they would ever be used, but it does mean that the ifdef inarm_cpu_register_gdb_regs_for_features()needs to be adjusted to match.
Quoted 7 lines
Signed-off-by Peter Maydell <[email protected]>--- target/arm/internals.h | 7 ++ target/arm/gdbstub.c | 130 ++++++++++++++++++++ target/arm/gdbstub64.c | 140 +++++++++++++++++++++ target/arm/helper.c | 271 ----------------------------------------- 4 files changed, 277 insertions(+), 271 deletions(-)
Re: [PATCH 3/5] target/arm: Move gdbstub related code out of helper.c
In reply to Peter MaydellQuoted 11 lines · Peter Maydell
Currently
helper.cincludes some code which is part of the arm target's gdbstub support. This code has a better home: ingdbstub.candgdbstub64.c. Move it there.Because
aarch64_fpu_gdb_get_reg()andaarch64_fpu_gdb_set_reg()move intogdbstub64.c, this means that they're now compiled only forTARGET_AARCH64rather than always. That is the only case when they would ever be used, but it does mean that the ifdef inarm_cpu_register_gdb_regs_for_features()needs to be adjusted to match.
Quoted 7 lines
Signed-off-by Peter Maydell<[email protected]>--- target/arm/internals.h | 7 ++ target/arm/gdbstub.c | 130 ++++++++++++++++++++ target/arm/gdbstub64.c | 140 +++++++++++++++++++++ target/arm/helper.c | 271 ----------------------------------------- 4 files changed, 277 insertions(+), 271 deletions(-)
r~
PATCH 4/5 target/arm: Don't put FPEXC and FPSID in org.gnu.gdb.arm.vfp XML
In reply to Peter MaydellCurrently we send VFP XML which includes D0..D15 or D0..D31, plus FPSID, FPSCR and FPEXC. The upstream GDB tolerates this, but its definition of this XML feature does not include FPSID or FPEXC. In particular, for M-profile cores there are no FPSID or FPEXC registers, so advertising those is wrong.
Move FPSID and FPEXC into their own bit of XML which we only send for A and R profile cores. This brings our definition of the XML org.gnu.gdb.arm.vfp feature into line with GDB's own (at least for non-Neon cores...) and means we don't claim to have FPSID and FPEXC on M-profile.
(It seems unlikely to me that any gdbstub users really care about being able to look at FPEXC and FPSID; but we've supplied them to gdb for a decade and it's not hard to keep doing so.)
--- configs/targets/aarch64-softmmu.mak | 2 +- configs/targets/arm-linux-user.mak | 2 +- configs/targets/arm-softmmu.mak | 2 +- configs/targets/armeb-linux-user.mak | 2 +- target/arm/gdbstub.c | 56 ++++++++++++++++++++-------- gdb-xml/arm-neon.xml | 2 - gdb-xml/arm-vfp-sysregs.xml | 17 +++++++++ gdb-xml/arm-vfp.xml | 2 - gdb-xml/arm-vfp3.xml | 2 - 9 files changed, 61 insertions(+), 26 deletions(-) create mode 100644 gdb-xml/arm-vfp-sysregs.xml
configs/targets/aarch64-softmmu.mak +1 -1
@@ -1,5 +1,5 @@ TARGET_ARCH=aarch64 TARGET_BASE_ARCH=arm TARGET_SUPPORTS_MTTCG=y -TARGET_XML_FILES= gdb-xml/aarch64-core.xml gdb-xml/aarch64-fpu.xml gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml +TARGET_XML_FILES= gdb-xml/aarch64-core.xml gdb-xml/aarch64-fpu.xml gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml TARGET_NEED_FDT=y
configs/targets/arm-linux-user.mak +1 -1
@@ -1,6 +1,6 @@ TARGET_ARCH=arm TARGET_SYSTBL_ABI=common,oabi TARGET_SYSTBL=syscall.tbl -TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml +TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml TARGET_HAS_BFLT=y CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y
configs/targets/arm-softmmu.mak +1 -1
@@ -1,4 +1,4 @@ TARGET_ARCH=arm TARGET_SUPPORTS_MTTCG=y -TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml +TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml TARGET_NEED_FDT=y
configs/targets/armeb-linux-user.mak +1 -1
@@ -2,6 +2,6 @@ TARGET_ARCH=arm TARGET_SYSTBL_ABI=common,oabi TARGET_SYSTBL=syscall.tbl TARGET_WORDS_BIGENDIAN=y -TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml +TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml TARGET_HAS_BFLT=y CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y
target/arm/gdbstub.c +40 -16
79 lines not on this page · raw message
gdb-xml/arm-neon.xml +0 -2
@@ -82,7 +82,5 @@ <reg name="q14" bitsize="128" type="neon_q"/> <reg name="q15" bitsize="128" type="neon_q"/> - <reg name="fpsid" bitsize="32" type="int" group="float"/> <reg name="fpscr" bitsize="32" type="int" group="float"/> - <reg name="fpexc" bitsize="32" type="int" group="float"/> </feature>
gdb-xml/arm-vfp-sysregs.xml new file +17 -0
@@ -0,0 +1,17 @@ +<?xml version="1.0"?> +<!-- Copyright (C) 2021 Linaro Ltd. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. + + These are A/R profile VFP system registers. Debugger users probably + don't really care about these, but because we used to (incorrectly) + provide them to gdb in the org.gnu.gdb.arm.vfp XML we continue + to do so via this separate XML. + --> +<!DOCTYPE feature SYSTEM "gdb-target.dtd"> +<feature name="org.qemu.gdb.arm.vfp-sysregs"> + <reg name="fpsid" bitsize="32" type="int" group="float"/> + <reg name="fpexc" bitsize="32" type="int" group="float"/> +</feature>
gdb-xml/arm-vfp.xml +0 -2
@@ -23,7 +23,5 @@ <reg name="d14" bitsize="64" type="float"/> <reg name="d15" bitsize="64" type="float"/> - <reg name="fpsid" bitsize="32" type="int" group="float"/> <reg name="fpscr" bitsize="32" type="int" group="float"/> - <reg name="fpexc" bitsize="32" type="int" group="float"/> </feature>
gdb-xml/arm-vfp3.xml +0 -2
@@ -39,7 +39,5 @@ <reg name="d30" bitsize="64" type="float"/> <reg name="d31" bitsize="64" type="float"/> - <reg name="fpsid" bitsize="32" type="int" group="float"/> <reg name="fpscr" bitsize="32" type="int" group="float"/> - <reg name="fpexc" bitsize="32" type="int" group="float"/> </feature>
Signature · 1 line
2.20.1
Re: [PATCH 4/5] target/arm: Don't put FPEXC and FPSID in org.gnu.gdb.arm.vfp XML
Quoted 12 lines · Peter Maydell
Currently we send VFP XML which includes D0..D15 or D0..D31, plus FPSID, FPSCR and FPEXC. The upstream GDB tolerates this, but its definition of this XML feature does not include FPSID or FPEXC. In particular, for M-profile cores there are no FPSID or FPEXC registers, so advertising those is wrong.
Move FPSID and FPEXC into their own bit of XML which we only send for A and R profile cores. This brings our definition of the XML org.gnu.gdb.arm.vfp feature into line with GDB's own (at least for non-Neon cores...) and means we don't claim to have FPSID and FPEXC on M-profile.
Quoted 6 lines
(It seems unlikely to me that any gdbstub users really care about being able to look at FPEXC and FPSID; but we've supplied them to gdb for a decade and it's not hard to keep doing so.)
Signed-off-by Peter Maydell<[email protected]>---
r~
RFC PATCH 5/5 target/arm: Advertise MVE to gdb when present
In reply to Peter MaydellCortex-M CPUs with MVE should advertise this fact to gdb, using the org.gnu.gdb.arm.m-profile-mve XML feature, which defines the VPR register. Presence of this feature also tells gdb to create pseudo-registers Q0..Q7, so we do not need to tell gdb about them separately.
Note that unless you have a very recent GDB that includes this fix:
http://patches-tcwg.linaro.org/patch/58133/ gdb will mis-print the individual fields of the VPR register as zero (but showing the whole thing as hex, eg with "print /x $vpr" will give the correct value).
NB: the gdb patches to implement this have not yet landed in gdb upstream, so this patch is RFC status only until that happens and the XML is finalized.
--- configs/targets/aarch64-softmmu.mak | 2 +- configs/targets/arm-linux-user.mak | 2 +- configs/targets/arm-softmmu.mak | 2 +- configs/targets/armeb-linux-user.mak | 2 +- target/arm/gdbstub.c | 25 +++++++++++++++++++++++++ gdb-xml/arm-m-profile-mve.xml | 19 +++++++++++++++++++ 6 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 gdb-xml/arm-m-profile-mve.xml
configs/targets/aarch64-softmmu.mak +1 -1
@@ -1,5 +1,5 @@ TARGET_ARCH=aarch64 TARGET_BASE_ARCH=arm TARGET_SUPPORTS_MTTCG=y -TARGET_XML_FILES= gdb-xml/aarch64-core.xml gdb-xml/aarch64-fpu.xml gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml +TARGET_XML_FILES= gdb-xml/aarch64-core.xml gdb-xml/aarch64-fpu.xml gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml gdb-xml/arm-m-profile-mve.xml TARGET_NEED_FDT=y
configs/targets/arm-linux-user.mak +1 -1
@@ -1,6 +1,6 @@ TARGET_ARCH=arm TARGET_SYSTBL_ABI=common,oabi TARGET_SYSTBL=syscall.tbl -TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml +TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml gdb-xml/arm-m-profile-mve.xml TARGET_HAS_BFLT=y CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y
configs/targets/arm-softmmu.mak +1 -1
@@ -1,4 +1,4 @@ TARGET_ARCH=arm TARGET_SUPPORTS_MTTCG=y -TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml +TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml gdb-xml/arm-m-profile-mve.xml TARGET_NEED_FDT=y
configs/targets/armeb-linux-user.mak +1 -1
@@ -2,6 +2,6 @@ TARGET_ARCH=arm TARGET_SYSTBL_ABI=common,oabi TARGET_SYSTBL=syscall.tbl TARGET_WORDS_BIGENDIAN=y -TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml +TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml gdb-xml/arm-m-profile-mve.xml TARGET_HAS_BFLT=y CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y
target/arm/gdbstub.c +25 -0
@@ -199,6 +199,27 @@ static int vfp_gdb_set_sysreg(CPUARMState *env, uint8_t *buf, int reg)return 0 ; } +static int mve_gdb_get_reg (CPUARMState *env,GByteArray *buf,int reg) +{ +switch (reg) { +case 0 : +return gdb_get_reg32 (buf, env->v7m.vpr); +default : +return 0 ; + } +} + +static int mve_gdb_set_reg (CPUARMState *env,uint8_t *buf,int reg) +{ +switch (reg) { +case 0 : + env->v7m.vpr =ldl_p (buf); +return 4 ; +default : +return 0 ; + } +} +/** * arm_get/set_gdb_*: get/set a gdb register * @env: the CPU state
@@ -468,6 +489,10 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu) 2, "arm-vfp-sysregs.xml", 0); } } +if (cpu_isar_feature (aa32_mve, cpu)) { +gdb_register_coprocessor (cs, mve_gdb_get_reg, mve_gdb_set_reg, +1 ,"arm-m-profile-mve.xml" ,0 ); + }gdb_register_coprocessor (cs, arm_gdb_get_sysreg, arm_gdb_set_sysreg,arm_gen_dynamic_sysreg_xml (cs, cs->gdb_num_regs),"system-registers.xml" ,0 );
gdb-xml/arm-m-profile-mve.xml new file +19 -0
@@ -0,0 +1,19 @@ +<?xml version="1.0"?> +<!-- Copyright (C) 2021 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> + +<!DOCTYPE feature SYSTEM "gdb-target.dtd"> +<feature name="org.gnu.gdb.arm.m-profile-mve"> + <flags id="vpr_reg" size="4"> + <!-- ARMv8.1-M and MVE: Unprivileged and privileged Access. --> + <field name="P0" start="0" end="15"/> + <!-- ARMv8.1-M: Privileged Access only. --> + <field name="MASK01" start="16" end="19"/> + <!-- ARMv8.1-M: Privileged Access only. --> + <field name="MASK23" start="20" end="23"/> + </flags> + <reg name="vpr" bitsize="32" type="vpr_reg"/> +</feature>
Signature · 1 line
2.20.1
Re: [PATCH 5/5] [RFC] target/arm: Advertise MVE to gdb when present
Quoted 24 lines · Peter Maydell
Cortex-M CPUs with MVE should advertise this fact to gdb, using the org.gnu.gdb.arm.m-profile-mve XML feature, which defines the VPR register. Presence of this feature also tells gdb to create pseudo-registers Q0..Q7, so we do not need to tell gdb about them separately.
Note that unless you have a very recent GDB that includes this fix:
http://patches-tcwg.linaro.org/patch/58133/ gdb will mis-print the individual fields of the VPR register as zero (but showing the whole thing as hex, eg with "print /x $vpr" will give the correct value).NB: the gdb patches to implement this have not yet landed in gdb upstream, so this patch is RFC status only until that happens and the XML is finalized.
Signed-off-by Peter Maydell<[email protected]>--- configs/targets/aarch64-softmmu.mak | 2 +- configs/targets/arm-linux-user.mak | 2 +- configs/targets/arm-softmmu.mak | 2 +- configs/targets/armeb-linux-user.mak | 2 +- target/arm/gdbstub.c | 25 +++++++++++++++++++++++++ gdb-xml/arm-m-profile-mve.xml | 19 +++++++++++++++++++ 6 files changed, 48 insertions(+), 4 deletions(-)
Quoted 1 line
create mode 100644
gdb-xml/arm-m-profile-mve.xml
Looks like it'll do what's advertised.
r~