qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: "Alex Bennée" <alex.bennee@linaro.org>, 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>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Beraldo Leal" <bleal@redhat.com>,
	qemu-arm@nongnu.org, "Greg Kurz" <groug@kaod.org>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Subject: Re: [PATCH 10/10] target/microblaze: convert gdbstub to new helper
Date: Thu, 20 Mar 2025 08:09:12 +0100	[thread overview]
Message-ID: <82e16c74-e60c-45b9-b269-a8d35d0b64d8@linaro.org> (raw)
In-Reply-To: <20250319182255.3096731-11-alex.bennee@linaro.org>

On 19/3/25 19:22, Alex Bennée wrote:
> This is a pretty simple conversion which will be trivial to update
> once TARGET_BIGENDIAN is replaced with a helper function.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>   target/microblaze/gdbstub.c | 44 ++++++++++++++-----------------------
>   1 file changed, 17 insertions(+), 27 deletions(-)
> 
> diff --git a/target/microblaze/gdbstub.c b/target/microblaze/gdbstub.c
> index d493681d38..106d6efbab 100644
> --- a/target/microblaze/gdbstub.c
> +++ b/target/microblaze/gdbstub.c
> @@ -19,7 +19,7 @@
>    */
>   #include "qemu/osdep.h"
>   #include "cpu.h"
> -#include "gdbstub/helpers.h"
> +#include "gdbstub/registers.h"
>   
>   /*
>    * GDB expects SREGs in the following order:
> @@ -50,62 +50,52 @@ int mb_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
>   {
>       MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs);
>       CPUMBState *env = &cpu->env;
> -    uint32_t val;
> +    MemOp mo = TARGET_BIG_ENDIAN ? MO_BEUL : MO_LEUL;

Since commit 415aae543ed TARGET_BIG_ENDIAN isn't doing what you'd
expect on microblaze, I think you want:

        MemOp mo = mb_cpu_is_big_endian(cs) ? MO_BEUL : MO_LEUL;

>   
>       switch (n) {
>       case 1 ... 31:
> -        val = env->regs[n];
> -        break;
> +        return gdb_get_register_value(mo, mem_buf, (uint8_t *) &env->regs[n]);
>       case GDB_PC:
> -        val = env->pc;
> -        break;
> +        return gdb_get_register_value(mo, mem_buf, (uint8_t *) &env->pc);
>       case GDB_MSR:
> -        val = mb_cpu_read_msr(env);
> -        break;
> +        uint32_t msr = mb_cpu_read_msr(env);
> +        return gdb_get_register_value(mo, mem_buf, (uint8_t *) &msr);
>       case GDB_EAR:
> -        val = env->ear;
> -        break;
> +        return gdb_get_register_value(mo, mem_buf, (uint8_t *) &env->ear);
>       case GDB_ESR:
> -        val = env->esr;
> -        break;
> +        return gdb_get_register_value(mo, mem_buf, (uint8_t *) &env->esr);
>       case GDB_FSR:
> -        val = env->fsr;
> -        break;
> +        return gdb_get_register_value(mo, mem_buf, (uint8_t *) &env->fsr);
>       case GDB_BTR:
> -        val = env->btr;
> -        break;
> +        return gdb_get_register_value(mo, mem_buf, (uint8_t *) &env->btr);
>       case GDB_PVR0 ... GDB_PVR11:
>           /* PVR12 is intentionally skipped */
> -        val = cpu->cfg.pvr_regs[n - GDB_PVR0];
> -        break;
> +        return gdb_get_register_value(mo, mem_buf,
> +                                      (uint8_t *) &cpu->cfg.pvr_regs[n - GDB_PVR0]);
>       case GDB_EDR:
> -        val = env->edr;
> -        break;
> +        return gdb_get_register_value(mo, mem_buf, (uint8_t *) &env->edr);
>       default:
>           /* Other SRegs aren't modeled, so report a value of 0 */
> -        val = 0;
> -        break;
> +        return 0;
>       }
> -    return gdb_get_reg32(mem_buf, val);
>   }


  reply	other threads:[~2025-03-20  7:09 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 ` [PATCH 04/10] target/arm: convert 64 " Alex Bennée
2025-03-20  7:39   ` 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é [this message]
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=82e16c74-e60c-45b9-b269-a8d35d0b64d8@linaro.org \
    --to=philmd@linaro.org \
    --cc=akihiko.odaki@daynix.com \
    --cc=alex.bennee@linaro.org \
    --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=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).