diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2014-07-12 16:25:10 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2014-07-12 16:25:10 +0000 |
commit | 2039f6b74df84ee50091647629f3c65b57371135 (patch) | |
tree | 076e09339c1066da837771e8393ddab7ce9ff891 /sys/arch/sparc64 | |
parent | 30586300cf458635b5a017a2f2e7c7345538d628 (diff) |
Tackle the endian.h mess. Make it so that:
* you can #include <sys/endian.h> instead of <machine/endian.h>,
and ditto <endian.h> (fixes code that pulls in <sys/endian.h> first)
* those will always export the symbols that POSIX specified for
<endian.h>, including the new {be,le}{16,32,64}toh() set. c.f.
http://austingroupbugs.net/view.php?id=162
if __BSD_VISIBLE then you also get the symbols that our <machine/endian.h>
currently exports (ntohs, NTOHS, dlg's bemtoh*, etc)
* when doing POSIX compiles (not __BSD_VISIBLE), then <netinet/in.h> and
<arpa/inet.h> will *stop* exporting the extra symbols like BYTE_ORDER
and betoh*
ok deraadt@
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r-- | sys/arch/sparc64/include/endian.h | 26 |
1 files changed, 14 insertions, 12 deletions
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_ */ |