summaryrefslogtreecommitdiff
path: root/sys/arch/powerpc/include/endian.h
diff options
context:
space:
mode:
authorPer Fogelstrom <pefo@cvs.openbsd.org>1997-10-13 10:53:50 +0000
committerPer Fogelstrom <pefo@cvs.openbsd.org>1997-10-13 10:53:50 +0000
commitef834a87737378e1dc26e0e3e32e5d1445167855 (patch)
tree6d0361ba13d27d2dc1e4f8dac57eebd57defdded /sys/arch/powerpc/include/endian.h
parent3741f00a6b332fa2e185b942e237df76267d52b8 (diff)
Monolithic PowerPC kernel, new include
Diffstat (limited to 'sys/arch/powerpc/include/endian.h')
-rw-r--r--sys/arch/powerpc/include/endian.h64
1 files changed, 30 insertions, 34 deletions
diff --git a/sys/arch/powerpc/include/endian.h b/sys/arch/powerpc/include/endian.h
index b8e1eaaacc7..979a90f125d 100644
--- a/sys/arch/powerpc/include/endian.h
+++ b/sys/arch/powerpc/include/endian.h
@@ -1,11 +1,8 @@
-/* $OpenBSD: endian.h,v 1.7 1997/06/25 12:41:43 grr Exp $ */
-/* $NetBSD: endian.h,v 1.2 1996/10/13 03:16:41 christos Exp $ */
+/* $OpenBSD: endian.h,v 1.8 1997/10/13 10:53:43 pefo Exp $ */
-/*-
- * Copyright (C) 1995 Wolfgang Solfrank.
- * Copyright (C) 1995 TooLs GmbH.
- * All rights reserved.
- *
+/*
+ * Copyright (c) 1997 Per Fogelstrom
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -16,24 +13,27 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by TooLs GmbH.
- * 4. The name of TooLs GmbH may not be used to endorse or promote products
+ * This product includes software developed under OpenBSD by
+ * Per Fogelstrom, Opsycon AB, Sweden.
+ * 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
*/
-#ifndef _PPC_ENDIAN_H_
-#define _PPC_ENDIAN_H_
+#ifndef _MACHINE_ENDIAN_H_
+#define _MACHINE_ENDIAN_H_
#ifndef _POSIX_SOURCE
@@ -41,14 +41,13 @@
#define _QUAD_LOWWORD 1
/*
- * Definitions for byte order, according to byte significance from low
- * address to high.
+ * Byte order definition. Byte numbers given in increasing address order.
*/
-#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
-#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
+#define LITTLE_ENDIAN 1234 /* LSB first: i386, NS32K */
+#define BIG_ENDIAN 4321 /* MSB first: M68K */
#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
-#define BYTE_ORDER BIG_ENDIAN /* for now */
+#define BYTE_ORDER BIG_ENDIAN
#include <sys/cdefs.h>
@@ -63,14 +62,11 @@ u_int16_t ntohs __P((u_int16_t));
__END_DECLS
/*
- * Macros for network/external number representation conversion.
+ * Macros for network/external number representation conversion where
+ * network/external is defined to be in BIG_ENDIAN byte order.
*
- * The way this works is that HTONS(x) modifies x and *can't* be used as
- * and rvalue i.e. foo=HTONS(bar) is wrong. Likewise x=htons(x) should
- * never be used where HTONS(x) will serve i.e. foo=htons(foo) is wrong.
- * Failing to observe these rule will result in code that appears to work
- * and probably does work, but generates gcc warnings on architectures
- * where the macros are used to optimize away an unneeded conversion.
+ * *NOTE* That the macros are supposed to work on the arrgument (x) and
+ * thus should *NOT* be used in assignments such as 'foo=HTONS(bar)'.
*/
#if BYTE_ORDER == BIG_ENDIAN && !defined(lint)
#define ntohl(x) (x)
@@ -92,4 +88,4 @@ __END_DECLS
#endif
#endif /* _POSIX_SOURCE */
-#endif /* _PPC_ENDIAN_H_ */
+#endif /* _MACHINE_ENDIAN_H_ */