X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=include%2Furcu%2Farch.h;fp=include%2Furcu%2Farch.h;h=fdbec3da5cc07da407203709408038cd129dac33;hp=0000000000000000000000000000000000000000;hb=0b1e236d1711f4f9076f73a093ece05aca00eca4;hpb=c0d1e7df9c367292aaea72acc6f52d1db051c9c0 diff --git a/include/urcu/arch.h b/include/urcu/arch.h new file mode 100644 index 0000000..fdbec3d --- /dev/null +++ b/include/urcu/arch.h @@ -0,0 +1,157 @@ +/* + * urcu/arch.h + * + * Copyright (c) 2020 Michael Jeanson + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef _URCU_ARCH_H +#define _URCU_ARCH_H + +/* + * Architecture detection using compiler defines. + * + * The following defines are used internally for architecture specific code. + * + * URCU_ARCH_X86 : All x86 variants 32 and 64 bits + * URCU_ARCH_I386 : Specific to the i386 + * URCU_ARCH_AMD64 : All 64 bits x86 variants + * URCU_ARCH_K1OM : Specific to the Xeon Phi / MIC + * + * URCU_ARCH_PPC : All PowerPC variants 32 and 64 bits + * URCU_ARCH_PPC64 : Specific to 64 bits variants + * + * URCU_ARCH_S390 : All IBM s390 / s390x variants + * + * URCU_ARCH_SPARC64 : All Sun SPARC variants + * + * URCU_ARCH_ALPHA : All DEC Alpha variants + * URCU_ARCH_IA64 : All Intel Itanium variants + * URCU_ARCH_ARM : All ARM 32 bits variants + * URCU_ARCH_AARCH64 : All ARM 64 bits variants + * URCU_ARCH_MIPS : All MIPS variants + * URCU_ARCH_NIOS2 : All Intel / Altera NIOS II variants + * URCU_ARCH_TILE : All Tilera TILE variants + * URCU_ARCH_HPPA : All HP PA-RISC variants + * URCU_ARCH_M68K : All Motorola 68000 variants + * URCU_ARCH_RISCV : All RISC-V variants + */ +#if (defined(__i386__) || defined(__i386)) + +#define URCU_ARCH_X86 1 +#define URCU_ARCH_I386 1 +#include + +#elif (defined(__i486__) || defined(__i586__) || defined(__i686__)) + +#define URCU_ARCH_X86 1 +#include + +#elif (defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64)) + +#define URCU_ARCH_X86 1 +#define URCU_ARCH_AMD64 1 +#include + +#elif (defined(__INTEL_OFFLOAD) || defined(__TARGET_ARCH_MIC) || defined(__MIC__)) + +#define URCU_ARCH_X86 1 +#define URCU_ARCH_AMD64 1 +#define URCU_ARCH_K1OM 1 +#include + +#elif (defined(__powerpc__) || defined(__powerpc) || defined(__ppc__)) + +#define URCU_ARCH_PPC 1 +#include + +#elif (defined(__powerpc64__) || defined(__ppc64__)) + +#define URCU_ARCH_PPC 1 +#define URCU_ARCH_PPC64 1 +#include + +#elif (defined(__s390__) || defined(__s390x__) || defined(__zarch__)) + +#define URCU_ARCH_S390 1 +#include + +#elif (defined(__sparc__) || defined(__sparc) || defined(__sparc64__)) + +#define URCU_ARCH_SPARC64 1 +#include + +#elif (defined(__alpha__) || defined(__alpha)) + +#define URCU_ARCH_ALPHA 1 +#include + +#elif (defined(__ia64__) || defined(__ia64)) + +#define URCU_ARCH_IA64 1 +#include + +#elif (defined(__arm__) || defined(__arm)) + +#define URCU_ARCH_ARM 1 +#include + +#elif defined(__aarch64__) + +#define URCU_ARCH_AARCH64 1 +#include + +#elif (defined(__mips__) || defined(__mips)) + +#define URCU_ARCH_MIPS 1 +#include + +#elif (defined(__nios2__) || defined(__nios2)) + +#define URCU_ARCH_NIOS2 1 +#include + +#elif defined(__tilegx__) +/* + * URCU has only been tested on the TileGx architecture. For other Tile* + * architectures, please run the tests first and report the results to the + * maintainer so that proper support can be added. + */ + +#define URCU_ARCH_TILE 1 +#include + +#elif (defined(__hppa__) || defined(__HPPA__) || defined(__hppa)) + +#define URCU_ARCH_HPPA 1 +#include + +#elif defined(__m68k__) + +#define URCU_ARCH_M68K 1 +#include + +#elif defined(__riscv) + +#define URCU_ARCH_RISCV 1 +#include + +#else +#error "Cannot build: unrecognized architecture, see ." +#endif + + +#endif /* _URCU_ARCH_H */