mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-23 09:56:00 +00:00
c31ae4bb4a
This provides a reliable way for asm-generic/types.h and other files to find out if it is running on a 32 or 64 bit platform. We cannot use CONFIG_64BIT for this in headers that are included from user space because CONFIG symbols are not available there. We also cannot do it inside of asm/types.h because some headers need the word size but cannot include types.h. The solution is to introduce a new header <asm/bitsperlong.h> that defines both __BITS_PER_LONG for user space and BITS_PER_LONG for usage in the kernel. The asm-generic version falls back to 32 bit unless the architecture overrides it, which I did for all 64 bit platforms. Signed-off-by: Remis Lima Baima <remis.developer@googlemail.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
33 lines
874 B
C
33 lines
874 B
C
#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 */
|