]> git.proxmox.com Git - mirror_spl-debian.git/blame - include/sys/isa_defs.h
New upstream version 0.7.2
[mirror_spl-debian.git] / include / sys / isa_defs.h
CommitLineData
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
ec06701b
AX
47#define _ALIGNMENT_REQUIRED 1
48
49
6a585c61 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
ec06701b
AX
65#define _ALIGNMENT_REQUIRED 0
66
37319315 67/* powerpc (ppc64) arch specific defines */
879bbbc7 68#elif defined(__powerpc) || defined(__powerpc__) || defined(__powerpc64__)
37319315
BB
69
70#if !defined(__powerpc)
71#define __powerpc
72#endif
73
74#if !defined(__powerpc__)
75#define __powerpc__
76#endif
77
879bbbc7 78#if defined(__powerpc64__)
37319315
BB
79#if !defined(_LP64)
80#define _LP64
81#endif
879bbbc7
AX
82#else
83#if !defined(_ILP32)
84#define _ILP32
85#endif
86#endif
37319315 87
ec06701b
AX
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
cb75844e 94/* arm arch specific defines */
9e4fb5c2 95#elif defined(__arm) || defined(__arm__) || defined(__aarch64__)
cb75844e
JL
96
97#if !defined(__arm)
98#define __arm
99#endif
100
101#if !defined(__arm__)
102#define __arm__
103#endif
104
879bbbc7
AX
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
9e4fb5c2 115#if defined(__ARMEL__) || defined(__AARCH64EL__)
cb75844e
JL
116#define _LITTLE_ENDIAN
117#else
118#define _BIG_ENDIAN
119#endif
120
ec06701b
AX
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
33a20369
LG
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
879bbbc7
AX
138#if defined(__arch64__)
139#if !defined(_LP64)
140#define _LP64
141#endif
142#else
143#if !defined(_ILP32)
144#define _ILP32
33a20369 145#endif
33a20369
LG
146#endif
147
148#define _BIG_ENDIAN
149#define _SUNOS_VTOC_16
ec06701b 150#define _ALIGNMENT_REQUIRED 1
33a20369 151
0480cc58
AX
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
ec06701b
AX
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
0f836a62
AX
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
ec06701b
AX
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
0f836a62
AX
195#else
196/*
197 * Currently supported:
198 * x86_64, i386, arm, powerpc, s390, sparc, and mips
199 */
6a585c61 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
879bbbc7
AX
207#if !defined(_ILP32) && !defined(_LP64)
208#error "Neither _ILP32 or _LP64 are defined"
209#endif
210
6a585c61 211#include <sys/byteorder.h>
212
213#if defined(__LITTLE_ENDIAN) && !defined(_LITTLE_ENDIAN)
214#define _LITTLE_ENDIAN __LITTLE_ENDIAN
215#endif
216
217#if defined(__BIG_ENDIAN) && !defined(_BIG_ENDIAN)
218#define _BIG_ENDIAN __BIG_ENDIAN
219#endif
220
221#if defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN)
b11b08ed
BB
222#error "Both _LITTLE_ENDIAN and _BIG_ENDIAN are defined"
223#endif
224
225#if !defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
226#error "Neither _LITTLE_ENDIAN or _BIG_ENDIAN are defined"
6a585c61 227#endif
228
4a4295b2 229#endif /* _SPL_ISA_DEFS_H */