diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2011-01-16 12:12:32 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-01-17 09:39:16 +0100 |
commit | be4146161b5316f4e7fb51c5a3c9ac0e5622c42d (patch) | |
tree | 2e3149c7f604232bbf8f99e71ca3712978d14a67 /include/asm-generic | |
parent | f68dc4080440563d1dd69c8cd87c7566e60855fa (diff) | |
download | barebox-be4146161b5316f4e7fb51c5a3c9ac0e5622c42d.tar.gz barebox-be4146161b5316f4e7fb51c5a3c9ac0e5622c42d.tar.xz |
import swab.h arch implementation form linux v2.3.37
this will avoid __bswapsi2 issue see with gcc 4.5.1
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/asm-generic')
-rw-r--r-- | include/asm-generic/bitsperlong.h | 32 | ||||
-rw-r--r-- | include/asm-generic/swab.h | 18 |
2 files changed, 50 insertions, 0 deletions
diff --git a/include/asm-generic/bitsperlong.h b/include/asm-generic/bitsperlong.h new file mode 100644 index 0000000000..4ae54e07de --- /dev/null +++ b/include/asm-generic/bitsperlong.h @@ -0,0 +1,32 @@ +#ifndef __ASM_GENERIC_BITS_PER_LONG +#define __ASM_GENERIC_BITS_PER_LONG + +/* + * There seems to be no way of detecting this automatically from user + * space, so 64 bit architectures should override this in their + * bitsperlong.h. In particular, an architecture that supports + * both 32 and 64 bit user space must not rely on CONFIG_64BIT + * to decide it, but rather check a compiler provided macro. + */ +#ifndef __BITS_PER_LONG +#define __BITS_PER_LONG 32 +#endif + +#ifdef __KERNEL__ + +#ifdef CONFIG_64BIT +#define BITS_PER_LONG 64 +#else +#define BITS_PER_LONG 32 +#endif /* CONFIG_64BIT */ + +/* + * FIXME: The check currently breaks x86-64 build, so it's + * temporarily disabled. Please fix x86-64 and reenable + */ +#if 0 && BITS_PER_LONG != __BITS_PER_LONG +#error Inconsistent word size. Check asm/bitsperlong.h +#endif + +#endif /* __KERNEL__ */ +#endif /* __ASM_GENERIC_BITS_PER_LONG */ diff --git a/include/asm-generic/swab.h b/include/asm-generic/swab.h new file mode 100644 index 0000000000..a8e9029d9e --- /dev/null +++ b/include/asm-generic/swab.h @@ -0,0 +1,18 @@ +#ifndef _ASM_GENERIC_SWAB_H +#define _ASM_GENERIC_SWAB_H + +#include <asm/bitsperlong.h> + +/* + * 32 bit architectures typically (but not always) want to + * set __SWAB_64_THRU_32__. In user space, this is only + * valid if the compiler supports 64 bit data types. + */ + +#if __BITS_PER_LONG == 32 +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) +#define __SWAB_64_THRU_32__ +#endif +#endif + +#endif /* _ASM_GENERIC_SWAB_H */ |