| 1 | // SPDX-FileCopyrightText: 2010 Paul E. McKenney, IBM Corporation. |
| 2 | // SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 3 | // |
| 4 | // SPDX-License-Identifier: LGPL-2.1-or-later |
| 5 | |
| 6 | #ifndef _URCU_ARCH_ARM_H |
| 7 | #define _URCU_ARCH_ARM_H |
| 8 | |
| 9 | /* |
| 10 | * arch_arm.h: trivial definitions for the ARM architecture. |
| 11 | */ |
| 12 | |
| 13 | #include <urcu/compiler.h> |
| 14 | #include <urcu/config.h> |
| 15 | #include <urcu/syscall-compat.h> |
| 16 | |
| 17 | #ifdef __cplusplus |
| 18 | extern "C" { |
| 19 | #endif |
| 20 | |
| 21 | /* |
| 22 | * Using DMB is faster than the builtin __sync_synchronize and this instruction is |
| 23 | * part of the baseline ARMv7 ISA. |
| 24 | */ |
| 25 | #ifdef URCU_ARCH_ARMV7 |
| 26 | |
| 27 | /* For backwards compat. */ |
| 28 | #define CONFIG_RCU_ARM_HAVE_DMB 1 |
| 29 | |
| 30 | /* |
| 31 | * Issues full system DMB operation. |
| 32 | */ |
| 33 | #define cmm_mb() __asm__ __volatile__ ("dmb sy":::"memory") |
| 34 | #define cmm_rmb() __asm__ __volatile__ ("dmb sy":::"memory") |
| 35 | #define cmm_wmb() __asm__ __volatile__ ("dmb sy":::"memory") |
| 36 | |
| 37 | /* |
| 38 | * Issues DMB operation only to the inner shareable domain. |
| 39 | */ |
| 40 | #define cmm_smp_mb() __asm__ __volatile__ ("dmb ish":::"memory") |
| 41 | #define cmm_smp_rmb() __asm__ __volatile__ ("dmb ish":::"memory") |
| 42 | #define cmm_smp_wmb() __asm__ __volatile__ ("dmb ish":::"memory") |
| 43 | |
| 44 | #endif /* URCU_ARCH_ARMV7 */ |
| 45 | |
| 46 | #include <stdlib.h> |
| 47 | #include <sys/time.h> |
| 48 | |
| 49 | /* |
| 50 | * On Linux, define the membarrier system call number if not yet available in |
| 51 | * the system headers. |
| 52 | */ |
| 53 | #if (defined(__linux__) && !defined(__NR_membarrier)) |
| 54 | #define __NR_membarrier 389 |
| 55 | #endif |
| 56 | |
| 57 | /* |
| 58 | * Error out for compilers with known bugs. |
| 59 | */ |
| 60 | |
| 61 | /* |
| 62 | * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58854 |
| 63 | */ |
| 64 | #ifdef URCU_GCC_VERSION |
| 65 | # if URCU_GCC_VERSION >= 40800 && URCU_GCC_VERSION <= 40802 |
| 66 | # error Your gcc version produces clobbered frame accesses |
| 67 | # endif |
| 68 | #endif |
| 69 | |
| 70 | /* |
| 71 | * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42263 |
| 72 | */ |
| 73 | #ifdef URCU_GCC_VERSION |
| 74 | # if URCU_GCC_VERSION >= 40400 && URCU_GCC_VERSION <= 40402 |
| 75 | # error Your gcc version has a non-functional __sync_synchronize() |
| 76 | # endif |
| 77 | #endif |
| 78 | |
| 79 | #ifdef __cplusplus |
| 80 | } |
| 81 | #endif |
| 82 | |
| 83 | #include <urcu/arch/generic.h> |
| 84 | |
| 85 | #endif /* _URCU_ARCH_ARM_H */ |