1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
|
// SPDX-FileCopyrightText: 2020 Michael Jeanson <mjeanson@efficios.com>
//
// SPDX-License-Identifier: LGPL-2.1-or-later
#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_ARMV7 : All ARMv7 ISA 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
* URCU_ARCH_LOONGARCH : All LoongArch variants
*/
#if (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 <urcu/arch/x86.h>
#elif (defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64))
#define URCU_ARCH_X86 1
#define URCU_ARCH_AMD64 1
#include <urcu/arch/x86.h>
#elif (defined(__i386__) || defined(__i386))
#define URCU_ARCH_X86 1
/*
* URCU_ARCH_X86_NO_CAS enables a compat layer that will detect the presence of
* the cmpxchg instructions at runtime and provide a compat mode based on a
* pthread mutex when it isn't.
*
* __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 was introduced in GCC 4.3 and Clang 3.3,
* building with older compilers will result in the compat layer always being
* used on x86-32.
*/
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
#define URCU_ARCH_X86_NO_CAS 1
/* For backwards compat */
#define URCU_ARCH_I386 1
#endif
#include <urcu/arch/x86.h>
#elif (defined(__powerpc64__) || defined(__ppc64__))
#define URCU_ARCH_PPC 1
#define URCU_ARCH_PPC64 1
#include <urcu/arch/ppc.h>
#elif (defined(__powerpc__) || defined(__powerpc) || defined(__ppc__))
#define URCU_ARCH_PPC 1
#include <urcu/arch/ppc.h>
#elif (defined(__s390__) || defined(__s390x__) || defined(__zarch__))
#define URCU_ARCH_S390 1
#include <urcu/arch/s390.h>
#elif (defined(__sparc__) || defined(__sparc) || defined(__sparc64__))
#define URCU_ARCH_SPARC64 1
#include <urcu/arch/sparc64.h>
#elif (defined(__alpha__) || defined(__alpha))
#define URCU_ARCH_ALPHA 1
#include <urcu/arch/alpha.h>
#elif (defined(__ia64__) || defined(__ia64))
#define URCU_ARCH_IA64 1
#include <urcu/arch/ia64.h>
#elif (defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7__))
#define URCU_ARCH_ARMV7 1
#define URCU_ARCH_ARM 1
#include <urcu/arch/arm.h>
#elif (defined(__arm__) || defined(__arm))
#define URCU_ARCH_ARM 1
#include <urcu/arch/arm.h>
#elif defined(__aarch64__)
#define URCU_ARCH_AARCH64 1
#include <urcu/arch/aarch64.h>
#elif (defined(__mips__) || defined(__mips))
#define URCU_ARCH_MIPS 1
#include <urcu/arch/mips.h>
#elif (defined(__nios2__) || defined(__nios2))
#define URCU_ARCH_NIOS2 1
#include <urcu/arch/nios2.h>
#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 <urcu/arch/tile.h>
#elif (defined(__hppa__) || defined(__HPPA__) || defined(__hppa))
#define URCU_ARCH_HPPA 1
#include <urcu/arch/hppa.h>
#elif defined(__m68k__)
#define URCU_ARCH_M68K 1
#include <urcu/arch/m68k.h>
#elif defined(__riscv)
#define URCU_ARCH_RISCV 1
#include <urcu/arch/riscv.h>
#elif defined(__loongarch__)
#define URCU_ARCH_LOONGARCH 1
#include <urcu/arch/loongarch.h>
#elif defined(__sh__)
#define URCU_ARCH_SUPERH 1
#include <urcu/arch/superh.h>
#else
#error "Cannot build: unrecognized architecture, see <urcu/arch.h>."
#endif
#ifdef CONFIG_RCU_EMIT_LEGACY_MB
# define cmm_emit_legacy_smp_mb() cmm_smp_mb()
#else
# define cmm_emit_legacy_smp_mb() do { } while (0)
#endif
#endif /* _URCU_ARCH_H */
|