All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] linux-user: Update MIPS specific prctl() implementation
@ 2018-11-14 13:37 Stefan Markovic
  2018-11-14 14:09 ` Laurent Vivier
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Markovic @ 2018-11-14 13:37 UTC (permalink / raw)
  To: qemu-devel
  Cc: aurelien, amarkovic, smarkovic, pjovanovic, riku.voipio, laurent

From: Stefan Markovic <smarkovic@wavecomp.com>

Perform needed checks before actual prctl() PR_SET_FP_MODE and
PR_GET_FP_MODE work based on kernel implementation. Also, update
necessary hflags.

Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>
---
 linux-user/syscall.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 810a58b..10db8b7 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -9544,9 +9544,25 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
         {
             CPUMIPSState *env = ((CPUMIPSState *)cpu_env);
             bool old_fr = env->CP0_Status & (1 << CP0St_FR);
+            bool old_fre = env->CP0_Config5 & (1 << CP0C5_FRE);
             bool new_fr = arg2 & TARGET_PR_FP_MODE_FR;
             bool new_fre = arg2 & TARGET_PR_FP_MODE_FRE;
 
+            const unsigned int known_bits = TARGET_PR_FP_MODE_FR |
+                                            TARGET_PR_FP_MODE_FRE;
+
+            /* If nothing to change, return right away, successfully.  */
+            if (old_fr == new_fr && old_fre == new_fre) {
+                return 0;
+            }
+            /* Check the value is valid */
+            if (arg2 & ~known_bits) {
+                return -TARGET_EOPNOTSUPP;
+            }
+            /* Setting FRE without FR is not supported.  */
+            if (new_fre && !new_fr) {
+                return -TARGET_EOPNOTSUPP;
+            }
             if (new_fr && !(env->active_fpu.fcr0 & (1 << FCR0_F64))) {
                 /* FR1 is not supported */
                 return -TARGET_EOPNOTSUPP;
@@ -9576,6 +9592,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
                 env->hflags |= MIPS_HFLAG_F64;
             } else {
                 env->CP0_Status &= ~(1 << CP0St_FR);
+                env->hflags &= ~MIPS_HFLAG_F64;
             }
             if (new_fre) {
                 env->CP0_Config5 |= (1 << CP0C5_FRE);
@@ -9584,6 +9601,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
                 }
             } else {
                 env->CP0_Config5 &= ~(1 << CP0C5_FRE);
+                env->hflags &= ~MIPS_HFLAG_FRE;
             }
 
             return 0;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] linux-user: Update MIPS specific prctl() implementation
  2018-11-14 13:37 [Qemu-devel] [PATCH] linux-user: Update MIPS specific prctl() implementation Stefan Markovic
@ 2018-11-14 14:09 ` Laurent Vivier
  2018-11-16 11:58   ` Aleksandar Markovic
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Vivier @ 2018-11-14 14:09 UTC (permalink / raw)
  To: Stefan Markovic, qemu-devel
  Cc: smarkovic, riku.voipio, amarkovic, pjovanovic, aurelien

On 14/11/2018 14:37, Stefan Markovic wrote:
> From: Stefan Markovic <smarkovic@wavecomp.com>
> 
> Perform needed checks before actual prctl() PR_SET_FP_MODE and
> PR_GET_FP_MODE work based on kernel implementation. Also, update
> necessary hflags.
> 
> Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>

I think it's better if you send the patch with the email address of the
S-o-b.

> ---
>  linux-user/syscall.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 

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

If you plan to do a MIPS p-r before the next RC, don't hesitate to add
this patch to it (my linux-user queue is empty for the moment).

Thanks,
Laurent

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] linux-user: Update MIPS specific prctl() implementation
  2018-11-14 14:09 ` Laurent Vivier
@ 2018-11-16 11:58   ` Aleksandar Markovic
  0 siblings, 0 replies; 3+ messages in thread
From: Aleksandar Markovic @ 2018-11-16 11:58 UTC (permalink / raw)
  To: Laurent Vivier, Stefan Markovic, qemu-devel
  Cc: Stefan Markovic, riku.voipio, Petar Jovanovic, aurelien

From: Laurent Vivier <laurent@vivier.eu>

> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> 
> If you plan to do a MIPS p-r before the next RC, don't hesitate to add
> this patch to it (my linux-user queue is empty for the moment).

Laurent,

I plan to create a MIPS pull request in next few days, and I am
going to include this patch in it (unless you tell me not to do so).

Thanks a bunch!!

Aleksandar

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-16 11:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-14 13:37 [Qemu-devel] [PATCH] linux-user: Update MIPS specific prctl() implementation Stefan Markovic
2018-11-14 14:09 ` Laurent Vivier
2018-11-16 11:58   ` Aleksandar Markovic

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.