summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/alpha/include/endian.h8
-rw-r--r--sys/arch/amd64/include/endian.h13
-rw-r--r--sys/arch/arm/include/endian.h6
-rw-r--r--sys/arch/hppa/include/endian.h8
-rw-r--r--sys/arch/hppa64/include/endian.h8
-rw-r--r--sys/arch/i386/include/endian.h17
-rw-r--r--sys/arch/ia64/include/endian.h6
-rw-r--r--sys/arch/m88k/include/endian.h8
-rw-r--r--sys/arch/mips64/include/endian.h8
-rw-r--r--sys/arch/powerpc/include/endian.h7
-rw-r--r--sys/arch/sh/include/endian.h10
-rw-r--r--sys/arch/sparc/include/endian.h8
-rw-r--r--sys/arch/sparc64/include/endian.h26
-rw-r--r--sys/arch/vax/include/endian.h11
14 files changed, 88 insertions, 56 deletions
diff --git a/sys/arch/alpha/include/endian.h b/sys/arch/alpha/include/endian.h
index 5ebf5b94a44..216013160c2 100644
--- a/sys/arch/alpha/include/endian.h
+++ b/sys/arch/alpha/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.13 2011/03/11 15:17:08 pirofti Exp $ */
+/* $OpenBSD: endian.h,v 1.14 2014/07/12 16:25:08 guenther Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
@@ -28,8 +28,10 @@
#define _MACHINE_ENDIAN_H_
#define _BYTE_ORDER _LITTLE_ENDIAN
-#include <sys/endian.h>
-
#define __STRICT_ALIGNMENT
+#ifndef __FROM_SYS__ENDIAN
+#include <sys/endian.h>
+#endif
+
#endif /* _MACHINE_ENDIAN_H_ */
diff --git a/sys/arch/amd64/include/endian.h b/sys/arch/amd64/include/endian.h
index 7889a374f47..14c451e46f5 100644
--- a/sys/arch/amd64/include/endian.h
+++ b/sys/arch/amd64/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.5 2011/03/12 22:27:48 guenther Exp $ */
+/* $OpenBSD: endian.h,v 1.6 2014/07/12 16:25:08 guenther Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
@@ -30,32 +30,35 @@
#ifdef __GNUC__
#define __swap32md(x) __statement({ \
- u_int32_t __swap32md_x = (x); \
+ __uint32_t __swap32md_x = (x); \
\
__asm ("bswap %0" : "+r" (__swap32md_x)); \
__swap32md_x; \
})
#define __swap64md(x) __statement({ \
- u_int64_t __swap64md_x = (x); \
+ __uint64_t __swap64md_x = (x); \
\
__asm ("bswapq %0" : "+r" (__swap64md_x)); \
__swap64md_x; \
})
#define __swap16md(x) __statement({ \
- u_int16_t __swap16md_x = (x); \
+ __uint16_t __swap16md_x = (x); \
\
__asm ("rorw $8, %w0" : "+r" (__swap16md_x)); \
__swap16md_x; \
})
/* Tell sys/endian.h we have MD variants of the swap macros. */
-#define MD_SWAP
+#define __HAVE_MD_SWAP
#endif /* __GNUC__ */
#define _BYTE_ORDER _LITTLE_ENDIAN
+
+#ifndef __FROM_SYS__ENDIAN
#include <sys/endian.h>
+#endif
#endif /* _MACHINE_ENDIAN_H_ */
diff --git a/sys/arch/arm/include/endian.h b/sys/arch/arm/include/endian.h
index 1c370350a02..0c12941585a 100644
--- a/sys/arch/arm/include/endian.h
+++ b/sys/arch/arm/include/endian.h
@@ -1,10 +1,12 @@
-/* $OpenBSD: endian.h,v 1.6 2011/11/08 17:06:51 deraadt Exp $ */
+/* $OpenBSD: endian.h,v 1.7 2014/07/12 16:25:08 guenther Exp $ */
#ifndef _ARM_ENDIAN_H_
#define _ARM_ENDIAN_H_
#define _BYTE_ORDER _LITTLE_ENDIAN
#define __STRICT_ALIGNMENT
-#include <sys/endian.h>
+#ifndef __FROM_SYS__ENDIAN
+#include <sys/endian.h>
+#endif
#endif /* _ARM_ENDIAN_H_ */
diff --git a/sys/arch/hppa/include/endian.h b/sys/arch/hppa/include/endian.h
index 0b61d7e2790..b31fe08029a 100644
--- a/sys/arch/hppa/include/endian.h
+++ b/sys/arch/hppa/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.11 2011/03/11 15:17:08 pirofti Exp $ */
+/* $OpenBSD: endian.h,v 1.12 2014/07/12 16:25:08 guenther Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -30,8 +30,10 @@
#define _MACHINE_ENDIAN_H_
#define _BYTE_ORDER _BIG_ENDIAN
-#include <sys/endian.h>
-
#define __STRICT_ALIGNMENT
+#ifndef __FROM_SYS__ENDIAN
+#include <sys/endian.h>
+#endif
+
#endif /* !_MACHINE_ENDIAN_H_ */
diff --git a/sys/arch/hppa64/include/endian.h b/sys/arch/hppa64/include/endian.h
index e3eccb65cb3..d73001d137a 100644
--- a/sys/arch/hppa64/include/endian.h
+++ b/sys/arch/hppa64/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.3 2011/03/11 15:17:08 pirofti Exp $ */
+/* $OpenBSD: endian.h,v 1.4 2014/07/12 16:25:08 guenther Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -21,8 +21,10 @@
#define _MACHINE_ENDIAN_H_
#define _BYTE_ORDER _BIG_ENDIAN
-#include <sys/endian.h>
-
#define __STRICT_ALIGNMENT
+#ifndef __FROM_SYS__ENDIAN
+#include <sys/endian.h>
+#endif
+
#endif /* !_MACHINE_ENDIAN_H_ */
diff --git a/sys/arch/i386/include/endian.h b/sys/arch/i386/include/endian.h
index 817d6c6abb4..1f58500c862 100644
--- a/sys/arch/i386/include/endian.h
+++ b/sys/arch/i386/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.17 2011/03/12 04:03:04 guenther Exp $ */
+/* $OpenBSD: endian.h,v 1.18 2014/07/12 16:25:08 guenther Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
@@ -30,31 +30,34 @@
#ifdef __GNUC__
#define __swap32md(x) __statement({ \
- u_int32_t __swap32md_x = (x); \
+ __uint32_t __swap32md_x = (x); \
\
__asm ("bswap %0" : "+r" (__swap32md_x)); \
__swap32md_x; \
})
#define __swap64md(x) __statement({ \
- u_int64_t __swap64md_x = (x); \
+ __uint64_t __swap64md_x = (x); \
\
- (u_int64_t)__swap32md(__swap64md_x >> 32) | \
- (u_int64_t)__swap32md(__swap64md_x & 0xffffffff) << 32; \
+ (__uint64_t)__swap32md(__swap64md_x >> 32) | \
+ (__uint64_t)__swap32md(__swap64md_x & 0xffffffff) << 32; \
})
#define __swap16md(x) __statement({ \
- u_int16_t __swap16md_x = (x); \
+ __uint16_t __swap16md_x = (x); \
\
__asm ("rorw $8, %w0" : "+r" (__swap16md_x)); \
__swap16md_x; \
})
/* Tell sys/endian.h we have MD variants of the swap macros. */
-#define MD_SWAP
+#define __HAVE_MD_SWAP
#endif /* __GNUC__ */
#define _BYTE_ORDER _LITTLE_ENDIAN
+
+#ifndef __FROM_SYS__ENDIAN
#include <sys/endian.h>
+#endif
#endif /* _MACHINE_ENDIAN_H_ */
diff --git a/sys/arch/ia64/include/endian.h b/sys/arch/ia64/include/endian.h
index bb775dbe727..f40b1e25cc2 100644
--- a/sys/arch/ia64/include/endian.h
+++ b/sys/arch/ia64/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.1 2011/07/04 23:29:08 pirofti Exp $ */
+/* $OpenBSD: endian.h,v 1.2 2014/07/12 16:25:08 guenther Exp $ */
/*
* Written by Paul Irofti <pirofti@openbsd.org>. Public Domain.
@@ -7,9 +7,11 @@
#ifndef _MACHINE_ENDIAN_H_
#define _MACHINE_ENDIAN_H_
+#define _BYTE_ORDER _LITTLE_ENDIAN
#define __STRICT_ALIGNMENT
-#define _BYTE_ORDER _LITTLE_ENDIAN
+#ifndef __FROM_SYS__ENDIAN
#include <sys/endian.h>
+#endif
#endif /* _MACHINE_ENDIAN_H_ */
diff --git a/sys/arch/m88k/include/endian.h b/sys/arch/m88k/include/endian.h
index 0a2c32e80f0..3b5a4632ef9 100644
--- a/sys/arch/m88k/include/endian.h
+++ b/sys/arch/m88k/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.5 2011/03/23 16:54:35 pirofti Exp $ */
+/* $OpenBSD: endian.h,v 1.6 2014/07/12 16:25:08 guenther Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
@@ -28,9 +28,11 @@
#define _M88K_ENDIAN_H_
#define _BYTE_ORDER _BIG_ENDIAN
-#include <sys/endian.h>
-
#define __STRICT_ALIGNMENT
+#ifndef __FROM_SYS__ENDIAN
+#include <sys/endian.h>
+#endif
+
#endif /* _M88K_ENDIAN_H_ */
diff --git a/sys/arch/mips64/include/endian.h b/sys/arch/mips64/include/endian.h
index c8ecfde3bfc..3bc64bf92e0 100644
--- a/sys/arch/mips64/include/endian.h
+++ b/sys/arch/mips64/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.8 2014/03/11 19:45:27 guenther Exp $ */
+/* $OpenBSD: endian.h,v 1.9 2014/07/12 16:25:08 guenther Exp $ */
/*
* Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -40,8 +40,10 @@
#error "__MIPSEL__ or __MIPSEB__ must be defined to define BYTE_ORDER!!!"
#endif
-#include <sys/endian.h>
-
#define __STRICT_ALIGNMENT
+#ifndef __FROM_SYS__ENDIAN
+#include <sys/endian.h>
+#endif
+
#endif /* _MIPS64_ENDIAN_H_ */
diff --git a/sys/arch/powerpc/include/endian.h b/sys/arch/powerpc/include/endian.h
index f8376e3be02..d8e4c5eb38c 100644
--- a/sys/arch/powerpc/include/endian.h
+++ b/sys/arch/powerpc/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.19 2014/03/25 04:25:06 dlg Exp $ */
+/* $OpenBSD: endian.h,v 1.20 2014/07/12 16:25:09 guenther Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
@@ -90,11 +90,14 @@ __swapm64(volatile __uint64_t *m, __uint64_t v)
__swapm32(a, v);
}
-#define MD_SWAPIO
+#define __HAVE_MD_SWAPIO
#endif /* _KERNEL */
#undef _BIG_ENDIAN /* XXX - gcc may define _BIG_ENDIAN too */
#define _BYTE_ORDER _BIG_ENDIAN
+
+#ifndef __FROM_SYS__ENDIAN
#include <sys/endian.h>
+#endif
#endif /* _POWERPC_ENDIAN_H_ */
diff --git a/sys/arch/sh/include/endian.h b/sys/arch/sh/include/endian.h
index 689b168d2ab..daba001f12b 100644
--- a/sys/arch/sh/include/endian.h
+++ b/sys/arch/sh/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.4 2011/03/23 16:54:36 pirofti Exp $ */
+/* $OpenBSD: endian.h,v 1.5 2014/07/12 16:25:09 guenther Exp $ */
/* $NetBSD: endian.h,v 1.4 2000/03/17 00:09:25 mycroft Exp $ */
/* Written by Manuel Bouyer. Public domain */
@@ -27,7 +27,7 @@
rval; \
})
-#define MD_SWAP
+#define __HAVE_MD_SWAP
#endif /* __GNUC_ */
@@ -36,8 +36,10 @@
#else
#define _BYTE_ORDER _BIG_ENDIAN
#endif
-#include <sys/endian.h>
-
#define __STRICT_ALIGNMENT
+#ifndef __FROM_SYS__ENDIAN
+#include <sys/endian.h>
+#endif
+
#endif /* !_SH_ENDIAN_H_ */
diff --git a/sys/arch/sparc/include/endian.h b/sys/arch/sparc/include/endian.h
index 530925bf188..a57f05395a8 100644
--- a/sys/arch/sparc/include/endian.h
+++ b/sys/arch/sparc/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.13 2011/03/11 15:17:08 pirofti Exp $ */
+/* $OpenBSD: endian.h,v 1.14 2014/07/12 16:25:09 guenther Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
@@ -28,8 +28,10 @@
#define _MACHINE_ENDIAN_H_
#define _BYTE_ORDER _BIG_ENDIAN
-#include <sys/endian.h>
-
#define __STRICT_ALIGNMENT
+#ifndef __FROM_SYS__ENDIAN
+#include <sys/endian.h>
+#endif
+
#endif /* _MACHINE_ENDIAN_H_ */
diff --git a/sys/arch/sparc64/include/endian.h b/sys/arch/sparc64/include/endian.h
index 14d0ff09251..b2bb346d4ed 100644
--- a/sys/arch/sparc64/include/endian.h
+++ b/sys/arch/sparc64/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.5 2014/03/25 03:53:35 dlg Exp $ */
+/* $OpenBSD: endian.h,v 1.6 2014/07/12 16:25:09 guenther Exp $ */
#ifndef _MACHINE_ENDIAN_H_
#define _MACHINE_ENDIAN_H_
@@ -7,7 +7,7 @@
#ifdef _KERNEL
-#define ASI_P_L 0x88
+#define __ASI_P_L 0x88 /* == ASI_PRIMARY_LITTLE */
static inline __uint16_t
__mswap16(volatile __uint16_t *m)
@@ -16,7 +16,7 @@ __mswap16(volatile __uint16_t *m)
__asm("lduha [%1] %2, %0 ! %3"
: "=r" (v)
- : "r" (m), "n" (ASI_P_L), "m" (*m));
+ : "r" (m), "n" (__ASI_P_L), "m" (*m));
return (v);
}
@@ -28,7 +28,7 @@ __mswap32(volatile __uint32_t *m)
__asm("lduwa [%1] %2, %0 ! %3"
: "=r" (v)
- : "r" (m), "n" (ASI_P_L), "m" (*m));
+ : "r" (m), "n" (__ASI_P_L), "m" (*m));
return (v);
}
@@ -40,7 +40,7 @@ __mswap64(volatile __uint64_t *m)
__asm("ldxa [%1] %2, %0 ! %3"
: "=r" (v)
- : "r" (m), "n" (ASI_P_L), "m" (*m));
+ : "r" (m), "n" (__ASI_P_L), "m" (*m));
return (v);
}
@@ -50,7 +50,7 @@ __swapm16(volatile __uint16_t *m, __uint16_t v)
{
__asm("stha %1, [%2] %3 ! %0"
: "=m" (*m)
- : "r" (v), "r" (m), "n" (ASI_P_L));
+ : "r" (v), "r" (m), "n" (__ASI_P_L));
}
static inline void
@@ -58,7 +58,7 @@ __swapm32(volatile __uint32_t *m, __uint32_t v)
{
__asm("stwa %1, [%2] %3 ! %0"
: "=m" (*m)
- : "r" (v), "r" (m), "n" (ASI_P_L));
+ : "r" (v), "r" (m), "n" (__ASI_P_L));
}
static inline void
@@ -66,17 +66,19 @@ __swapm64(volatile __uint64_t *m, __uint64_t v)
{
__asm("stxa %1, [%2] %3 ! %0"
: "=m" (*m)
- : "r" (v), "r" (m), "n" (ASI_P_L));
+ : "r" (v), "r" (m), "n" (__ASI_P_L));
}
-#undef ASI_P_L
+#undef __ASI_P_L
-#define MD_SWAPIO
+#define __HAVE_MD_SWAPIO
#endif /* _KERNEL */
-#include <sys/endian.h>
-
#define __STRICT_ALIGNMENT
+#ifndef __FROM_SYS__ENDIAN
+#include <sys/endian.h>
+#endif
+
#endif /* _MACHINE_ENDIAN_H_ */
diff --git a/sys/arch/vax/include/endian.h b/sys/arch/vax/include/endian.h
index d3407e2a5d0..b8105016565 100644
--- a/sys/arch/vax/include/endian.h
+++ b/sys/arch/vax/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.16 2013/07/05 21:10:50 miod Exp $ */
+/* $OpenBSD: endian.h,v 1.17 2014/07/12 16:25:09 guenther Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
@@ -32,7 +32,7 @@
#define __swap64md __swap64gen
#define __swap32md(x) __statement({ \
- u_int32_t __swap32md_y, __swap32md_x = (x); \
+ __uint32_t __swap32md_y, __swap32md_x = (x); \
\
__asm ("rotl $-8, %1, %0; insv %0, $16, $8, %0; " \
"rotl $8, %1, %%r1; movb %%r1, %0" : \
@@ -41,7 +41,7 @@
})
#define __swap16md(x) __statement({ \
- u_int16_t __swap16md_y, __swap16md_x = (x); \
+ __uint16_t __swap16md_y, __swap16md_x = (x); \
\
__asm ("rotl $8, %1, %0; rotl $-8, %1, %%r1; movb %%r1, %0; " \
"movzwl %0, %0" : \
@@ -51,12 +51,15 @@
/* Tell sys/endian.h we have MD variants of the swap macros. */
#ifdef notyet
-#define MD_SWAP
+#define __HAVE_MD_SWAP
#endif
#endif /* __GNUC__ */
#define _BYTE_ORDER _LITTLE_ENDIAN
+
+#ifndef __FROM_SYS__ENDIAN
#include <sys/endian.h>
+#endif
#endif /* _MACHINE_ENDIAN_H_ */