qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: Aleksandar Markovic <aleksandar.markovic@rt-rk.com>,
	qemu-devel@nongnu.org
Cc: amarkovic@wavecomp.com
Subject: Re: [Qemu-devel] [PATCH v15 5/5] linux-user: Handle EXCP_FPE properly for MIPS
Date: Fri, 28 Jun 2019 11:06:22 +0200	[thread overview]
Message-ID: <e6037c0f-e3a1-287d-e096-586fdade7176@vivier.eu> (raw)
In-Reply-To: <1561712082-31441-6-git-send-email-aleksandar.markovic@rt-rk.com>

Le 28/06/2019 à 10:54, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> Handle EXCP_FPE properly for MIPS in cpu loop.
> 
> Note that a vast majority of FP instructions are not affected by
> the absence of the code in this patch, as they use alternative code
> paths for handling floating point exceptions (see, for example,
> invocations of update_fcr31()) - they rely on softfloat library for
> keeping track on exceptions that needs to be raised. However, there
> are few MIPS FP instructions (an example is CTC1) that use function
> do_raise_exception() directly, and they need the case that is added
> in this patch to propagate the FPE exception as designed.
> 
> The code is based on kernel's function force_fcr31_sig() in
> arch/mips/kernel.traps.c.
> 
> Reported-by: Yunqiang Su <ysu@wavecomp.com>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/mips/cpu_loop.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c
> index 43ba267..0ba894f 100644
> --- a/linux-user/mips/cpu_loop.c
> +++ b/linux-user/mips/cpu_loop.c
> @@ -540,6 +540,23 @@ done_syscall:
>              info.si_code = TARGET_ILL_ILLOPC;
>              queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
>              break;
> +        case EXCP_FPE:
> +            info.si_signo = TARGET_SIGFPE;
> +            info.si_errno = 0;
> +            info.si_code = TARGET_FPE_FLTUNK;
> +            if (GET_FP_CAUSE(env->active_fpu.fcr31) & FP_INVALID) {
> +                info.si_code = TARGET_FPE_FLTINV;
> +            } else if (GET_FP_CAUSE(env->active_fpu.fcr31) & FP_DIV0) {
> +                info.si_code = TARGET_FPE_FLTDIV;
> +            } else if (GET_FP_CAUSE(env->active_fpu.fcr31) & FP_OVERFLOW) {
> +                info.si_code = TARGET_FPE_FLTOVF;
> +            } else if (GET_FP_CAUSE(env->active_fpu.fcr31) & FP_UNDERFLOW) {
> +                info.si_code = TARGET_FPE_FLTUND;
> +            } else if (GET_FP_CAUSE(env->active_fpu.fcr31) & FP_INEXACT) {
> +                info.si_code = TARGET_FPE_FLTRES;
> +            }
> +            queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
> +            break;
>          /* The code below was inspired by the MIPS Linux kernel trap
>           * handling code in arch/mips/kernel/traps.c.
>           */
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>


  reply	other threads:[~2019-06-28  9:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28  8:54 [Qemu-devel] [PATCH v15 0/5] linux-user: A set of miscellaneous patches Aleksandar Markovic
2019-06-28  8:54 ` [Qemu-devel] [PATCH v15 1/5] linux-user: Add support for translation of statx() syscall Aleksandar Markovic
2019-06-28  8:54 ` [Qemu-devel] [PATCH v15 2/5] linux-user: Add support for strace for " Aleksandar Markovic
2019-06-28  8:54 ` [Qemu-devel] [PATCH v15 3/5] linux-user: Fix target_flock structure for MIPS O64 ABI Aleksandar Markovic
2019-06-28  8:54 ` [Qemu-devel] [PATCH v15 4/5] linux-user: Introduce TARGET_HAVE_ARCH_STRUCT_FLOCK Aleksandar Markovic
2019-06-28  8:54 ` [Qemu-devel] [PATCH v15 5/5] linux-user: Handle EXCP_FPE properly for MIPS Aleksandar Markovic
2019-06-28  9:06   ` Laurent Vivier [this message]
2019-06-28  9:09 ` [Qemu-devel] [PATCH v15 0/5] linux-user: A set of miscellaneous patches no-reply
2019-06-28  9:39 ` no-reply
2019-06-28  9:49 ` no-reply
2019-06-28 12:15   ` Laurent Vivier
2019-06-28 12:41     ` [Qemu-devel] [Patchew-devel] " Fam Zheng
2019-06-28 12:47       ` Laurent Vivier
2019-06-28 12:55         ` Aleksandar Markovic

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=e6037c0f-e3a1-287d-e096-586fdade7176@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=aleksandar.markovic@rt-rk.com \
    --cc=amarkovic@wavecomp.com \
    --cc=qemu-devel@nongnu.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).