]>
Commit | Line | Data |
---|---|---|
716154c5 BB |
1 | /*****************************************************************************\ |
2 | * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. | |
3 | * Copyright (C) 2007 The Regents of the University of California. | |
4 | * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). | |
5 | * Written by Brian Behlendorf <behlendorf1@llnl.gov>. | |
6 | * UCRL-CODE-235197 | |
7 | * | |
8 | * This file is part of the SPL, Solaris Porting Layer. | |
3d6af2dd | 9 | * For details, see <http://zfsonlinux.org/>. |
716154c5 BB |
10 | * |
11 | * The SPL is free software; you can redistribute it and/or modify it | |
12 | * under the terms of the GNU General Public License as published by the | |
13 | * Free Software Foundation; either version 2 of the License, or (at your | |
14 | * option) any later version. | |
15 | * | |
16 | * The SPL is distributed in the hope that it will be useful, but WITHOUT | |
17 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
18 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
19 | * for more details. | |
20 | * | |
21 | * You should have received a copy of the GNU General Public License along | |
22 | * with the SPL. If not, see <http://www.gnu.org/licenses/>. | |
23 | \*****************************************************************************/ | |
24 | ||
4a4295b2 | 25 | #ifndef _SPL_ISA_DEFS_H |
26 | #define _SPL_ISA_DEFS_H | |
dbb484ec | 27 | |
6a585c61 | 28 | /* x86_64 arch specific defines */ |
29 | #if defined(__x86_64) || defined(__x86_64__) | |
30 | ||
31 | #if !defined(__x86_64) | |
32 | #define __x86_64 | |
33 | #endif | |
34 | ||
35 | #if !defined(__amd64) | |
36 | #define __amd64 | |
37 | #endif | |
38 | ||
39 | #if !defined(__x86) | |
40 | #define __x86 | |
41 | #endif | |
42 | ||
43 | #if !defined(_LP64) | |
44 | #define _LP64 | |
45 | #endif | |
46 | ||
47 | /* i386 arch specific defines */ | |
48 | #elif defined(__i386) || defined(__i386__) | |
49 | ||
50 | #if !defined(__i386) | |
51 | #define __i386 | |
52 | #endif | |
53 | ||
54 | #if !defined(__x86) | |
55 | #define __x86 | |
56 | #endif | |
57 | ||
58 | #if !defined(_ILP32) | |
59 | #define _ILP32 | |
60 | #endif | |
61 | ||
37319315 | 62 | /* powerpc (ppc64) arch specific defines */ |
879bbbc7 | 63 | #elif defined(__powerpc) || defined(__powerpc__) || defined(__powerpc64__) |
37319315 BB |
64 | |
65 | #if !defined(__powerpc) | |
66 | #define __powerpc | |
67 | #endif | |
68 | ||
69 | #if !defined(__powerpc__) | |
70 | #define __powerpc__ | |
71 | #endif | |
72 | ||
879bbbc7 | 73 | #if defined(__powerpc64__) |
37319315 BB |
74 | #if !defined(_LP64) |
75 | #define _LP64 | |
76 | #endif | |
879bbbc7 AX |
77 | #else |
78 | #if !defined(_ILP32) | |
79 | #define _ILP32 | |
80 | #endif | |
81 | #endif | |
37319315 | 82 | |
cb75844e | 83 | /* arm arch specific defines */ |
9e4fb5c2 | 84 | #elif defined(__arm) || defined(__arm__) || defined(__aarch64__) |
cb75844e JL |
85 | |
86 | #if !defined(__arm) | |
87 | #define __arm | |
88 | #endif | |
89 | ||
90 | #if !defined(__arm__) | |
91 | #define __arm__ | |
92 | #endif | |
93 | ||
879bbbc7 AX |
94 | #if defined(__aarch64__) |
95 | #if !defined(_LP64) | |
96 | #define _LP64 | |
97 | #endif | |
98 | #else | |
99 | #if !defined(_ILP32) | |
100 | #define _ILP32 | |
101 | #endif | |
102 | #endif | |
103 | ||
9e4fb5c2 | 104 | #if defined(__ARMEL__) || defined(__AARCH64EL__) |
cb75844e JL |
105 | #define _LITTLE_ENDIAN |
106 | #else | |
107 | #define _BIG_ENDIAN | |
108 | #endif | |
109 | ||
33a20369 LG |
110 | /* sparc arch specific defines */ |
111 | #elif defined(__sparc) || defined(__sparc__) | |
112 | ||
113 | #if !defined(__sparc) | |
114 | #define __sparc | |
115 | #endif | |
116 | ||
117 | #if !defined(__sparc__) | |
118 | #define __sparc__ | |
119 | #endif | |
120 | ||
879bbbc7 AX |
121 | #if defined(__arch64__) |
122 | #if !defined(_LP64) | |
123 | #define _LP64 | |
124 | #endif | |
125 | #else | |
126 | #if !defined(_ILP32) | |
127 | #define _ILP32 | |
33a20369 | 128 | #endif |
33a20369 LG |
129 | #endif |
130 | ||
131 | #define _BIG_ENDIAN | |
132 | #define _SUNOS_VTOC_16 | |
133 | ||
0480cc58 AX |
134 | /* s390 arch specific defines */ |
135 | #elif defined(__s390__) | |
136 | #if defined(__s390x__) | |
137 | #if !defined(_LP64) | |
138 | #define _LP64 | |
139 | #endif | |
140 | #else | |
141 | #if !defined(_ILP32) | |
142 | #define _ILP32 | |
143 | #endif | |
144 | #endif | |
145 | ||
146 | #define _BIG_ENDIAN | |
147 | ||
148 | #else /* Currently x86_64, i386, arm, powerpc, s390, and sparc are supported */ | |
6a585c61 | 149 | #error "Unsupported ISA type" |
150 | #endif | |
151 | ||
152 | #if defined(_ILP32) && defined(_LP64) | |
153 | #error "Both _ILP32 and _LP64 are defined" | |
154 | #endif | |
155 | ||
879bbbc7 AX |
156 | #if !defined(_ILP32) && !defined(_LP64) |
157 | #error "Neither _ILP32 or _LP64 are defined" | |
158 | #endif | |
159 | ||
6a585c61 | 160 | #include <sys/byteorder.h> |
161 | ||
162 | #if defined(__LITTLE_ENDIAN) && !defined(_LITTLE_ENDIAN) | |
163 | #define _LITTLE_ENDIAN __LITTLE_ENDIAN | |
164 | #endif | |
165 | ||
166 | #if defined(__BIG_ENDIAN) && !defined(_BIG_ENDIAN) | |
167 | #define _BIG_ENDIAN __BIG_ENDIAN | |
168 | #endif | |
169 | ||
170 | #if defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN) | |
b11b08ed BB |
171 | #error "Both _LITTLE_ENDIAN and _BIG_ENDIAN are defined" |
172 | #endif | |
173 | ||
174 | #if !defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) | |
175 | #error "Neither _LITTLE_ENDIAN or _BIG_ENDIAN are defined" | |
6a585c61 | 176 | #endif |
177 | ||
4a4295b2 | 178 | #endif /* _SPL_ISA_DEFS_H */ |