Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc For booke and ibm4xx, emulate m[ft]msr in u...



details:   https://anonhg.NetBSD.org/src/rev/74bcfd089480
branches:  trunk
changeset: 973862:74bcfd089480
user:      rin <rin%NetBSD.org@localhost>
date:      Wed Jul 15 09:10:14 2020 +0000

description:
For booke and ibm4xx, emulate m[ft]msr in user mode, in the same
manner as oea.

Now, user process can decide by itself whether floating-point
exception triggers SIGFPE or not via fenv(3).

diffstat:

 sys/arch/powerpc/booke/trap.c  |   9 +++------
 sys/arch/powerpc/ibm4xx/trap.c |  19 +++++++++++++++++--
 2 files changed, 20 insertions(+), 8 deletions(-)

diffs (77 lines):

diff -r 7a0c9e7b96b2 -r 74bcfd089480 sys/arch/powerpc/booke/trap.c
--- a/sys/arch/powerpc/booke/trap.c     Wed Jul 15 08:58:51 2020 +0000
+++ b/sys/arch/powerpc/booke/trap.c     Wed Jul 15 09:10:14 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.33 2020/07/15 07:44:34 rin Exp $    */
+/*     $NetBSD: trap.c,v 1.34 2020/07/15 09:10:14 rin Exp $    */
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.33 2020/07/15 07:44:34 rin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.34 2020/07/15 09:10:14 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -437,10 +437,7 @@
                return true;
        }
 
-       /*
-        * If we bothered to emulate FP, we would try to do so here.
-        */
-       return false;
+       return emulate_mxmsr(curlwp, tf, opcode);
 }
 
 static int
diff -r 7a0c9e7b96b2 -r 74bcfd089480 sys/arch/powerpc/ibm4xx/trap.c
--- a/sys/arch/powerpc/ibm4xx/trap.c    Wed Jul 15 08:58:51 2020 +0000
+++ b/sys/arch/powerpc/ibm4xx/trap.c    Wed Jul 15 09:10:14 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.84 2020/07/15 08:48:40 rin Exp $    */
+/*     $NetBSD: trap.c,v 1.85 2020/07/15 09:10:14 rin Exp $    */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -69,7 +69,7 @@
 #define        __UFETCHSTORE_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.84 2020/07/15 08:48:40 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.85 2020/07/15 09:10:14 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -287,6 +287,7 @@
                if (rv == 0) {
                        break;
                }
+isi:
                KSI_INIT_TRAP(&ksi);
                ksi.ksi_trap = EXC_ISI;
                ksi.ksi_addr = (void *)tf->tf_srr0;
@@ -324,6 +325,20 @@
                        }
                        ksi.ksi_code = TRAP_BRKPT;
                        ksi.ksi_signo = SIGTRAP;
+               } else if (tf->tf_esr & ESR_PPR) {
+                       uint32_t opcode;
+
+                       rv = copyin((void *)tf->tf_srr0, &opcode,
+                           sizeof(opcode));
+                       if (rv)
+                               goto isi;
+                       if (emulate_mxmsr(l, tf, opcode)) {
+                               tf->tf_srr0 += 4;
+                               break;
+                       }
+
+                       ksi.ksi_code = ILL_PRVOPC;
+                       ksi.ksi_signo = SIGILL;
                } else {
                        pcb = lwp_getpcb(l);
 



Home | Main Index | Thread Index | Old Index