]> git.proxmox.com Git - mirror_zfs.git/blob - lib/libspl/include/sys/isa_defs.h
3bca5cf02e1b898f909867ad3edba4370d27075d
[mirror_zfs.git] / lib / libspl / include / sys / isa_defs.h
1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #ifndef _SYS_ISA_DEFS_H
28 #define _SYS_ISA_DEFS_H
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 /* x86_64 arch specific defines */
35 #if defined(__x86_64) || defined(__x86_64__)
36
37 #if !defined(__x86_64)
38 #define __x86_64
39 #endif
40
41 #if !defined(__amd64)
42 #define __amd64
43 #endif
44
45 #if !defined(__x86)
46 #define __x86
47 #endif
48
49 #if !defined(_LP64)
50 #define _LP64
51 #endif
52
53 #if !defined(_LITTLE_ENDIAN)
54 #define _LITTLE_ENDIAN
55 #endif
56
57 #define _SUNOS_VTOC_16
58
59 /* i386 arch specific defines */
60 #elif defined(__i386) || defined(__i386__)
61
62 #if !defined(__i386)
63 #define __i386
64 #endif
65
66 #if !defined(__x86)
67 #define __x86
68 #endif
69
70 #if !defined(_ILP32)
71 #define _ILP32
72 #endif
73
74 #if !defined(_LITTLE_ENDIAN)
75 #define _LITTLE_ENDIAN
76 #endif
77
78 #define _SUNOS_VTOC_16
79
80 /* powerpc arch specific defines */
81 #elif defined(__powerpc) || defined(__powerpc__) || defined(__powerpc64__)
82
83 #if !defined(__powerpc)
84 #define __powerpc
85 #endif
86
87 #if !defined(__powerpc__)
88 #define __powerpc__
89 #endif
90
91 #if defined(__powerpc64__)
92 #if !defined(_LP64)
93 #define _LP64
94 #endif
95 #else
96 #if !defined(_ILP32)
97 #define _ILP32
98 #endif
99 #endif
100
101 #if !defined(_BIG_ENDIAN)
102 #define _BIG_ENDIAN
103 #endif
104
105 #define _SUNOS_VTOC_16
106
107 /* arm arch specific defines */
108 #elif defined(__arm) || defined(__arm__) || defined(__aarch64__)
109
110 #if !defined(__arm)
111 #define __arm
112 #endif
113
114 #if !defined(__arm__)
115 #define __arm__
116 #endif
117
118 #if defined(__aarch64__)
119 #if !defined(_LP64)
120 #define _LP64
121 #endif
122 #else
123 #if !defined(_ILP32)
124 #define _ILP32
125 #endif
126 #endif
127
128 #if defined(__ARMEL__) || defined(__AARCH64EL__)
129 #define _LITTLE_ENDIAN
130 #else
131 #define _BIG_ENDIAN
132 #endif
133
134 #define _SUNOS_VTOC_16
135
136 /* sparc arch specific defines */
137 #elif defined(__sparc) || defined(__sparc__) || defined(__sparc64__)
138
139 #if !defined(__sparc)
140 #define __sparc
141 #endif
142
143 #if !defined(__sparc__)
144 #define __sparc__
145 #endif
146
147 #define _BIG_ENDIAN
148 #define _SUNOS_VTOC_16
149
150 #if defined(__sparc64__)
151 #if !defined(_LP64)
152 #define _LP64
153 #endif
154 #else
155 #if !defined(_ILP32)
156 #define _ILP32
157 #endif
158 #endif
159
160 /* s390 arch specific defines */
161 #elif defined(__s390__)
162 #if defined(__s390x__)
163 #if !defined(_LP64)
164 #define _LP64
165 #endif
166 #else
167 #if !defined(_ILP32)
168 #define _ILP32
169 #endif
170 #endif
171
172 #define _BIG_ENDIAN
173 #define _SUNOS_VTOC_16
174
175 /* MIPS arch specific defines */
176 #elif defined(__mips__)
177
178 #if defined(__MIPSEB__)
179 #define _BIG_ENDIAN
180 #elif defined(__MIPSEL__)
181 #define _LITTLE_ENDIAN
182 #else
183 #error MIPS no endian specified
184 #endif
185
186 #ifndef _LP64
187 #define _ILP32
188 #endif
189
190 #define _SUNOS_VTOC_16
191
192 #else
193 /*
194 * Currently supported:
195 * x86_64, i386, arm, powerpc, s390, sparc, and mips
196 */
197 #error "Unsupported ISA type"
198 #endif
199
200 #if defined(_ILP32) && defined(_LP64)
201 #error "Both _ILP32 and _LP64 are defined"
202 #endif
203
204 #if !defined(_ILP32) && !defined(_LP64)
205 #error "Neither _ILP32 or _LP64 are defined"
206 #endif
207
208 #if defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN)
209 #error "Both _LITTLE_ENDIAN and _BIG_ENDIAN are defined"
210 #endif
211
212 #if !defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
213 #error "Neither _LITTLE_ENDIAN nor _BIG_ENDIAN are defined"
214 #endif
215
216 #ifdef __cplusplus
217 }
218 #endif
219
220 #endif /* _SYS_ISA_DEFS_H */