]> git.proxmox.com Git - mirror_spl-debian.git/blob - include/sys/isa_defs.h
02136c5966ec8404fe8be1c6790415fa238395d1
[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://github.com/behlendorf/spl/>.
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 /* 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
62 /* powerpc (ppc64) arch specific defines */
63 #elif defined(__powerpc) || defined(__powerpc__)
64
65 #if !defined(__powerpc)
66 #define __powerpc
67 #endif
68
69 #if !defined(__powerpc__)
70 #define __powerpc__
71 #endif
72
73 #if !defined(_LP64)
74 #define _LP64
75 #endif
76
77 /* arm arch specific defines */
78 #elif defined(__arm) || defined(__arm__)
79
80 #if !defined(__arm)
81 #define __arm
82 #endif
83
84 #if !defined(__arm__)
85 #define __arm__
86 #endif
87
88 #if defined(__ARMEL__)
89 #define _LITTLE_ENDIAN
90 #else
91 #define _BIG_ENDIAN
92 #endif
93
94 #else /* Currently only x86_64, i386, arm, and powerpc arches supported */
95 #error "Unsupported ISA type"
96 #endif
97
98 #if defined(_ILP32) && defined(_LP64)
99 #error "Both _ILP32 and _LP64 are defined"
100 #endif
101
102 #include <sys/byteorder.h>
103
104 #if defined(__LITTLE_ENDIAN) && !defined(_LITTLE_ENDIAN)
105 #define _LITTLE_ENDIAN __LITTLE_ENDIAN
106 #endif
107
108 #if defined(__BIG_ENDIAN) && !defined(_BIG_ENDIAN)
109 #define _BIG_ENDIAN __BIG_ENDIAN
110 #endif
111
112 #if defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN)
113 #error "Both _LITTLE_ENDIAN and _BIG_ENDIAN are defined"
114 #endif
115
116 #if !defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
117 #error "Neither _LITTLE_ENDIAN or _BIG_ENDIAN are defined"
118 #endif
119
120 #endif /* _SPL_ISA_DEFS_H */