Commit | Line | Data |
---|---|---|
0b1e236d MJ |
1 | /* |
2 | * urcu/arch.h | |
3 | * | |
4 | * Copyright (c) 2020 Michael Jeanson <michael.jeanson@efficios.com> | |
5 | * | |
6 | * This library is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU Lesser General Public | |
8 | * License as published by the Free Software Foundation; either | |
9 | * version 2.1 of the License, or (at your option) any later version. | |
10 | * | |
11 | * This library is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | * Lesser General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU Lesser General Public | |
17 | * License along with this library; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
19 | */ | |
20 | ||
21 | #ifndef _URCU_ARCH_H | |
22 | #define _URCU_ARCH_H | |
23 | ||
24 | /* | |
25 | * Architecture detection using compiler defines. | |
26 | * | |
27 | * The following defines are used internally for architecture specific code. | |
28 | * | |
29 | * URCU_ARCH_X86 : All x86 variants 32 and 64 bits | |
30 | * URCU_ARCH_I386 : Specific to the i386 | |
31 | * URCU_ARCH_AMD64 : All 64 bits x86 variants | |
32 | * URCU_ARCH_K1OM : Specific to the Xeon Phi / MIC | |
33 | * | |
34 | * URCU_ARCH_PPC : All PowerPC variants 32 and 64 bits | |
35 | * URCU_ARCH_PPC64 : Specific to 64 bits variants | |
36 | * | |
37 | * URCU_ARCH_S390 : All IBM s390 / s390x variants | |
38 | * | |
39 | * URCU_ARCH_SPARC64 : All Sun SPARC variants | |
40 | * | |
41 | * URCU_ARCH_ALPHA : All DEC Alpha variants | |
42 | * URCU_ARCH_IA64 : All Intel Itanium variants | |
43 | * URCU_ARCH_ARM : All ARM 32 bits variants | |
9260f372 | 44 | * URCU_ARCH_ARMV7 : All ARMv7 ISA variants |
0b1e236d MJ |
45 | * URCU_ARCH_AARCH64 : All ARM 64 bits variants |
46 | * URCU_ARCH_MIPS : All MIPS variants | |
47 | * URCU_ARCH_NIOS2 : All Intel / Altera NIOS II variants | |
48 | * URCU_ARCH_TILE : All Tilera TILE variants | |
49 | * URCU_ARCH_HPPA : All HP PA-RISC variants | |
50 | * URCU_ARCH_M68K : All Motorola 68000 variants | |
51 | * URCU_ARCH_RISCV : All RISC-V variants | |
52 | */ | |
c966839e MJ |
53 | |
54 | #if (defined(__INTEL_OFFLOAD) || defined(__TARGET_ARCH_MIC) || defined(__MIC__)) | |
0b1e236d MJ |
55 | |
56 | #define URCU_ARCH_X86 1 | |
c966839e MJ |
57 | #define URCU_ARCH_AMD64 1 |
58 | #define URCU_ARCH_K1OM 1 | |
0b1e236d MJ |
59 | #include <urcu/arch/x86.h> |
60 | ||
c966839e | 61 | #elif (defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64)) |
0b1e236d MJ |
62 | |
63 | #define URCU_ARCH_X86 1 | |
c966839e | 64 | #define URCU_ARCH_AMD64 1 |
0b1e236d MJ |
65 | #include <urcu/arch/x86.h> |
66 | ||
c966839e | 67 | #elif (defined(__i486__) || defined(__i586__) || defined(__i686__)) |
0b1e236d MJ |
68 | |
69 | #define URCU_ARCH_X86 1 | |
0b1e236d MJ |
70 | #include <urcu/arch/x86.h> |
71 | ||
c966839e | 72 | #elif (defined(__i386__) || defined(__i386)) |
0b1e236d MJ |
73 | |
74 | #define URCU_ARCH_X86 1 | |
c966839e | 75 | #define URCU_ARCH_I386 1 |
0b1e236d MJ |
76 | #include <urcu/arch/x86.h> |
77 | ||
c966839e | 78 | #elif (defined(__powerpc64__) || defined(__ppc64__)) |
0b1e236d MJ |
79 | |
80 | #define URCU_ARCH_PPC 1 | |
c966839e | 81 | #define URCU_ARCH_PPC64 1 |
0b1e236d MJ |
82 | #include <urcu/arch/ppc.h> |
83 | ||
c966839e | 84 | #elif (defined(__powerpc__) || defined(__powerpc) || defined(__ppc__)) |
0b1e236d MJ |
85 | |
86 | #define URCU_ARCH_PPC 1 | |
0b1e236d MJ |
87 | #include <urcu/arch/ppc.h> |
88 | ||
89 | #elif (defined(__s390__) || defined(__s390x__) || defined(__zarch__)) | |
90 | ||
91 | #define URCU_ARCH_S390 1 | |
92 | #include <urcu/arch/s390.h> | |
93 | ||
94 | #elif (defined(__sparc__) || defined(__sparc) || defined(__sparc64__)) | |
95 | ||
96 | #define URCU_ARCH_SPARC64 1 | |
97 | #include <urcu/arch/sparc64.h> | |
98 | ||
99 | #elif (defined(__alpha__) || defined(__alpha)) | |
100 | ||
101 | #define URCU_ARCH_ALPHA 1 | |
102 | #include <urcu/arch/alpha.h> | |
103 | ||
104 | #elif (defined(__ia64__) || defined(__ia64)) | |
105 | ||
106 | #define URCU_ARCH_IA64 1 | |
107 | #include <urcu/arch/ia64.h> | |
108 | ||
9260f372 MJ |
109 | #elif (defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7__)) |
110 | ||
111 | #define URCU_ARCH_ARMV7 1 | |
112 | #define URCU_ARCH_ARM 1 | |
113 | #include <urcu/arch/arm.h> | |
114 | ||
0b1e236d MJ |
115 | #elif (defined(__arm__) || defined(__arm)) |
116 | ||
117 | #define URCU_ARCH_ARM 1 | |
118 | #include <urcu/arch/arm.h> | |
119 | ||
120 | #elif defined(__aarch64__) | |
121 | ||
122 | #define URCU_ARCH_AARCH64 1 | |
123 | #include <urcu/arch/aarch64.h> | |
124 | ||
125 | #elif (defined(__mips__) || defined(__mips)) | |
126 | ||
127 | #define URCU_ARCH_MIPS 1 | |
128 | #include <urcu/arch/mips.h> | |
129 | ||
130 | #elif (defined(__nios2__) || defined(__nios2)) | |
131 | ||
132 | #define URCU_ARCH_NIOS2 1 | |
133 | #include <urcu/arch/nios2.h> | |
134 | ||
135 | #elif defined(__tilegx__) | |
136 | /* | |
137 | * URCU has only been tested on the TileGx architecture. For other Tile* | |
138 | * architectures, please run the tests first and report the results to the | |
139 | * maintainer so that proper support can be added. | |
140 | */ | |
141 | ||
142 | #define URCU_ARCH_TILE 1 | |
143 | #include <urcu/arch/tile.h> | |
144 | ||
145 | #elif (defined(__hppa__) || defined(__HPPA__) || defined(__hppa)) | |
146 | ||
147 | #define URCU_ARCH_HPPA 1 | |
148 | #include <urcu/arch/hppa.h> | |
149 | ||
150 | #elif defined(__m68k__) | |
151 | ||
152 | #define URCU_ARCH_M68K 1 | |
153 | #include <urcu/arch/m68k.h> | |
154 | ||
155 | #elif defined(__riscv) | |
156 | ||
157 | #define URCU_ARCH_RISCV 1 | |
158 | #include <urcu/arch/riscv.h> | |
159 | ||
160 | #else | |
161 | #error "Cannot build: unrecognized architecture, see <urcu/arch.h>." | |
162 | #endif | |
163 | ||
164 | ||
165 | #endif /* _URCU_ARCH_H */ |