forked from skristiansson/linux
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
asm-generic: introduce asm/bitsperlong.h
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>
- Loading branch information
Showing
33 changed files
with
145 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef __ASM_ALPHA_BITSPERLONG_H | ||
#define __ASM_ALPHA_BITSPERLONG_H | ||
|
||
#define __BITS_PER_LONG 64 | ||
|
||
#include <asm-generic/bitsperlong.h> | ||
|
||
#endif /* __ASM_ALPHA_BITSPERLONG_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <asm-generic/bitsperlong.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <asm-generic/bitsperlong.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <asm-generic/bitsperlong.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <asm-generic/bitsperlong.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <asm-generic/bitsperlong.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <asm-generic/bitsperlong.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef __ASM_IA64_BITSPERLONG_H | ||
#define __ASM_IA64_BITSPERLONG_H | ||
|
||
#define __BITS_PER_LONG 64 | ||
|
||
#include <asm-generic/bitsperlong.h> | ||
|
||
#endif /* __ASM_IA64_BITSPERLONG_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <asm-generic/bitsperlong.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <asm-generic/bitsperlong.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <asm-generic/bitsperlong.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef __ASM_MIPS_BITSPERLONG_H | ||
#define __ASM_MIPS_BITSPERLONG_H | ||
|
||
#define __BITS_PER_LONG _MIPS_SZLONG | ||
|
||
#include <asm-generic/bitsperlong.h> | ||
|
||
#endif /* __ASM_MIPS_BITSPERLONG_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <asm-generic/bitsperlong.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifndef __ASM_PARISC_BITSPERLONG_H | ||
#define __ASM_PARISC_BITSPERLONG_H | ||
|
||
/* | ||
* using CONFIG_* outside of __KERNEL__ is wrong, | ||
* __LP64__ was also removed from headers, so what | ||
* is the right approach on parisc? | ||
* -arnd | ||
*/ | ||
#if (defined(__KERNEL__) && defined(CONFIG_64BIT)) || defined (__LP64__) | ||
#define __BITS_PER_LONG 64 | ||
#define SHIFT_PER_LONG 6 | ||
#else | ||
#define __BITS_PER_LONG 32 | ||
#define SHIFT_PER_LONG 5 | ||
#endif | ||
|
||
#include <asm-generic/bitsperlong.h> | ||
|
||
#endif /* __ASM_PARISC_BITSPERLONG_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef __ASM_POWERPC_BITSPERLONG_H | ||
#define __ASM_POWERPC_BITSPERLONG_H | ||
|
||
#if defined(__powerpc64__) | ||
# define __BITS_PER_LONG 64 | ||
#else | ||
# define __BITS_PER_LONG 32 | ||
#endif | ||
|
||
#include <asm-generic/bitsperlong.h> | ||
|
||
#endif /* __ASM_POWERPC_BITSPERLONG_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef __ASM_S390_BITSPERLONG_H | ||
#define __ASM_S390_BITSPERLONG_H | ||
|
||
#ifndef __s390x__ | ||
#define __BITS_PER_LONG 32 | ||
#else | ||
#define __BITS_PER_LONG 64 | ||
#endif | ||
|
||
#include <asm-generic/bitsperlong.h> | ||
|
||
#endif /* __ASM_S390_BITSPERLONG_H */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <asm-generic/bitsperlong.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef __ASM_ALPHA_BITSPERLONG_H | ||
#define __ASM_ALPHA_BITSPERLONG_H | ||
|
||
#if defined(__sparc__) && defined(__arch64__) | ||
#define __BITS_PER_LONG 64 | ||
#else | ||
#define __BITS_PER_LONG 32 | ||
#endif | ||
|
||
#include <asm-generic/bitsperlong.h> | ||
|
||
#endif /* __ASM_ALPHA_BITSPERLONG_H */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef __ASM_X86_BITSPERLONG_H | ||
#define __ASM_X86_BITSPERLONG_H | ||
|
||
#ifdef __x86_64__ | ||
# define __BITS_PER_LONG 64 | ||
#else | ||
# define __BITS_PER_LONG 32 | ||
#endif | ||
|
||
#include <asm-generic/bitsperlong.h> | ||
|
||
#endif /* __ASM_X86_BITSPERLONG_H */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <asm-generic/bitsperlong.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
header-y += bitsperlong.h | ||
header-y += errno-base.h | ||
header-y += errno.h | ||
header-y += fcntl.h | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters