]> git.proxmox.com Git - mirror_spl-debian.git/blame - include/sys/isa_defs.h
New upstream version 0.7.11
[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)
34ee731f 32#define __x86_64
6a585c61 33#endif
34
35#if !defined(__amd64)
34ee731f 36#define __amd64
6a585c61 37#endif
38
39#if !defined(__x86)
34ee731f 40#define __x86
6a585c61 41#endif
42
43#if !defined(_LP64)
34ee731f 44#define _LP64
6a585c61 45#endif
46
34ee731f 47#define _ALIGNMENT_REQUIRED 1
ec06701b
AX
48
49
6a585c61 50/* i386 arch specific defines */
51#elif defined(__i386) || defined(__i386__)
52
53#if !defined(__i386)
34ee731f 54#define __i386
6a585c61 55#endif
56
57#if !defined(__x86)
34ee731f 58#define __x86
6a585c61 59#endif
60
61#if !defined(_ILP32)
34ee731f 62#define _ILP32
6a585c61 63#endif
64
34ee731f 65#define _ALIGNMENT_REQUIRED 0
ec06701b 66
37319315 67/* powerpc (ppc64) arch specific defines */
879bbbc7 68#elif defined(__powerpc) || defined(__powerpc__) || defined(__powerpc64__)
37319315
BB
69
70#if !defined(__powerpc)
34ee731f 71#define __powerpc
37319315
BB
72#endif
73
74#if !defined(__powerpc__)
34ee731f 75#define __powerpc__
37319315
BB
76#endif
77
879bbbc7 78#if defined(__powerpc64__)
37319315 79#if !defined(_LP64)
34ee731f 80#define _LP64
37319315 81#endif
879bbbc7
AX
82#else
83#if !defined(_ILP32)
34ee731f 84#define _ILP32
879bbbc7
AX
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 */
34ee731f 92#define _ALIGNMENT_REQUIRED 1
ec06701b 93
cb75844e 94/* arm arch specific defines */
9e4fb5c2 95#elif defined(__arm) || defined(__arm__) || defined(__aarch64__)
cb75844e
JL
96
97#if !defined(__arm)
34ee731f 98#define __arm
cb75844e
JL
99#endif
100
101#if !defined(__arm__)
34ee731f 102#define __arm__
cb75844e
JL
103#endif
104
879bbbc7
AX
105#if defined(__aarch64__)
106#if !defined(_LP64)
34ee731f 107#define _LP64
879bbbc7
AX
108#endif
109#else
110#if !defined(_ILP32)
34ee731f 111#define _ILP32
879bbbc7
AX
112#endif
113#endif
114
9e4fb5c2 115#if defined(__ARMEL__) || defined(__AARCH64EL__)
34ee731f 116#define _LITTLE_ENDIAN
cb75844e 117#else
34ee731f 118#define _BIG_ENDIAN
cb75844e
JL
119#endif
120
ec06701b
AX
121/*
122 * Illumos doesn't define _ALIGNMENT_REQUIRED for ARM, so default to 1
123 * out of paranoia.
124 */
34ee731f 125#define _ALIGNMENT_REQUIRED 1
ec06701b 126
33a20369
LG
127/* sparc arch specific defines */
128#elif defined(__sparc) || defined(__sparc__)
129
130#if !defined(__sparc)
34ee731f 131#define __sparc
33a20369
LG
132#endif
133
134#if !defined(__sparc__)
34ee731f 135#define __sparc__
33a20369
LG
136#endif
137
879bbbc7
AX
138#if defined(__arch64__)
139#if !defined(_LP64)
34ee731f 140#define _LP64
879bbbc7
AX
141#endif
142#else
143#if !defined(_ILP32)
34ee731f 144#define _ILP32
33a20369 145#endif
33a20369
LG
146#endif
147
34ee731f
AX
148#define _BIG_ENDIAN
149#define _SUNOS_VTOC_16
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 */
34ee731f 170#define _ALIGNMENT_REQUIRED 1
ec06701b 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 */
34ee731f 193#define _ALIGNMENT_REQUIRED 1
ec06701b 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
b97c7791
MZ
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
6a585c61 221#if defined(__LITTLE_ENDIAN) && !defined(_LITTLE_ENDIAN)
34ee731f 222#define _LITTLE_ENDIAN __LITTLE_ENDIAN
6a585c61 223#endif
224
225#if defined(__BIG_ENDIAN) && !defined(_BIG_ENDIAN)
34ee731f 226#define _BIG_ENDIAN __BIG_ENDIAN
6a585c61 227#endif
228
229#if defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN)
b11b08ed
BB
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"
6a585c61 235#endif
236
4a4295b2 237#endif /* _SPL_ISA_DEFS_H */