Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc Export CPU capability of unaligned memory a...



details:   https://anonhg.NetBSD.org/src/rev/7396c18cf3eb
branches:  trunk
changeset: 366553:7396c18cf3eb
user:      rin <rin%NetBSD.org@localhost>
date:      Mon May 30 14:48:08 2022 +0000

description:
Export CPU capability of unaligned memory access to userland
as machdep.no_unaligned sysctl(7) variable.

This will be used for ld.so.conf in order to provide strictly-
aligned versions of libc routines.

diffstat:

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

diffs (60 lines):

diff -r 8a56c7c12ad2 -r 7396c18cf3eb sys/arch/powerpc/include/cpu.h
--- a/sys/arch/powerpc/include/cpu.h    Mon May 30 14:43:37 2022 +0000
+++ b/sys/arch/powerpc/include/cpu.h    Mon May 30 14:48:08 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.121 2022/05/30 14:05:36 rin Exp $    */
+/*     $NetBSD: cpu.h,v 1.122 2022/05/30 14:48:08 rin Exp $    */
 
 /*
  * Copyright (C) 1999 Wolfgang Solfrank.
@@ -511,5 +511,6 @@
 #define        CPU_BOOTED_KERNEL       10      /* string: kernel we booted */
 #define        CPU_EXECPROT            11      /* bool: PROT_EXEC works */
 #define        CPU_FPU                 12
+#define        CPU_NO_UNALIGNED        13      /* No HW support for unaligned access */
 
 #endif /* _POWERPC_CPU_H_ */
diff -r 8a56c7c12ad2 -r 7396c18cf3eb sys/arch/powerpc/powerpc/powerpc_machdep.c
--- a/sys/arch/powerpc/powerpc/powerpc_machdep.c        Mon May 30 14:43:37 2022 +0000
+++ b/sys/arch/powerpc/powerpc/powerpc_machdep.c        Mon May 30 14:48:08 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: powerpc_machdep.c,v 1.85 2022/05/20 19:34:22 andvar Exp $      */
+/*     $NetBSD: powerpc_machdep.c,v 1.86 2022/05/30 14:48:08 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.85 2022/05/20 19:34:22 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: powerpc_machdep.c,v 1.86 2022/05/30 14:48:08 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -40,6 +40,7 @@
 #include "opt_modular.h"
 #include "opt_multiprocessor.h"
 #include "opt_ppcarch.h"
+#include "opt_ppcopts.h"
 #endif
 
 #include <sys/param.h>
@@ -301,6 +302,17 @@
 #endif
                       NULL, 0,
                       CTL_MACHDEP, CPU_FPU, CTL_EOL);
+       sysctl_createv(clog, 0, NULL, NULL,
+                      CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
+                      CTLTYPE_INT, "no_unaligned", NULL,
+                      NULL,
+#if defined(PPC_NO_UNALIGNED)
+                      1,
+#else
+                      0,
+#endif
+                      NULL, 0,
+                      CTL_MACHDEP, CPU_NO_UNALIGNED, CTL_EOL);
 }
 
 /*



Home | Main Index | Thread Index | Old Index