From: Thomas Huth <thuth@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: Magnus Damm <magnus.damm@gmail.com>,
Yoshinori Sato <ysato@users.sourceforge.jp>,
Anton Johansson <anjo@rev.ng>
Subject: Re: [PATCH] hw/sh4/r2d: Replace tswap32() by stl_endian_p()
Date: Tue, 1 Oct 2024 07:17:41 +0200 [thread overview]
Message-ID: <f2efd88e-9300-4dba-9076-8d84c0c21192@redhat.com> (raw)
In-Reply-To: <20240930220732.58757-1-philmd@linaro.org>
On 01/10/2024 00.07, Philippe Mathieu-Daudé wrote:
> Replace the target-specific tswap32() calls by stl_endian_p()
> which does the same but takes the endianness as argument, thus
> is target-agnostic.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> Based-on: <20240930073450.33195-2-philmd@linaro.org>
> "qemu/bswap: Introduce ld/st_endian_p() API"
> ---
> hw/sh4/r2d.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c
> index e5ac6751bd..6739ac435a 100644
> --- a/hw/sh4/r2d.c
> +++ b/hw/sh4/r2d.c
> @@ -353,9 +353,11 @@ static void r2d_init(MachineState *machine)
> }
>
> /* initialization which should be done by firmware */
> - boot_params.loader_type = tswap32(1);
> - boot_params.initrd_start = tswap32(INITRD_LOAD_OFFSET);
> - boot_params.initrd_size = tswap32(initrd_size);
> + stl_endian_p(TARGET_BIG_ENDIAN, &boot_params.loader_type, 1);
> + stl_endian_p(TARGET_BIG_ENDIAN, &boot_params.initrd_start,
> + INITRD_LOAD_OFFSET);
> + stl_endian_p(TARGET_BIG_ENDIAN, &boot_params.initrd_size,
> + initrd_size);
> }
I still don't quite get it - the tswap functions already use
target_words_bigendian() when being used in common code, so what do you
really gain by these changes?
Thomas
prev parent reply other threads:[~2024-10-01 14:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-30 22:07 [PATCH] hw/sh4/r2d: Replace tswap32() by stl_endian_p() Philippe Mathieu-Daudé
2024-10-01 5:17 ` Thomas Huth [this message]
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=f2efd88e-9300-4dba-9076-8d84c0c21192@redhat.com \
--to=thuth@redhat.com \
--cc=anjo@rev.ng \
--cc=magnus.damm@gmail.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=ysato@users.sourceforge.jp \
/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).