From: "Alex Bennée" <alex.bennee@linaro.org>
To: Gustavo Romero <gustavo.romero@linaro.org>
Cc: qemu-devel@nongnu.org, richard.henderson@linaro.org,
peter.maydell@linaro.org, laurent@vivier.eu, philmd@linaro.org
Subject: Re: [PATCH v2 2/5] linux-user: Move tswap_siginfo out of target code
Date: Thu, 07 Mar 2024 19:21:07 +0000 [thread overview]
Message-ID: <874jdhvof0.fsf@draig.linaro.org> (raw)
In-Reply-To: <20240307182623.1450717-2-gustavo.romero@linaro.org> (Gustavo Romero's message of "Thu, 7 Mar 2024 18:26:20 +0000")
Gustavo Romero <gustavo.romero@linaro.org> writes:
> Move tswap_siginfo from target code to handle_pending_signal. This will
> allow some cleanups and having the siginfo ready to be used in gdbstub.
>
> Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> linux-user/aarch64/signal.c | 2 +-
> linux-user/alpha/signal.c | 2 +-
> linux-user/arm/signal.c | 2 +-
> linux-user/hexagon/signal.c | 2 +-
> linux-user/hppa/signal.c | 2 +-
> linux-user/i386/signal.c | 6 +++---
> linux-user/loongarch64/signal.c | 2 +-
> linux-user/m68k/signal.c | 4 ++--
> linux-user/microblaze/signal.c | 2 +-
> linux-user/mips/signal.c | 4 ++--
> linux-user/nios2/signal.c | 2 +-
> linux-user/openrisc/signal.c | 2 +-
> linux-user/ppc/signal.c | 4 ++--
> linux-user/riscv/signal.c | 2 +-
> linux-user/s390x/signal.c | 2 +-
> linux-user/sh4/signal.c | 2 +-
> linux-user/signal-common.h | 2 --
> linux-user/signal.c | 10 ++++++++--
> linux-user/sparc/signal.c | 2 +-
> linux-user/xtensa/signal.c | 2 +-
> 20 files changed, 31 insertions(+), 27 deletions(-)
>
> diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c
<snip>
> --- a/linux-user/signal.c
> +++ b/linux-user/signal.c
> @@ -409,8 +409,8 @@ static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo,
> tinfo->si_code = deposit32(si_code, 16, 16, si_type);
> }
>
> -void tswap_siginfo(target_siginfo_t *tinfo,
> - const target_siginfo_t *info)
> +static void tswap_siginfo(target_siginfo_t *tinfo,
> + const target_siginfo_t *info)
> {
> int si_type = extract32(info->si_code, 16, 16);
> int si_code = sextract32(info->si_code, 0, 16);
> @@ -1180,6 +1180,12 @@ static void handle_pending_signal(CPUArchState *cpu_env, int sig,
> /* dequeue signal */
> k->pending = 0;
>
> + /*
> + * Writes out siginfo values byteswapped, accordingly to the target. It also
> + * cleans the si_type from si_code making it correct for the target.
> + */
> + tswap_siginfo(&k->info, &k->info);
> +
I'm not sure I like this, you have the same pointer to both a const and
non-const arg. Do we assert we come through this once per signal and
don't risk double swapping the contents?
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2024-03-07 19:21 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-07 18:26 [PATCH v2 1/5] gdbstub: Rename back gdb_handlesig Gustavo Romero
2024-03-07 18:26 ` [PATCH v2 2/5] linux-user: Move tswap_siginfo out of target code Gustavo Romero
2024-03-07 19:21 ` Alex Bennée [this message]
2024-03-07 20:47 ` Richard Henderson
2024-03-07 20:44 ` Richard Henderson
2024-03-07 18:26 ` [PATCH v2 3/5] gdbstub: Save target's siginfo Gustavo Romero
2024-03-07 21:09 ` Richard Henderson
2024-03-07 22:33 ` Alex Bennée
2024-03-08 17:01 ` Gustavo Romero
2024-03-08 19:25 ` Alex Bennée
2024-03-09 0:41 ` Richard Henderson
2024-03-09 11:43 ` Alex Bennée
2024-03-08 20:24 ` Gustavo Romero
2024-03-07 18:26 ` [PATCH v2 4/5] gdbstub: Add Xfer:siginfo:read stub Gustavo Romero
2024-03-07 21:13 ` Richard Henderson
2024-03-08 18:30 ` Gustavo Romero
2024-03-09 0:58 ` Richard Henderson
2024-03-07 18:26 ` [PATCH v2 5/5] tests/tcg: Add multiarch test for " Gustavo Romero
2024-03-07 21:16 ` Richard Henderson
2024-03-07 19:14 ` [PATCH v2 1/5] gdbstub: Rename back gdb_handlesig Alex Bennée
2024-03-07 20:43 ` Richard Henderson
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=874jdhvof0.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=gustavo.romero@linaro.org \
--cc=laurent@vivier.eu \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/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).