Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Oct 2002 14:33:48 -0700 (PDT)
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 19495 for review
Message-ID:  <200210172133.g9HLXmq4088134@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=19495

Change 19495 by jmallett@jmallett_luna on 2002/10/17 14:33:33

	Add endian control at config(8) time, and add <platform/endian.h>
	and implement its use in <machine/endian.h>, to allow a platform
	(i.e. sgimips) to set the endianness without us having to duplicate
	stuff and have upward-inheritence of includes.

Affected files ...

.. //depot/projects/mips/sys/conf/options.mips#2 edit
.. //depot/projects/mips/sys/mips/conf/GENERIC#3 edit
.. //depot/projects/mips/sys/mips/include/endian.h#2 edit
.. //depot/projects/mips/sys/mips/sgimips/endian.h#1 add

Differences ...

==== //depot/projects/mips/sys/conf/options.mips#2 (text+ko) ====

@@ -4,3 +4,5 @@
 R4400			opt_global.h
 
 SGI			opt_platform.h
+
+_BYTE_ORDER		opt_endian.h

==== //depot/projects/mips/sys/mips/conf/GENERIC#3 (text+ko) ====

@@ -16,3 +16,13 @@
 
 # Hardware support
 device		arcbios			#ARCBIOS
+
+# Other options
+
+# One can configure MIPS to run as either endian...  By default,
+# the platform is expected to define which endian, however it can
+# be overridden here.
+# To tell the kernel the system is big endian:
+#options 	_BYTE_ORDER=4321
+# Or that it's little endian:
+#options 	_BYTE_ORDER=1234

==== //depot/projects/mips/sys/mips/include/endian.h#2 (text+ko) ====

@@ -41,6 +41,10 @@
 #include <sys/cdefs.h>
 #include <sys/_types.h>
 
+#ifdef	_KERNEL
+#include "opt_endian.h"
+#endif
+
 /*
  * Define the order of 32-bit words in 64-bit words.
  */
@@ -55,7 +59,21 @@
 #define	_BIG_ENDIAN	4321	/* MSB first: 68000, ibm, net */
 #define	_PDP_ENDIAN	3412	/* LSB first in word, MSW first in long */
 
-#define	_BYTE_ORDER	_BIG_ENDIAN
+/*
+ * Pull in the platform-specific endian description.  The byte order may have
+ * been specified in opt_endian.h, and the platform will respect that.  We
+ * still include it as it could (for all we know) define other endian-related
+ * functionality, plus we may not be in the kernel.
+ */
+#include <platform/endian.h>
+
+/*
+ * It must define _BYTE_ORDER.
+ */
+#ifndef	_BYTE_ORDER
+#error Your MIPS platform needs to define _BYTE_ORDER in <platform/endian.h>
+#endif
+
 
 /*
  * Deprecated variants that don't have enough underscores to be useful in more

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210172133.g9HLXmq4088134>