Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc/powerpc Provide no-op's as pcu_ops_md_defs[...



details:   https://anonhg.NetBSD.org/src/rev/88420d8c3082
branches:  trunk
changeset: 1007454:88420d8c3082
user:      rin <rin%NetBSD.org@localhost>
date:      Thu Feb 20 06:12:47 2020 +0000

description:
Provide no-op's as pcu_ops_md_defs[PCU_FPU] even if !PPC_HAVE_FPU.

This is required by subr_pcu.c rev 1.21 and later:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/subr_pcu.c#rev1.21

Otherwise, panic occurs when FP instruction is emulated on machines
without FPU.

Note that PowerPC UISA as well as SVR4 ABI require FP instructions,
and emulation is enabled unconditionally on machines without FPU.

diffstat:

 sys/arch/powerpc/powerpc/fpu.c             |  16 +++++++++-------
 sys/arch/powerpc/powerpc/powerpc_machdep.c |   6 ++----
 2 files changed, 11 insertions(+), 11 deletions(-)

diffs (113 lines):

diff -r 254741f594aa -r 88420d8c3082 sys/arch/powerpc/powerpc/fpu.c
--- a/sys/arch/powerpc/powerpc/fpu.c    Thu Feb 20 05:57:49 2020 +0000
+++ b/sys/arch/powerpc/powerpc/fpu.c    Thu Feb 20 06:12:47 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu.c,v 1.38 2017/03/16 16:13:20 chs Exp $     */
+/*     $NetBSD: fpu.c,v 1.39 2020/02/20 06:12:47 rin Exp $     */
 
 /*
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.38 2017/03/16 16:13:20 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.39 2020/02/20 06:12:47 rin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -47,19 +47,15 @@
 #include <machine/fpu.h>
 #include <machine/psl.h>
 
-#ifdef PPC_HAVE_FPU
 static void fpu_state_load(lwp_t *, u_int);
 static void fpu_state_save(lwp_t *);
 static void fpu_state_release(lwp_t *);
-#endif
 
 const pcu_ops_t fpu_ops = {
        .pcu_id = PCU_FPU,
-#ifdef PPC_HAVE_FPU
        .pcu_state_load = fpu_state_load,
        .pcu_state_save = fpu_state_save,
        .pcu_state_release = fpu_state_release,
-#endif
 };
 
 bool
@@ -74,10 +70,10 @@
        pcu_discard(&fpu_ops, l, true);
 }
 
-#ifdef PPC_HAVE_FPU
 void
 fpu_state_load(lwp_t *l, u_int flags)
 {
+#ifdef PPC_HAVE_FPU
        struct pcb * const pcb = lwp_getpcb(l);
 
        if ((flags & PCU_VALID) == 0) {
@@ -98,6 +94,7 @@
 
        curcpu()->ci_ev_fpusw.ev_count++;
        l->l_md.md_utf->tf_srr1 |= PSL_FP|(pcb->pcb_flags & (PCB_FE0|PCB_FE1));
+#endif
 }
 
 /*
@@ -106,6 +103,7 @@
 void
 fpu_state_save(lwp_t *l)
 {
+#ifdef PPC_HAVE_FPU
        struct pcb * const pcb = lwp_getpcb(l);
 
        const register_t msr = mfmsr();
@@ -117,14 +115,18 @@
 
        mtmsr(msr);
        __asm volatile ("isync");
+#endif
 }
 
 void
 fpu_state_release(lwp_t *l)
 {
+#ifdef PPC_HAVE_FPU
        l->l_md.md_utf->tf_srr1 &= ~PSL_FP;
+#endif
 }
 
+#ifdef PPC_HAVE_FPU
 #define        STICKYBITS      (FPSCR_VX|FPSCR_OX|FPSCR_UX|FPSCR_ZX|FPSCR_XX)
 #define        STICKYSHIFT     25
 #define        MASKBITS        (FPSCR_VE|FPSCR_OE|FPSCR_UE|FPSCR_ZE|FPSCR_XE)
diff -r 254741f594aa -r 88420d8c3082 sys/arch/powerpc/powerpc/powerpc_machdep.c
--- a/sys/arch/powerpc/powerpc/powerpc_machdep.c        Thu Feb 20 05:57:49 2020 +0000
+++ b/sys/arch/powerpc/powerpc/powerpc_machdep.c        Thu Feb 20 06:12:47 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: powerpc_machdep.c,v 1.76 2020/02/17 21:49:27 ad Exp $  */
+/*     $NetBSD: powerpc_machdep.c,v 1.77 2020/02/20 06:12:47 rin Exp $ */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: powerpc_machdep.c,v 1.76 2020/02/17 21:49:27 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: powerpc_machdep.c,v 1.77 2020/02/20 06:12:47 rin Exp $");
 
 #include "opt_altivec.h"
 #include "opt_ddb.h"
@@ -89,9 +89,7 @@
 char *booted_kernel;
 
 const pcu_ops_t * const pcu_ops_md_defs[PCU_UNIT_COUNT] = {
-#if defined(PPC_HAVE_FPU)
        [PCU_FPU] = &fpu_ops,
-#endif
 #if defined(ALTIVEC) || defined(PPC_HAVE_SPE)
        [PCU_VEC] = &vec_ops,
 #endif



Home | Main Index | Thread Index | Old Index