From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Juan Quintela" <quintela@redhat.com>,
"Ilya Leoshkevich" <iii@linux.ibm.com>,
"Thomas Huth" <thuth@redhat.com>,
"Akihiko Odaki" <akihiko.odaki@daynix.com>,
qemu-ppc@nongnu.org, "David Gibson" <david@gibson.dropbear.id.au>,
qemu-s390x@nongnu.org,
"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
"Peter Xu" <peterx@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Cédric Le Goater" <clg@kaod.org>,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"David Hildenbrand" <david@redhat.com>,
"Yonggang Luo" <luoyonggang@gmail.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Beraldo Leal" <bleal@redhat.com>,
qemu-arm@nongnu.org, "Greg Kurz" <groug@kaod.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Subject: [PATCH 04/10] target/arm: convert 64 bit gdbstub to new helper
Date: Wed, 19 Mar 2025 18:22:49 +0000 [thread overview]
Message-ID: <20250319182255.3096731-5-alex.bennee@linaro.org> (raw)
In-Reply-To: <20250319182255.3096731-1-alex.bennee@linaro.org>
For some of the helpers we need a temporary variable to copy from
although we could add some helpers to return pointers into env in
those cases if we wanted to.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
target/arm/gdbstub64.c | 53 ++++++++++++++++++++++++++----------------
1 file changed, 33 insertions(+), 20 deletions(-)
diff --git a/target/arm/gdbstub64.c b/target/arm/gdbstub64.c
index 1a4dbec567..793332af31 100644
--- a/target/arm/gdbstub64.c
+++ b/target/arm/gdbstub64.c
@@ -20,7 +20,7 @@
#include "qemu/log.h"
#include "cpu.h"
#include "internals.h"
-#include "gdbstub/helpers.h"
+#include "gdbstub/registers.h"
#include "gdbstub/commands.h"
#include "tcg/mte_helper.h"
#if defined(CONFIG_USER_ONLY) && defined(CONFIG_LINUX)
@@ -35,15 +35,16 @@ int aarch64_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
if (n < 31) {
/* Core integer register. */
- return gdb_get_reg64(mem_buf, env->xregs[n]);
+ return gdb_get_register_value(MO_TEUO, mem_buf, (uint8_t *) &env->xregs[n]);
}
switch (n) {
case 31:
- return gdb_get_reg64(mem_buf, env->xregs[31]);
+ return gdb_get_register_value(MO_TEUO, mem_buf, (uint8_t *) &env->xregs[31]);
case 32:
- return gdb_get_reg64(mem_buf, env->pc);
+ return gdb_get_register_value(MO_TEUO, mem_buf, (uint8_t *) &env->pc);
case 33:
- return gdb_get_reg32(mem_buf, pstate_read(env));
+ uint32_t pstate = pstate_read(env);
+ return gdb_get_register_value(MO_TEUL, mem_buf, (uint8_t *) &pstate);
}
/* Unknown register. */
return 0;
@@ -82,23 +83,27 @@ int aarch64_gdb_get_fpu_reg(CPUState *cs, GByteArray *buf, int reg)
{
ARMCPU *cpu = ARM_CPU(cs);
CPUARMState *env = &cpu->env;
+ uint32_t fpr;
switch (reg) {
case 0 ... 31:
{
/* 128 bit FP register - quads are in LE order */
uint64_t *q = aa64_vfp_qreg(env, reg);
- return gdb_get_reg128(buf, q[1], q[0]);
+ return gdb_get_register_value(MO_TEUO, buf, (uint8_t *) q);
}
case 32:
/* FPSR */
- return gdb_get_reg32(buf, vfp_get_fpsr(env));
+ fpr = vfp_get_fpsr(env);
+ break;
case 33:
/* FPCR */
- return gdb_get_reg32(buf, vfp_get_fpcr(env));
+ fpr = vfp_get_fpcr(env);
+ break;
default:
return 0;
}
+ return gdb_get_register_value(MO_TEUL, buf, (uint8_t *) &fpr);
}
int aarch64_gdb_set_fpu_reg(CPUState *cs, uint8_t *buf, int reg)
@@ -132,30 +137,37 @@ int aarch64_gdb_get_sve_reg(CPUState *cs, GByteArray *buf, int reg)
{
ARMCPU *cpu = ARM_CPU(cs);
CPUARMState *env = &cpu->env;
+ uint32_t fpr;
switch (reg) {
/* The first 32 registers are the zregs */
case 0 ... 31:
{
int vq, len = 0;
+ ARMVectorReg *zreg = &env->vfp.zregs[reg];
+
for (vq = 0; vq < cpu->sve_max_vq; vq++) {
- len += gdb_get_reg128(buf,
- env->vfp.zregs[reg].d[vq * 2 + 1],
- env->vfp.zregs[reg].d[vq * 2]);
+ len += gdb_get_register_value(MO_TEUQ, buf,
+ (uint8_t *) &zreg->d[vq * 2 + 1]);
+ len += gdb_get_register_value(MO_TEUQ, buf,
+ (uint8_t *) &zreg->d[vq * 2]);
}
return len;
}
case 32:
- return gdb_get_reg32(buf, vfp_get_fpsr(env));
+ fpr = vfp_get_fpsr(env);
+ return gdb_get_register_value(MO_TEUL, buf, (uint8_t *) &fpr);
case 33:
- return gdb_get_reg32(buf, vfp_get_fpcr(env));
+ fpr = vfp_get_fpcr(env);
+ return gdb_get_register_value(MO_TEUL, buf, (uint8_t *) &fpr);
/* then 16 predicates and the ffr */
case 34 ... 50:
{
int preg = reg - 34;
int vq, len = 0;
for (vq = 0; vq < cpu->sve_max_vq; vq = vq + 4) {
- len += gdb_get_reg64(buf, env->vfp.pregs[preg].p[vq / 4]);
+ len += gdb_get_register_value(MO_TEUQ, buf,
+ (uint8_t *) &env->vfp.pregs[preg].p[vq / 4]);
}
return len;
}
@@ -165,8 +177,8 @@ int aarch64_gdb_get_sve_reg(CPUState *cs, GByteArray *buf, int reg)
* We report in Vector Granules (VG) which is 64bit in a Z reg
* while the ZCR works in Vector Quads (VQ) which is 128bit chunks.
*/
- int vq = sve_vqm1_for_el(env, arm_current_el(env)) + 1;
- return gdb_get_reg64(buf, vq * 2);
+ uint64_t vq = (sve_vqm1_for_el(env, arm_current_el(env)) + 1) * 2;
+ return gdb_get_register_value(MO_TEUL, buf, (uint8_t *) &vq);
}
default:
/* gdbstub asked for something out our range */
@@ -248,10 +260,11 @@ int aarch64_gdb_get_pauth_reg(CPUState *cs, GByteArray *buf, int reg)
bool is_data = !(reg & 1);
bool is_high = reg & 2;
ARMMMUIdx mmu_idx = arm_stage1_mmu_idx(env);
- ARMVAParameters param;
+ ARMVAParameters param = aa64_va_parameters(env, -is_high, mmu_idx,
+ is_data, false);
+ uint64_t pauth_mask = pauth_ptr_mask(param);
- param = aa64_va_parameters(env, -is_high, mmu_idx, is_data, false);
- return gdb_get_reg64(buf, pauth_ptr_mask(param));
+ return gdb_get_register_value(MO_TEUQ, buf, (uint8_t *) &pauth_mask);
}
default:
return 0;
@@ -399,7 +412,7 @@ int aarch64_gdb_get_tag_ctl_reg(CPUState *cs, GByteArray *buf, int reg)
tcf0 = extract64(env->cp15.sctlr_el[1], 38, 2);
- return gdb_get_reg64(buf, tcf0);
+ return gdb_get_register_value(MO_TEUQ, buf, (uint8_t *) &tcf0);
}
int aarch64_gdb_set_tag_ctl_reg(CPUState *cs, uint8_t *buf, int reg)
--
2.39.5
next prev parent reply other threads:[~2025-03-19 18:24 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-19 18:22 [PATCH 00/10] gdbstub: conversion to runtime endianess helpers Alex Bennée
2025-03-19 18:22 ` [PATCH 01/10] include/gdbstub: fix include guard in commands.h Alex Bennée
2025-03-20 7:09 ` Philippe Mathieu-Daudé
2025-03-20 19:37 ` Pierrick Bouvier
2025-03-19 18:22 ` [PATCH 02/10] gdbstub: introduce target independent gdb register helper Alex Bennée
2025-03-20 6:19 ` Akihiko Odaki
2025-03-20 7:24 ` Philippe Mathieu-Daudé
2025-03-20 7:16 ` Philippe Mathieu-Daudé
2025-03-20 19:30 ` Pierrick Bouvier
2025-03-20 19:36 ` Pierrick Bouvier
2025-03-21 11:36 ` Alex Bennée
2025-03-21 17:24 ` Pierrick Bouvier
2025-03-20 19:37 ` Pierrick Bouvier
2025-03-19 18:22 ` [PATCH 03/10] target/arm: convert 32 bit gdbstub to new helper Alex Bennée
2025-03-20 6:21 ` Akihiko Odaki
2025-03-20 19:38 ` Pierrick Bouvier
2025-03-19 18:22 ` Alex Bennée [this message]
2025-03-20 7:39 ` [PATCH 04/10] target/arm: convert 64 " Philippe Mathieu-Daudé
2025-03-20 19:42 ` Pierrick Bouvier
2025-03-21 11:38 ` Alex Bennée
2025-03-19 18:22 ` [PATCH 05/10] target/ppc: expand comment on FP/VMX/VSX access functions Alex Bennée
2025-03-20 19:42 ` Pierrick Bouvier
2025-03-19 18:22 ` [PATCH 06/10] target/ppc: make ppc_maybe_bswap_register static Alex Bennée
2025-03-20 6:55 ` Philippe Mathieu-Daudé
2025-03-20 19:42 ` Pierrick Bouvier
2025-03-19 18:22 ` [PATCH 07/10] target/ppc: convert gdbstub to new helper (!hacky) Alex Bennée
2025-03-19 18:22 ` [PATCH 08/10] gdbstub: assert earlier in handle_read_all_regs Alex Bennée
2025-03-20 6:57 ` Philippe Mathieu-Daudé
2025-03-19 18:22 ` [PATCH 09/10] include/exec: fix assert in size_memop Alex Bennée
2025-03-20 6:29 ` Akihiko Odaki
2025-03-20 7:30 ` Philippe Mathieu-Daudé
2025-03-19 18:22 ` [PATCH 10/10] target/microblaze: convert gdbstub to new helper Alex Bennée
2025-03-20 7:09 ` Philippe Mathieu-Daudé
2025-03-20 19:52 ` [PATCH 00/10] gdbstub: conversion to runtime endianess helpers Pierrick Bouvier
2025-03-20 20:16 ` Pierrick Bouvier
2025-03-21 13:02 ` Philippe Mathieu-Daudé
2025-03-21 17:27 ` Pierrick Bouvier
2025-03-21 11:46 ` Alex Bennée
2025-03-21 17:31 ` Pierrick Bouvier
2025-03-23 15:41 ` Philippe Mathieu-Daudé
2025-03-23 17:32 ` Pierrick Bouvier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250319182255.3096731-5-alex.bennee@linaro.org \
--to=alex.bennee@linaro.org \
--cc=akihiko.odaki@daynix.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=bleal@redhat.com \
--cc=clg@kaod.org \
--cc=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=david@redhat.com \
--cc=edgar.iglesias@gmail.com \
--cc=groug@kaod.org \
--cc=iii@linux.ibm.com \
--cc=luoyonggang@gmail.com \
--cc=npiggin@gmail.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=quintela@redhat.com \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
--cc=wainersm@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).