]> git.proxmox.com Git - mirror_spl.git/blob - include/sys/isa_defs.h
Add a little paranoia here to ensure endianess is set correctly.
[mirror_spl.git] / include / sys / isa_defs.h
1 #ifndef _SPL_ISA_DEFS_H
2 #define _SPL_ISA_DEFS_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 /* x86_64 arch specific defines */
9 #if defined(__x86_64) || defined(__x86_64__)
10
11 #if !defined(__x86_64)
12 #define __x86_64
13 #endif
14
15 #if !defined(__amd64)
16 #define __amd64
17 #endif
18
19 #if !defined(__x86)
20 #define __x86
21 #endif
22
23 #if !defined(_LP64)
24 #define _LP64
25 #endif
26
27 /* i386 arch specific defines */
28 #elif defined(__i386) || defined(__i386__)
29
30 #if !defined(__i386)
31 #define __i386
32 #endif
33
34 #if !defined(__x86)
35 #define __x86
36 #endif
37
38 #if !defined(_ILP32)
39 #define _ILP32
40 #endif
41
42 /* powerpc (ppc64) arch specific defines */
43 #elif defined(__powerpc) || defined(__powerpc__)
44
45 #if !defined(__powerpc)
46 #define __powerpc
47 #endif
48
49 #if !defined(__powerpc__)
50 #define __powerpc__
51 #endif
52
53 #if !defined(_LP64)
54 #define _LP64
55 #endif
56
57 #else /* Currently only x86_64, i386, and powerpc arches supported */
58 #error "Unsupported ISA type"
59 #endif
60
61 #if defined(_ILP32) && defined(_LP64)
62 #error "Both _ILP32 and _LP64 are defined"
63 #endif
64
65 #include <sys/byteorder.h>
66
67 #if defined(__LITTLE_ENDIAN) && !defined(_LITTLE_ENDIAN)
68 #define _LITTLE_ENDIAN __LITTLE_ENDIAN
69 #endif
70
71 #if defined(__BIG_ENDIAN) && !defined(_BIG_ENDIAN)
72 #define _BIG_ENDIAN __BIG_ENDIAN
73 #endif
74
75 #if defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN)
76 #error "Both _LITTLE_ENDIAN and _BIG_ENDIAN are defined"
77 #endif
78
79 #if !defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
80 #error "Neither _LITTLE_ENDIAN or _BIG_ENDIAN are defined"
81 #endif
82
83 #ifdef __cplusplus
84 }
85 #endif
86
87 #endif /* _SPL_ISA_DEFS_H */