Commit | Line | Data |
---|---|---|
d3d3857f MJ |
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 | ||
6aca0125 JW |
6 | #ifndef _URCU_ARCH_ARM_H |
7 | #define _URCU_ARCH_ARM_H | |
fdbddd0b PM |
8 | |
9 | /* | |
6aca0125 | 10 | * arch_arm.h: trivial definitions for the ARM architecture. |
fdbddd0b PM |
11 | */ |
12 | ||
13 | #include <urcu/compiler.h> | |
14 | #include <urcu/config.h> | |
999991c6 | 15 | #include <urcu/syscall-compat.h> |
fdbddd0b PM |
16 | |
17 | #ifdef __cplusplus | |
18 | extern "C" { | |
67ecffc0 | 19 | #endif |
fdbddd0b | 20 | |
9260f372 MJ |
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 | ||
7fe7e9f3 MD |
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") | |
9260f372 MJ |
43 | |
44 | #endif /* URCU_ARCH_ARMV7 */ | |
fdbddd0b PM |
45 | |
46 | #include <stdlib.h> | |
47 | #include <sys/time.h> | |
48 | ||
da5b715a | 49 | /* |
84f4ccb4 MD |
50 | * On Linux, define the membarrier system call number if not yet available in |
51 | * the system headers. | |
da5b715a | 52 | */ |
84f4ccb4 | 53 | #if (defined(__linux__) && !defined(__NR_membarrier)) |
da5b715a MD |
54 | #define __NR_membarrier 389 |
55 | #endif | |
56 | ||
3f0dd283 MJ |
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 | ||
39c2747c MJ |
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 | ||
67ecffc0 | 79 | #ifdef __cplusplus |
fdbddd0b PM |
80 | } |
81 | #endif | |
82 | ||
1b9119f8 | 83 | #include <urcu/arch/generic.h> |
fdbddd0b | 84 | |
6aca0125 | 85 | #endif /* _URCU_ARCH_ARM_H */ |