From: Laurent Vivier <laurent@vivier.eu>
To: Riku Voipio <riku.voipio@iki.fi>
Cc: qemu-devel@nongnu.org, "Thomas Huth" <huth@tuxfamily.org>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Richard Henderson" <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v5 6/6] target-m68k, linux-user: manage FP registers in ucontext
Date: Wed, 28 Jun 2017 22:44:57 +0200 [thread overview]
Message-ID: <e94af6f2-8869-b9e7-b2b8-b3f16713b345@vivier.eu> (raw)
In-Reply-To: <20170620205121.26515-7-laurent@vivier.eu>
Riku,
could you ACK this patch, so I will add it in my next pull request for m68k?
Thanks,
Laurent
Le 20/06/2017 à 22:51, Laurent Vivier a écrit :
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
> linux-user/signal.c | 41 +++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 41 insertions(+)
>
> diff --git a/linux-user/signal.c b/linux-user/signal.c
> index 3d18d1b..d3753e4 100644
> --- a/linux-user/signal.c
> +++ b/linux-user/signal.c
> @@ -5673,6 +5673,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)
> {
> @@ -5699,9 +5717,30 @@ 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;
> +
> + __get_user(env->fpcr, &fpregs->f_fpcntl[0]);
> + __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)
> {
> @@ -5733,6 +5772,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:
>
next prev parent reply other threads:[~2017-06-28 20:45 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-20 20:51 [Qemu-devel] [PATCH v5 0/6] target-m68k: implement 680x0 FPU Laurent Vivier
2017-06-20 20:51 ` [Qemu-devel] [PATCH v5 1/6] target-m68k: move fmove CR to a function Laurent Vivier
2017-06-20 22:50 ` Richard Henderson
2017-06-21 15:54 ` Philippe Mathieu-Daudé
2017-06-20 20:51 ` [Qemu-devel] [PATCH v5 2/6] target-m68k: initialize FPU registers Laurent Vivier
2017-06-20 22:44 ` Richard Henderson
2017-06-20 22:51 ` Richard Henderson
2017-06-20 20:51 ` [Qemu-devel] [PATCH v5 3/6] target-m68k: use floatx80 internally Laurent Vivier
2017-06-20 22:50 ` Richard Henderson
2017-06-21 16:18 ` Philippe Mathieu-Daudé
2017-06-21 16:37 ` Richard Henderson
2017-06-21 16:45 ` Laurent Vivier
2017-06-26 4:47 ` Philippe Mathieu-Daudé
2017-06-20 20:51 ` [Qemu-devel] [PATCH v5 4/6] target-m68k: define 96bit FP registers for gdb on 680x0 Laurent Vivier
2017-06-20 20:51 ` [Qemu-devel] [PATCH v5 5/6] target-m68k: add FPCR and FPSR Laurent Vivier
2017-06-20 22:55 ` Richard Henderson
2017-06-20 20:51 ` [Qemu-devel] [PATCH v5 6/6] target-m68k, linux-user: manage FP registers in ucontext Laurent Vivier
2017-06-20 22:57 ` Richard Henderson
2017-06-28 20:44 ` Laurent Vivier [this message]
2017-06-29 13:46 ` Riku Voipio
2017-06-29 14:11 ` Laurent Vivier
2017-06-29 14:17 ` Laurent Vivier
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=e94af6f2-8869-b9e7-b2b8-b3f16713b345@vivier.eu \
--to=laurent@vivier.eu \
--cc=aurelien@aurel32.net \
--cc=f4bug@amsat.org \
--cc=huth@tuxfamily.org \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
--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).