From: Paolo Bonzini <pbonzini@redhat.com>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH v2 19/28] linux-user/i386: Fix -mregparm=3 for signal delivery
Date: Tue, 9 Apr 2024 09:31:09 +0200 [thread overview]
Message-ID: <0a86e001-30a7-433d-9bac-053c182ee949@redhat.com> (raw)
In-Reply-To: <20240409050302.1523277-20-richard.henderson@linaro.org>
On 4/9/24 07:02, Richard Henderson wrote:
> Since v2.6.19, the kernel has supported -mregparm=3.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> linux-user/i386/signal.c | 20 +++++++++-----------
> 1 file changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c
> index 559b63c25b..f8cc0cff07 100644
> --- a/linux-user/i386/signal.c
> +++ b/linux-user/i386/signal.c
> @@ -427,6 +427,11 @@ void setup_frame(int sig, struct target_sigaction *ka,
> env->regs[R_ESP] = frame_addr;
> env->eip = ka->_sa_handler;
>
> + /* Make -mregparm=3 work */
> + env->regs[R_EAX] = sig;
> + env->regs[R_EDX] = 0;
> + env->regs[R_ECX] = 0;
Perhaps also move here the
__put_user(sig, &frame->sig);
from above, for consistency with setup_rt_frame?
Paolo
> cpu_x86_load_seg(env, R_DS, __USER_DS);
> cpu_x86_load_seg(env, R_ES, __USER_DS);
> cpu_x86_load_seg(env, R_SS, __USER_DS);
> @@ -448,9 +453,6 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
> target_sigset_t *set, CPUX86State *env)
> {
> abi_ulong frame_addr;
> -#ifndef TARGET_X86_64
> - abi_ulong addr;
> -#endif
> struct rt_sigframe *frame;
> int i;
>
> @@ -460,14 +462,6 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
> if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0))
> goto give_sigsegv;
>
> - /* These fields are only in rt_sigframe on 32 bit */
> -#ifndef TARGET_X86_64
> - __put_user(sig, &frame->sig);
> - addr = frame_addr + offsetof(struct rt_sigframe, info);
> - __put_user(addr, &frame->pinfo);
> - addr = frame_addr + offsetof(struct rt_sigframe, uc);
> - __put_user(addr, &frame->puc);
> -#endif
> if (ka->sa_flags & TARGET_SA_SIGINFO) {
> frame->info = *info;
> }
> @@ -507,9 +501,13 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
> env->eip = ka->_sa_handler;
>
> #ifndef TARGET_X86_64
> + /* Store arguments for both -mregparm=3 and standard. */
> env->regs[R_EAX] = sig;
> + __put_user(sig, &frame->sig);
> env->regs[R_EDX] = frame_addr + offsetof(struct rt_sigframe, info);
> + __put_user(env->regs[R_EDX], &frame->pinfo);
> env->regs[R_ECX] = frame_addr + offsetof(struct rt_sigframe, uc);
> + __put_user(env->regs[R_ECX], &frame->puc);
> #else
> env->regs[R_EAX] = 0;
> env->regs[R_EDI] = sig;
next prev parent reply other threads:[~2024-04-09 7:32 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-09 5:02 [PATCH for-9.1 v2 00/28] linux-user/i386: Properly align signal frame Richard Henderson
2024-04-09 5:02 ` [PATCH v2 01/28] target/i386: Add tcg/access.[ch] Richard Henderson
2024-04-09 7:09 ` Paolo Bonzini
2024-04-09 5:02 ` [PATCH v2 02/28] target/i386: Convert do_fldt, do_fstt to X86Access Richard Henderson
2024-04-09 7:52 ` Paolo Bonzini
2024-04-09 5:02 ` [PATCH v2 03/28] target/i386: Convert helper_{fbld, fbst}_ST0 " Richard Henderson
2024-04-09 5:02 ` [PATCH v2 04/28] target/i386: Convert do_fldenv " Richard Henderson
2024-04-09 5:02 ` [PATCH v2 05/28] target/i386: Convert do_fstenv " Richard Henderson
2024-04-09 5:02 ` [PATCH v2 06/28] target/i386: Convert do_fsave, do_frstor " Richard Henderson
2024-04-09 5:02 ` [PATCH v2 07/28] target/i386: Convert do_xsave_{fpu, mxcr, sse} " Richard Henderson
2024-04-09 5:02 ` [PATCH v2 08/28] target/i386: Convert do_xrstor_{fpu, " Richard Henderson
2024-04-09 5:02 ` [PATCH v2 09/28] tagret/i386: Convert do_fxsave, do_fxrstor " Richard Henderson
2024-04-09 5:02 ` [PATCH v2 10/28] target/i386: Convert do_xsave_* " Richard Henderson
2024-04-09 5:02 ` [PATCH v2 11/28] target/i386: Convert do_xrstor_* " Richard Henderson
2024-04-09 5:02 ` [PATCH v2 12/28] target/i386: Split out do_xsave_chk Richard Henderson
2024-04-09 5:02 ` [PATCH v2 13/28] target/i386: Add rbfm argument to cpu_x86_{xsave, xrstor} Richard Henderson
2024-04-09 5:02 ` [PATCH v2 14/28] target/i386: Add {hw, sw}_reserved to X86LegacyXSaveArea Richard Henderson
2024-04-09 5:02 ` [PATCH v2 15/28] linux-user/i386: Drop xfeatures_size from sigcontext arithmetic Richard Henderson
2024-04-09 5:02 ` [PATCH v2 16/28] linux-user/i386: Remove xfeatures from target_fpstate_fxsave Richard Henderson
2024-04-09 5:02 ` [PATCH v2 17/28] linux-user/i386: Replace target_fpstate_fxsave with X86LegacyXSaveArea Richard Henderson
2024-04-09 5:02 ` [PATCH v2 18/28] linux-user/i386: Split out struct target_fregs_state Richard Henderson
2024-04-09 5:02 ` [PATCH v2 19/28] linux-user/i386: Fix -mregparm=3 for signal delivery Richard Henderson
2024-04-09 7:31 ` Paolo Bonzini [this message]
2024-04-09 5:02 ` [PATCH v2 20/28] linux-user/i386: Return boolean success from restore_sigcontext Richard Henderson
2024-04-09 5:02 ` [PATCH v2 21/28] linux-user/i386: Return boolean success from xrstor_sigcontext Richard Henderson
2024-04-09 5:02 ` [PATCH v2 22/28] linux-user/i386: Fix allocation and alignment of fp state Richard Henderson
2024-04-09 5:02 ` [PATCH v2 23/28] target/i386: Honor xfeatures in xrstor_sigcontext Richard Henderson
2024-04-09 7:44 ` Paolo Bonzini
2024-04-09 18:09 ` Richard Henderson
2024-04-10 0:27 ` Richard Henderson
2024-04-09 5:02 ` [PATCH v2 24/28] target/i386: Convert do_xsave to X86Access Richard Henderson
2024-04-09 5:02 ` [PATCH v2 25/28] target/i386: Convert do_xrstor " Richard Henderson
2024-04-09 5:03 ` [PATCH v2 26/28] target/i386: Pass host pointer and size to cpu_x86_{fsave, frstor} Richard Henderson
2024-04-09 5:03 ` [PATCH v2 27/28] target/i386: Pass host pointer and size to cpu_x86_{fxsave, fxrstor} Richard Henderson
2024-04-09 5:03 ` [PATCH v2 28/28] target/i386: Pass host pointer and size to cpu_x86_{xsave, xrstor} Richard Henderson
2024-04-09 7:52 ` [PATCH for-9.1 v2 00/28] linux-user/i386: Properly align signal frame Paolo Bonzini
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=0a86e001-30a7-433d-9bac-053c182ee949@redhat.com \
--to=pbonzini@redhat.com \
--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).