From: Riku Voipio <riku.voipio@iki.fi>
To: Laurent Vivier <laurent@vivier.eu>
Cc: qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v4 1/1] target/m68k, linux-user: manage FP registers in ucontext
Date: Mon, 16 Oct 2017 12:27:38 +0000 [thread overview]
Message-ID: <20171016122738.GA1918@kos.to> (raw)
In-Reply-To: <20170914163505.20558-2-laurent@vivier.eu>
On Thu, Sep 14, 2017 at 06:35:05PM +0200, Laurent Vivier wrote:
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> Reviewed-by: Richard Henderson <rth@twiddle.net>
Applied to linux-user que, thnanks
> ---
> linux-user/signal.c | 43 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 43 insertions(+)
>
> diff --git a/linux-user/signal.c b/linux-user/signal.c
> index cc0c3fcee9..7a238aaea1 100644
> --- a/linux-user/signal.c
> +++ b/linux-user/signal.c
> @@ -5704,6 +5704,24 @@ give_sigsegv:
> force_sigsegv(sig);
> }
>
> +static inline void target_rt_save_fpu_state(struct target_ucontext *uc,
> + CPUM68KState *env)
> +{
> + int i;
> + target_fpregset_t *fpregs = &uc->tuc_mcontext.fpregs;
> +
> + __put_user(env->fpcr, &fpregs->f_fpcntl[0]);
> + __put_user(env->fpsr, &fpregs->f_fpcntl[1]);
> + /* fpiar is not emulated */
> +
> + for (i = 0; i < 8; i++) {
> + uint32_t high = env->fregs[i].d.high << 16;
> + __put_user(high, &fpregs->f_fpregs[i * 3]);
> + __put_user(env->fregs[i].d.low,
> + (uint64_t *)&fpregs->f_fpregs[i * 3 + 1]);
> + }
> +}
> +
> static inline int target_rt_setup_ucontext(struct target_ucontext *uc,
> CPUM68KState *env)
> {
> @@ -5730,9 +5748,32 @@ static inline int target_rt_setup_ucontext(struct target_ucontext *uc,
> __put_user(env->pc, &gregs[16]);
> __put_user(sr, &gregs[17]);
>
> + target_rt_save_fpu_state(uc, env);
> +
> return 0;
> }
>
> +static inline void target_rt_restore_fpu_state(CPUM68KState *env,
> + struct target_ucontext *uc)
> +{
> + int i;
> + target_fpregset_t *fpregs = &uc->tuc_mcontext.fpregs;
> + uint32_t fpcr;
> +
> + __get_user(fpcr, &fpregs->f_fpcntl[0]);
> + cpu_m68k_set_fpcr(env, fpcr);
> + __get_user(env->fpsr, &fpregs->f_fpcntl[1]);
> + /* fpiar is not emulated */
> +
> + for (i = 0; i < 8; i++) {
> + uint32_t high;
> + __get_user(high, &fpregs->f_fpregs[i * 3]);
> + env->fregs[i].d.high = high >> 16;
> + __get_user(env->fregs[i].d.low,
> + (uint64_t *)&fpregs->f_fpregs[i * 3 + 1]);
> + }
> +}
> +
> static inline int target_rt_restore_ucontext(CPUM68KState *env,
> struct target_ucontext *uc)
> {
> @@ -5764,6 +5805,8 @@ static inline int target_rt_restore_ucontext(CPUM68KState *env,
> __get_user(temp, &gregs[17]);
> cpu_m68k_set_ccr(env, temp);
>
> + target_rt_restore_fpu_state(env, uc);
> +
> return 0;
>
> badframe:
> --
> 2.13.5
>
prev parent reply other threads:[~2017-10-16 12:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-14 16:35 [Qemu-devel] [PATCH v4 0/1] target/m68k, linux-user: manage FP registers in ucontext Laurent Vivier
2017-09-14 16:35 ` [Qemu-devel] [PATCH v4 1/1] " Laurent Vivier
2017-10-16 12:27 ` Riku Voipio [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=20171016122738.GA1918@kos.to \
--to=riku.voipio@iki.fi \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).