File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 8
8
#ifndef MAIN_H
9
9
#define MAIN_H
10
10
11
+ #include <assert.h>
11
12
#include <stdbool.h>
12
13
13
14
extern int param ;
@@ -95,6 +96,8 @@ extern unsigned ring_size;
95
96
#define cpu_relax () asm ("rep; nop" ::: "memory")
96
97
#elif defined(__s390x__ )
97
98
#define cpu_relax () barrier()
99
+ #elif defined(__aarch64__ )
100
+ #define cpu_relax () asm ("yield" ::: "memory")
98
101
#else
99
102
#define cpu_relax () assert(0)
100
103
#endif
@@ -112,6 +115,8 @@ static inline void busy_wait(void)
112
115
113
116
#if defined(__x86_64__ ) || defined(__i386__ )
114
117
#define smp_mb () asm volatile("lock; addl $0,-132(%%rsp)" ::: "memory", "cc")
118
+ #elif defined(__aarch64__ )
119
+ #define smp_mb () asm volatile("dmb ish" ::: "memory")
115
120
#else
116
121
/*
117
122
* Not using __ATOMIC_SEQ_CST since gcc docs say they are only synchronized
@@ -136,10 +141,16 @@ static inline void busy_wait(void)
136
141
137
142
#if defined(__i386__ ) || defined(__x86_64__ ) || defined(__s390x__ )
138
143
#define smp_wmb () barrier()
144
+ #elif defined(__aarch64__ )
145
+ #define smp_wmb () asm volatile("dmb ishst" ::: "memory")
139
146
#else
140
147
#define smp_wmb () smp_release()
141
148
#endif
142
149
150
+ #ifndef __always_inline
151
+ #define __always_inline inline __attribute__((always_inline))
152
+ #endif
153
+
143
154
static __always_inline
144
155
void __read_once_size (const volatile void * p , void * res , int size )
145
156
{
You can’t perform that action at this time.
0 commit comments