Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Add some compile time asserts for endianness on boa...



details:   https://anonhg.NetBSD.org/src/rev/3efc1587db2a
branches:  trunk
changeset: 942728:3efc1587db2a
user:      simonb <simonb%NetBSD.org@localhost>
date:      Mon Aug 17 07:50:41 2020 +0000

description:
Add some compile time asserts for endianness on boards/systems that
only support a single endianness.

diffstat:

 sys/arch/algor/algor/machdep.c      |  7 +++++--
 sys/arch/evbmips/alchemy/mtx-1.c    |  7 +++++--
 sys/arch/evbmips/alchemy/omsal400.c |  7 +++++--
 sys/arch/evbmips/atheros/machdep.c  |  7 +++++--
 sys/arch/evbmips/cavium/machdep.c   |  7 +++++--
 sys/arch/evbmips/gdium/machdep.c    |  7 +++++--
 sys/arch/evbmips/ingenic/machdep.c  |  7 +++++--
 sys/arch/evbmips/loongson/machdep.c |  7 +++++--
 8 files changed, 40 insertions(+), 16 deletions(-)

diffs (224 lines):

diff -r bae9c4b00521 -r 3efc1587db2a sys/arch/algor/algor/machdep.c
--- a/sys/arch/algor/algor/machdep.c    Mon Aug 17 07:26:55 2020 +0000
+++ b/sys/arch/algor/algor/machdep.c    Mon Aug 17 07:50:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.56 2020/08/17 07:22:46 mrg Exp $ */
+/*     $NetBSD: machdep.c,v 1.57 2020/08/17 07:50:41 simonb Exp $      */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.56 2020/08/17 07:22:46 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.57 2020/08/17 07:50:41 simonb Exp $");
 
 #include "opt_algor_p4032.h"
 #include "opt_algor_p5064.h" 
@@ -164,6 +164,9 @@
 
 int    cpuspeed = 150;         /* XXX XXX XXX */
 
+/* The ALGOR kernels only support little endian */
+CTASSERT(_BYTE_ORDER == _LITTLE_ENDIAN);
+
 void
 mach_init(int argc, char *argv[], char *envp[])
 {
diff -r bae9c4b00521 -r 3efc1587db2a sys/arch/evbmips/alchemy/mtx-1.c
--- a/sys/arch/evbmips/alchemy/mtx-1.c  Mon Aug 17 07:26:55 2020 +0000
+++ b/sys/arch/evbmips/alchemy/mtx-1.c  Mon Aug 17 07:50:41 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mtx-1.c,v 1.8 2015/06/09 22:49:55 matt Exp $ */
+/* $NetBSD: mtx-1.c,v 1.9 2020/08/17 07:50:41 simonb Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */ 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mtx-1.c,v 1.8 2015/06/09 22:49:55 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mtx-1.c,v 1.9 2020/08/17 07:50:41 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -72,6 +72,9 @@
        NULL,   /* poweroff */
 };
 
+/* The MTX-1 kernels only support little endian */
+CTASSERT(_BYTE_ORDER == _LITTLE_ENDIAN);
+
 const struct alchemy_board *
 board_info(void)
 {
diff -r bae9c4b00521 -r 3efc1587db2a sys/arch/evbmips/alchemy/omsal400.c
--- a/sys/arch/evbmips/alchemy/omsal400.c       Mon Aug 17 07:26:55 2020 +0000
+++ b/sys/arch/evbmips/alchemy/omsal400.c       Mon Aug 17 07:50:41 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: omsal400.c,v 1.10 2015/06/09 22:49:55 matt Exp $ */
+/* $NetBSD: omsal400.c,v 1.11 2020/08/17 07:50:41 simonb Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -36,7 +36,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: omsal400.c,v 1.10 2015/06/09 22:49:55 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omsal400.c,v 1.11 2020/08/17 07:50:41 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -93,6 +93,9 @@
        &omsal400_pcmcia,
 };
 
+/* The OMS AL400 kernels only support little endian */
+CTASSERT(_BYTE_ORDER == _LITTLE_ENDIAN);
+
 const struct alchemy_board *
 board_info(void)
 {
diff -r bae9c4b00521 -r 3efc1587db2a sys/arch/evbmips/atheros/machdep.c
--- a/sys/arch/evbmips/atheros/machdep.c        Mon Aug 17 07:26:55 2020 +0000
+++ b/sys/arch/evbmips/atheros/machdep.c        Mon Aug 17 07:50:41 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.32 2020/07/22 01:24:39 msaitoh Exp $ */
+/* $NetBSD: machdep.c,v 1.33 2020/08/17 07:50:42 simonb Exp $ */
 
 /*
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -110,7 +110,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.32 2020/07/22 01:24:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.33 2020/08/17 07:50:42 simonb Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -154,6 +154,9 @@
 
 void   mach_init(void); /* XXX */
 
+/* Currently the Atheros kernels only support big endian boards */
+CTASSERT(_BYTE_ORDER == _BIG_ENDIAN);
+
 static void
 cal_timer(void)
 {
diff -r bae9c4b00521 -r 3efc1587db2a sys/arch/evbmips/cavium/machdep.c
--- a/sys/arch/evbmips/cavium/machdep.c Mon Aug 17 07:26:55 2020 +0000
+++ b/sys/arch/evbmips/cavium/machdep.c Mon Aug 17 07:50:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.22 2020/07/28 00:35:38 simonb Exp $      */
+/*     $NetBSD: machdep.c,v 1.23 2020/08/17 07:50:42 simonb Exp $      */
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -114,7 +114,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.22 2020/07/28 00:35:38 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.23 2020/08/17 07:50:42 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -188,6 +188,9 @@
 
 char octeon_nmi_stack[PAGE_SIZE] __section(".data1") __aligned(PAGE_SIZE);
 
+/* Currently the OCTEON kernels only support big endian boards */
+CTASSERT(_BYTE_ORDER == _BIG_ENDIAN);
+
 /*
  * Do all the stuff that locore normally does before calling main().
  */
diff -r bae9c4b00521 -r 3efc1587db2a sys/arch/evbmips/gdium/machdep.c
--- a/sys/arch/evbmips/gdium/machdep.c  Mon Aug 17 07:26:55 2020 +0000
+++ b/sys/arch/evbmips/gdium/machdep.c  Mon Aug 17 07:50:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.20 2016/12/22 14:47:56 cherry Exp $      */
+/*     $NetBSD: machdep.c,v 1.21 2020/08/17 07:50:42 simonb Exp $      */
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.20 2016/12/22 14:47:56 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.21 2020/08/17 07:50:42 simonb Exp $");
 
 #include "opt_ddb.h"
 #include "opt_execfmt.h"
@@ -137,6 +137,9 @@
 void   configure(void);
 void   mach_init(int, char **, char **, void *);
 
+/* The GDIUM kernels only support little endian */
+CTASSERT(_BYTE_ORDER == _LITTLE_ENDIAN);
+
 /*
  * For some reason, PMON doesn't assign a real address to the Ralink's BAR.
  * So we have to do it.
diff -r bae9c4b00521 -r 3efc1587db2a sys/arch/evbmips/ingenic/machdep.c
--- a/sys/arch/evbmips/ingenic/machdep.c        Mon Aug 17 07:26:55 2020 +0000
+++ b/sys/arch/evbmips/ingenic/machdep.c        Mon Aug 17 07:50:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.15 2020/07/22 01:24:39 msaitoh Exp $ */
+/*     $NetBSD: machdep.c,v 1.16 2020/08/17 07:50:42 simonb Exp $ */
 
 /*-
  * Copyright (c) 2014 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.15 2020/07/22 01:24:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.16 2020/08/17 07:50:42 simonb Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -86,6 +86,9 @@
 kmutex_t ingenic_ipi_lock;
 #endif
 
+/* Currently the Ingenic kernels (CI20) only support little endian boards */
+CTASSERT(_BYTE_ORDER == _LITTLE_ENDIAN);
+
 static void
 cal_timer(void)
 {
diff -r bae9c4b00521 -r 3efc1587db2a sys/arch/evbmips/loongson/machdep.c
--- a/sys/arch/evbmips/loongson/machdep.c       Mon Aug 17 07:26:55 2020 +0000
+++ b/sys/arch/evbmips/loongson/machdep.c       Mon Aug 17 07:50:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.7 2016/12/22 14:47:57 cherry Exp $       */
+/*     $NetBSD: machdep.c,v 1.8 2020/08/17 07:50:42 simonb Exp $       */
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.7 2016/12/22 14:47:57 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.8 2020/08/17 07:50:42 simonb Exp $");
 
 #include "opt_ddb.h"
 #include "opt_execfmt.h"
@@ -242,6 +242,9 @@
        CN_DEAD
 };
 
+/* The LOONGSON kernels only support little endian */
+CTASSERT(_BYTE_ORDER == _LITTLE_ENDIAN);
+
 /*
  * Do all the stuff that locore normally does before calling main().
  */



Home | Main Index | Thread Index | Old Index