Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc Part of PR port-powerpc/55425



details:   https://anonhg.NetBSD.org/src/rev/d06edda0b651
branches:  trunk
changeset: 1011709:d06edda0b651
user:      rin <rin%NetBSD.org@localhost>
date:      Tue Jul 07 01:39:23 2020 +0000

description:
Part of PR port-powerpc/55425
openssl fails on FPU emulation for powerpc

Provide machdep.fpu_present sysctl variable like other ports.

Userland can get informed that FPU is absent and emulated in software
(and calculation results may not be correct in bit-to-bit precision).

This variable should be useful even if we could fix FPU emulation;
it is much faster to skip FPU arithmetic in general, rather than
relying upon emulation by kernel via illegal instruction handler.

diffstat:

 sys/arch/powerpc/include/cpu.h             |   3 ++-
 sys/arch/powerpc/powerpc/powerpc_machdep.c |  15 +++++++++++++--
 2 files changed, 15 insertions(+), 3 deletions(-)

diffs (52 lines):

diff -r 38b869243e7f -r d06edda0b651 sys/arch/powerpc/include/cpu.h
--- a/sys/arch/powerpc/include/cpu.h    Tue Jul 07 00:59:29 2020 +0000
+++ b/sys/arch/powerpc/include/cpu.h    Tue Jul 07 01:39:23 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.113 2020/07/06 13:20:55 rin Exp $    */
+/*     $NetBSD: cpu.h,v 1.114 2020/07/07 01:39:23 rin Exp $    */
 
 /*
  * Copyright (C) 1999 Wolfgang Solfrank.
@@ -489,5 +489,6 @@
 #define        CPU_BOOTED_DEVICE       9       /* string: device we booted from */
 #define        CPU_BOOTED_KERNEL       10      /* string: kernel we booted */
 #define        CPU_EXECPROT            11      /* bool: PROT_EXEC works */
+#define        CPU_FPU                 12
 
 #endif /* _POWERPC_CPU_H_ */
diff -r 38b869243e7f -r d06edda0b651 sys/arch/powerpc/powerpc/powerpc_machdep.c
--- a/sys/arch/powerpc/powerpc/powerpc_machdep.c        Tue Jul 07 00:59:29 2020 +0000
+++ b/sys/arch/powerpc/powerpc/powerpc_machdep.c        Tue Jul 07 01:39:23 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: powerpc_machdep.c,v 1.78 2020/07/06 09:34:18 rin Exp $ */
+/*     $NetBSD: powerpc_machdep.c,v 1.79 2020/07/07 01:39:23 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.78 2020/07/06 09:34:18 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: powerpc_machdep.c,v 1.79 2020/07/07 01:39:23 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -285,6 +285,17 @@
                       CTLTYPE_STRING, "booted_kernel", NULL,
                       sysctl_machdep_booted_kernel, 0, NULL, 0,
                       CTL_MACHDEP, CPU_BOOTED_KERNEL, CTL_EOL);
+       sysctl_createv(clog, 0, NULL, NULL,
+                      CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
+                      CTLTYPE_INT, "fpu_present", NULL,
+                      NULL,
+#if defined(PPC_HAVE_FPU)
+                      1,
+#else
+                      0,
+#endif
+                      NULL, 0,
+                      CTL_MACHDEP, CPU_FPU, CTL_EOL);
 }
 
 /*



Home | Main Index | Thread Index | Old Index