Module Name: src
Committed By: rin
Date: Tue Jul 7 01:39:23 UTC 2020
Modified Files:
src/sys/arch/powerpc/include: cpu.h
src/sys/arch/powerpc/powerpc: powerpc_machdep.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/powerpc/include/cpu.h
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/powerpc/powerpc/powerpc_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/powerpc/include/cpu.h
diff -u src/sys/arch/powerpc/include/cpu.h:1.113 src/sys/arch/powerpc/include/cpu.h:1.114
--- src/sys/arch/powerpc/include/cpu.h:1.113 Mon Jul 6 13:20:55 2020
+++ src/sys/arch/powerpc/include/cpu.h Tue Jul 7 01:39:23 2020
@@ -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 @@ void __syncicache(void *, size_t);
#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_ */
Index: src/sys/arch/powerpc/powerpc/powerpc_machdep.c
diff -u src/sys/arch/powerpc/powerpc/powerpc_machdep.c:1.78 src/sys/arch/powerpc/powerpc/powerpc_machdep.c:1.79
--- src/sys/arch/powerpc/powerpc/powerpc_machdep.c:1.78 Mon Jul 6 09:34:18 2020
+++ src/sys/arch/powerpc/powerpc/powerpc_machdep.c Tue Jul 7 01:39:23 2020
@@ -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 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysc
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);
}
/*