xref: /openbmc/linux/arch/arm/include/uapi/asm/types.h (revision 6f52b16c)
16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2ed79c9d3SNicolas Dichtel #ifndef _UAPI_ASM_TYPES_H
3ed79c9d3SNicolas Dichtel #define _UAPI_ASM_TYPES_H
4ed79c9d3SNicolas Dichtel 
5ed79c9d3SNicolas Dichtel #include <asm-generic/int-ll64.h>
6ed79c9d3SNicolas Dichtel 
7ed79c9d3SNicolas Dichtel /*
8ed79c9d3SNicolas Dichtel  * The C99 types uintXX_t that are usually defined in 'stdint.h' are not as
9ed79c9d3SNicolas Dichtel  * unambiguous on ARM as you would expect. For the types below, there is a
10ed79c9d3SNicolas Dichtel  * difference on ARM between GCC built for bare metal ARM, GCC built for glibc
11ed79c9d3SNicolas Dichtel  * and the kernel itself, which results in build errors if you try to build with
12ed79c9d3SNicolas Dichtel  * -ffreestanding and include 'stdint.h' (such as when you include 'arm_neon.h'
13ed79c9d3SNicolas Dichtel  * in order to use NEON intrinsics)
14ed79c9d3SNicolas Dichtel  *
15ed79c9d3SNicolas Dichtel  * As the typedefs for these types in 'stdint.h' are based on builtin defines
16ed79c9d3SNicolas Dichtel  * supplied by GCC, we can tweak these to align with the kernel's idea of those
17ed79c9d3SNicolas Dichtel  * types, so 'linux/types.h' and 'stdint.h' can be safely included from the same
18ed79c9d3SNicolas Dichtel  * source file (provided that -ffreestanding is used).
19ed79c9d3SNicolas Dichtel  *
20ed79c9d3SNicolas Dichtel  *                    int32_t         uint32_t               uintptr_t
21ed79c9d3SNicolas Dichtel  * bare metal GCC     long            unsigned long          unsigned int
22ed79c9d3SNicolas Dichtel  * glibc GCC          int             unsigned int           unsigned int
23ed79c9d3SNicolas Dichtel  * kernel             int             unsigned int           unsigned long
24ed79c9d3SNicolas Dichtel  */
25ed79c9d3SNicolas Dichtel 
26ed79c9d3SNicolas Dichtel #ifdef __INT32_TYPE__
27ed79c9d3SNicolas Dichtel #undef __INT32_TYPE__
28ed79c9d3SNicolas Dichtel #define __INT32_TYPE__		int
29ed79c9d3SNicolas Dichtel #endif
30ed79c9d3SNicolas Dichtel 
31ed79c9d3SNicolas Dichtel #ifdef __UINT32_TYPE__
32ed79c9d3SNicolas Dichtel #undef __UINT32_TYPE__
33ed79c9d3SNicolas Dichtel #define __UINT32_TYPE__	unsigned int
34ed79c9d3SNicolas Dichtel #endif
35ed79c9d3SNicolas Dichtel 
36ed79c9d3SNicolas Dichtel #ifdef __UINTPTR_TYPE__
37ed79c9d3SNicolas Dichtel #undef __UINTPTR_TYPE__
38ed79c9d3SNicolas Dichtel #define __UINTPTR_TYPE__	unsigned long
39ed79c9d3SNicolas Dichtel #endif
40ed79c9d3SNicolas Dichtel 
41ed79c9d3SNicolas Dichtel #endif /* _UAPI_ASM_TYPES_H */
42