]> git.proxmox.com Git - mirror_spl-debian.git/blob - include/sys/isa_defs.h
New upstream version 0.7.11
[mirror_spl-debian.git] / include / sys / isa_defs.h
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.
9 * For details, see <http://zfsonlinux.org/>.
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
25 #ifndef _SPL_ISA_DEFS_H
26 #define _SPL_ISA_DEFS_H
27
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 #define _ALIGNMENT_REQUIRED 1
48
49
50 /* i386 arch specific defines */
51 #elif defined(__i386) || defined(__i386__)
52
53 #if !defined(__i386)
54 #define __i386
55 #endif
56
57 #if !defined(__x86)
58 #define __x86
59 #endif
60
61 #if !defined(_ILP32)
62 #define _ILP32
63 #endif
64
65 #define _ALIGNMENT_REQUIRED 0
66
67 /* powerpc (ppc64) arch specific defines */
68 #elif defined(__powerpc) || defined(__powerpc__) || defined(__powerpc64__)
69
70 #if !defined(__powerpc)
71 #define __powerpc
72 #endif
73
74 #if !defined(__powerpc__)
75 #define __powerpc__
76 #endif
77
78 #if defined(__powerpc64__)
79 #if !defined(_LP64)
80 #define _LP64
81 #endif
82 #else
83 #if !defined(_ILP32)
84 #define _ILP32
85 #endif
86 #endif
87
88 /*
89 * Illumos doesn't define _ALIGNMENT_REQUIRED for PPC, so default to 1
90 * out of paranoia.
91 */
92 #define _ALIGNMENT_REQUIRED 1
93
94 /* arm arch specific defines */
95 #elif defined(__arm) || defined(__arm__) || defined(__aarch64__)
96
97 #if !defined(__arm)
98 #define __arm
99 #endif
100
101 #if !defined(__arm__)
102 #define __arm__
103 #endif
104
105 #if defined(__aarch64__)
106 #if !defined(_LP64)
107 #define _LP64
108 #endif
109 #else
110 #if !defined(_ILP32)
111 #define _ILP32
112 #endif
113 #endif
114
115 #if defined(__ARMEL__) || defined(__AARCH64EL__)
116 #define _LITTLE_ENDIAN
117 #else
118 #define _BIG_ENDIAN
119 #endif
120
121 /*
122 * Illumos doesn't define _ALIGNMENT_REQUIRED for ARM, so default to 1
123 * out of paranoia.
124 */
125 #define _ALIGNMENT_REQUIRED 1
126
127 /* sparc arch specific defines */
128 #elif defined(__sparc) || defined(__sparc__)
129
130 #if !defined(__sparc)
131 #define __sparc
132 #endif
133
134 #if !defined(__sparc__)
135 #define __sparc__
136 #endif
137
138 #if defined(__arch64__)
139 #if !defined(_LP64)
140 #define _LP64
141 #endif
142 #else
143 #if !defined(_ILP32)
144 #define _ILP32
145 #endif
146 #endif
147
148 #define _BIG_ENDIAN
149 #define _SUNOS_VTOC_16
150 #define _ALIGNMENT_REQUIRED 1
151
152 /* s390 arch specific defines */
153 #elif defined(__s390__)
154 #if defined(__s390x__)
155 #if !defined(_LP64)
156 #define _LP64
157 #endif
158 #else
159 #if !defined(_ILP32)
160 #define _ILP32
161 #endif
162 #endif
163
164 #define _BIG_ENDIAN
165
166 /*
167 * Illumos doesn't define _ALIGNMENT_REQUIRED for s390, so default to 1
168 * out of paranoia.
169 */
170 #define _ALIGNMENT_REQUIRED 1
171
172 /* MIPS arch specific defines */
173 #elif defined(__mips__)
174
175 #if defined(__MIPSEB__)
176 #define _BIG_ENDIAN
177 #elif defined(__MIPSEL__)
178 #define _LITTLE_ENDIAN
179 #else
180 #error MIPS no endian specified
181 #endif
182
183 #ifndef _LP64
184 #define _ILP32
185 #endif
186
187 #define _SUNOS_VTOC_16
188
189 /*
190 * Illumos doesn't define _ALIGNMENT_REQUIRED for MIPS, so default to 1
191 * out of paranoia.
192 */
193 #define _ALIGNMENT_REQUIRED 1
194
195 #else
196 /*
197 * Currently supported:
198 * x86_64, i386, arm, powerpc, s390, sparc, and mips
199 */
200 #error "Unsupported ISA type"
201 #endif
202
203 #if defined(_ILP32) && defined(_LP64)
204 #error "Both _ILP32 and _LP64 are defined"
205 #endif
206
207 #if !defined(_ILP32) && !defined(_LP64)
208 #error "Neither _ILP32 or _LP64 are defined"
209 #endif
210
211 #include <sys/byteorder.h>
212
213 /*
214 * CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS will be defined by the Linux
215 * kernel for architectures which support efficient unaligned access.
216 */
217 #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
218 #define HAVE_EFFICIENT_UNALIGNED_ACCESS
219 #endif
220
221 #if defined(__LITTLE_ENDIAN) && !defined(_LITTLE_ENDIAN)
222 #define _LITTLE_ENDIAN __LITTLE_ENDIAN
223 #endif
224
225 #if defined(__BIG_ENDIAN) && !defined(_BIG_ENDIAN)
226 #define _BIG_ENDIAN __BIG_ENDIAN
227 #endif
228
229 #if defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN)
230 #error "Both _LITTLE_ENDIAN and _BIG_ENDIAN are defined"
231 #endif
232
233 #if !defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
234 #error "Neither _LITTLE_ENDIAN or _BIG_ENDIAN are defined"
235 #endif
236
237 #endif /* _SPL_ISA_DEFS_H */