1 /* SPDX-License-Identifier: LGPL-2.1 OR MIT */
5 * (C) Copyright 2016-2018 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 * (C) Copyright 2018 - Will Deacon <will.deacon@arm.com>
10 * aarch64 -mbig-endian generates mixed endianness code vs data:
11 * little-endian code and big-endian data. Ensure the RSEQ_SIG signature
12 * matches code endianness.
14 #define RSEQ_SIG_CODE 0xd428bc00 /* BRK #0x45E0. */
17 #define RSEQ_SIG_DATA 0x00bc28d4 /* BRK #0x45E0. */
19 #define RSEQ_SIG_DATA RSEQ_SIG_CODE
22 #define RSEQ_SIG RSEQ_SIG_DATA
24 #define rseq_smp_mb() __asm__ __volatile__ ("dmb ish" ::: "memory")
25 #define rseq_smp_rmb() __asm__ __volatile__ ("dmb ishld" ::: "memory")
26 #define rseq_smp_wmb() __asm__ __volatile__ ("dmb ishst" ::: "memory")
28 #define rseq_smp_load_acquire(p) \
30 __typeof(*p) ____p1; \
31 switch (sizeof(*p)) { \
33 asm volatile ("ldarb %w0, %1" \
35 : "Q" (*p) : "memory"); \
38 asm volatile ("ldarh %w0, %1" \
39 : "=r" (*(__u16 *)p) \
40 : "Q" (*p) : "memory"); \
43 asm volatile ("ldar %w0, %1" \
44 : "=r" (*(__u32 *)p) \
45 : "Q" (*p) : "memory"); \
48 asm volatile ("ldar %0, %1" \
49 : "=r" (*(__u64 *)p) \
50 : "Q" (*p) : "memory"); \
56 #define rseq_smp_acquire__after_ctrl_dep() rseq_smp_rmb()
58 #define rseq_smp_store_release(p, v) \
60 switch (sizeof(*p)) { \
62 asm volatile ("stlrb %w1, %0" \
68 asm volatile ("stlrh %w1, %0" \
74 asm volatile ("stlr %w1, %0" \
80 asm volatile ("stlr %1, %0" \
88 #ifdef RSEQ_SKIP_FASTPATH
89 #include "rseq-skip.h"
90 #else /* !RSEQ_SKIP_FASTPATH */
92 #define RSEQ_ASM_TMP_REG32 "w15"
93 #define RSEQ_ASM_TMP_REG "x15"
94 #define RSEQ_ASM_TMP_REG_2 "x14"
96 #define __RSEQ_ASM_DEFINE_TABLE(label, version, flags, start_ip, \
97 post_commit_offset, abort_ip) \
98 " .pushsection __rseq_cs, \"aw\"\n" \
100 __rseq_str(label) ":\n" \
101 " .long " __rseq_str(version) ", " __rseq_str(flags) "\n" \
102 " .quad " __rseq_str(start_ip) ", " \
103 __rseq_str(post_commit_offset) ", " \
104 __rseq_str(abort_ip) "\n" \
106 " .pushsection __rseq_cs_ptr_array, \"aw\"\n" \
107 " .quad " __rseq_str(label) "b\n" \
110 #define RSEQ_ASM_DEFINE_TABLE(label, start_ip, post_commit_ip, abort_ip) \
111 __RSEQ_ASM_DEFINE_TABLE(label, 0x0, 0x0, start_ip, \
112 (post_commit_ip - start_ip), abort_ip)
115 * Exit points of a rseq critical section consist of all instructions outside
116 * of the critical section where a critical section can either branch to or
117 * reach through the normal course of its execution. The abort IP and the
118 * post-commit IP are already part of the __rseq_cs section and should not be
119 * explicitly defined as additional exit points. Knowing all exit points is
120 * useful to assist debuggers stepping over the critical section.
122 #define RSEQ_ASM_DEFINE_EXIT_POINT(start_ip, exit_ip) \
123 " .pushsection __rseq_exit_point_array, \"aw\"\n" \
124 " .quad " __rseq_str(start_ip) ", " __rseq_str(exit_ip) "\n" \
127 #define RSEQ_ASM_STORE_RSEQ_CS(label, cs_label, rseq_cs) \
129 " adrp " RSEQ_ASM_TMP_REG ", " __rseq_str(cs_label) "\n" \
130 " add " RSEQ_ASM_TMP_REG ", " RSEQ_ASM_TMP_REG \
131 ", :lo12:" __rseq_str(cs_label) "\n" \
132 " str " RSEQ_ASM_TMP_REG ", %[" __rseq_str(rseq_cs) "]\n" \
133 __rseq_str(label) ":\n"
135 #define RSEQ_ASM_DEFINE_ABORT(label, abort_label) \
137 " .inst " __rseq_str(RSEQ_SIG_CODE) "\n" \
138 __rseq_str(label) ":\n" \
139 " b %l[" __rseq_str(abort_label) "]\n" \
142 #define RSEQ_ASM_OP_STORE(value, var) \
143 " str %[" __rseq_str(value) "], %[" __rseq_str(var) "]\n"
145 #define RSEQ_ASM_OP_STORE_RELEASE(value, var) \
146 " stlr %[" __rseq_str(value) "], %[" __rseq_str(var) "]\n"
148 #define RSEQ_ASM_OP_FINAL_STORE(value, var, post_commit_label) \
149 RSEQ_ASM_OP_STORE(value, var) \
150 __rseq_str(post_commit_label) ":\n"
152 #define RSEQ_ASM_OP_FINAL_STORE_RELEASE(value, var, post_commit_label) \
153 RSEQ_ASM_OP_STORE_RELEASE(value, var) \
154 __rseq_str(post_commit_label) ":\n"
156 #define RSEQ_ASM_OP_CMPEQ(var, expect, label) \
157 " ldr " RSEQ_ASM_TMP_REG ", %[" __rseq_str(var) "]\n" \
158 " sub " RSEQ_ASM_TMP_REG ", " RSEQ_ASM_TMP_REG \
159 ", %[" __rseq_str(expect) "]\n" \
160 " cbnz " RSEQ_ASM_TMP_REG ", " __rseq_str(label) "\n"
162 #define RSEQ_ASM_OP_CMPEQ32(var, expect, label) \
163 " ldr " RSEQ_ASM_TMP_REG32 ", %[" __rseq_str(var) "]\n" \
164 " sub " RSEQ_ASM_TMP_REG32 ", " RSEQ_ASM_TMP_REG32 \
165 ", %w[" __rseq_str(expect) "]\n" \
166 " cbnz " RSEQ_ASM_TMP_REG32 ", " __rseq_str(label) "\n"
168 #define RSEQ_ASM_OP_CMPNE(var, expect, label) \
169 " ldr " RSEQ_ASM_TMP_REG ", %[" __rseq_str(var) "]\n" \
170 " sub " RSEQ_ASM_TMP_REG ", " RSEQ_ASM_TMP_REG \
171 ", %[" __rseq_str(expect) "]\n" \
172 " cbz " RSEQ_ASM_TMP_REG ", " __rseq_str(label) "\n"
174 #define RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, label) \
176 RSEQ_ASM_OP_CMPEQ32(current_cpu_id, cpu_id, label)
178 #define RSEQ_ASM_OP_R_LOAD(var) \
179 " ldr " RSEQ_ASM_TMP_REG ", %[" __rseq_str(var) "]\n"
181 #define RSEQ_ASM_OP_R_STORE(var) \
182 " str " RSEQ_ASM_TMP_REG ", %[" __rseq_str(var) "]\n"
184 #define RSEQ_ASM_OP_R_LOAD_OFF(offset) \
185 " ldr " RSEQ_ASM_TMP_REG ", [" RSEQ_ASM_TMP_REG \
186 ", %[" __rseq_str(offset) "]]\n"
188 #define RSEQ_ASM_OP_R_ADD(count) \
189 " add " RSEQ_ASM_TMP_REG ", " RSEQ_ASM_TMP_REG \
190 ", %[" __rseq_str(count) "]\n"
192 #define RSEQ_ASM_OP_R_FINAL_STORE(var, post_commit_label) \
193 " str " RSEQ_ASM_TMP_REG ", %[" __rseq_str(var) "]\n" \
194 __rseq_str(post_commit_label) ":\n"
196 #define RSEQ_ASM_OP_R_BAD_MEMCPY(dst, src, len) \
197 " cbz %[" __rseq_str(len) "], 333f\n" \
198 " mov " RSEQ_ASM_TMP_REG_2 ", %[" __rseq_str(len) "]\n" \
199 "222: sub " RSEQ_ASM_TMP_REG_2 ", " RSEQ_ASM_TMP_REG_2 ", #1\n" \
200 " ldrb " RSEQ_ASM_TMP_REG32 ", [%[" __rseq_str(src) "]" \
201 ", " RSEQ_ASM_TMP_REG_2 "]\n" \
202 " strb " RSEQ_ASM_TMP_REG32 ", [%[" __rseq_str(dst) "]" \
203 ", " RSEQ_ASM_TMP_REG_2 "]\n" \
204 " cbnz " RSEQ_ASM_TMP_REG_2 ", 222b\n" \
207 static inline __attribute__((always_inline
))
208 int rseq_cmpeqv_storev(intptr_t *v
, intptr_t expect
, intptr_t newv
, int cpu
)
212 __asm__ __volatile__
goto (
213 RSEQ_ASM_DEFINE_TABLE(1, 2f
, 3f
, 4f
)
214 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[cmpfail
])
215 #ifdef RSEQ_COMPARE_TWICE
216 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[error1
])
217 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[error2
])
219 RSEQ_ASM_STORE_RSEQ_CS(2, 1b
, rseq_cs
)
220 RSEQ_ASM_CMP_CPU_ID(cpu_id
, current_cpu_id
, 4f
)
222 RSEQ_ASM_OP_CMPEQ(v
, expect
, %l
[cmpfail
])
224 #ifdef RSEQ_COMPARE_TWICE
225 RSEQ_ASM_CMP_CPU_ID(cpu_id
, current_cpu_id
, %l
[error1
])
226 RSEQ_ASM_OP_CMPEQ(v
, expect
, %l
[error2
])
228 RSEQ_ASM_OP_FINAL_STORE(newv
, v
, 3)
230 RSEQ_ASM_DEFINE_ABORT(4, abort
)
231 : /* gcc asm goto does not allow outputs */
232 : [cpu_id
] "r" (cpu
),
233 [current_cpu_id
] "Qo" (__rseq_abi
.cpu_id
),
234 [rseq_cs
] "m" (__rseq_abi
.rseq_cs
),
236 [expect
] "r" (expect
),
239 : "memory", RSEQ_ASM_TMP_REG
241 #ifdef RSEQ_COMPARE_TWICE
252 #ifdef RSEQ_COMPARE_TWICE
254 rseq_bug("cpu_id comparison failed");
256 rseq_bug("expected value comparison failed");
260 static inline __attribute__((always_inline
))
261 int rseq_cmpnev_storeoffp_load(intptr_t *v
, intptr_t expectnot
,
262 off_t voffp
, intptr_t *load
, int cpu
)
266 __asm__ __volatile__
goto (
267 RSEQ_ASM_DEFINE_TABLE(1, 2f
, 3f
, 4f
)
268 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[cmpfail
])
269 #ifdef RSEQ_COMPARE_TWICE
270 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[error1
])
271 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[error2
])
273 RSEQ_ASM_STORE_RSEQ_CS(2, 1b
, rseq_cs
)
274 RSEQ_ASM_CMP_CPU_ID(cpu_id
, current_cpu_id
, 4f
)
276 RSEQ_ASM_OP_CMPNE(v
, expectnot
, %l
[cmpfail
])
278 #ifdef RSEQ_COMPARE_TWICE
279 RSEQ_ASM_CMP_CPU_ID(cpu_id
, current_cpu_id
, %l
[error1
])
280 RSEQ_ASM_OP_CMPNE(v
, expectnot
, %l
[error2
])
282 RSEQ_ASM_OP_R_LOAD(v
)
283 RSEQ_ASM_OP_R_STORE(load
)
284 RSEQ_ASM_OP_R_LOAD_OFF(voffp
)
285 RSEQ_ASM_OP_R_FINAL_STORE(v
, 3)
287 RSEQ_ASM_DEFINE_ABORT(4, abort
)
288 : /* gcc asm goto does not allow outputs */
289 : [cpu_id
] "r" (cpu
),
290 [current_cpu_id
] "Qo" (__rseq_abi
.cpu_id
),
291 [rseq_cs
] "m" (__rseq_abi
.rseq_cs
),
293 [expectnot
] "r" (expectnot
),
297 : "memory", RSEQ_ASM_TMP_REG
299 #ifdef RSEQ_COMPARE_TWICE
309 #ifdef RSEQ_COMPARE_TWICE
311 rseq_bug("cpu_id comparison failed");
313 rseq_bug("expected value comparison failed");
317 static inline __attribute__((always_inline
))
318 int rseq_addv(intptr_t *v
, intptr_t count
, int cpu
)
322 __asm__ __volatile__
goto (
323 RSEQ_ASM_DEFINE_TABLE(1, 2f
, 3f
, 4f
)
324 #ifdef RSEQ_COMPARE_TWICE
325 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[error1
])
327 RSEQ_ASM_STORE_RSEQ_CS(2, 1b
, rseq_cs
)
328 RSEQ_ASM_CMP_CPU_ID(cpu_id
, current_cpu_id
, 4f
)
330 #ifdef RSEQ_COMPARE_TWICE
331 RSEQ_ASM_CMP_CPU_ID(cpu_id
, current_cpu_id
, %l
[error1
])
333 RSEQ_ASM_OP_R_LOAD(v
)
334 RSEQ_ASM_OP_R_ADD(count
)
335 RSEQ_ASM_OP_R_FINAL_STORE(v
, 3)
337 RSEQ_ASM_DEFINE_ABORT(4, abort
)
338 : /* gcc asm goto does not allow outputs */
339 : [cpu_id
] "r" (cpu
),
340 [current_cpu_id
] "Qo" (__rseq_abi
.cpu_id
),
341 [rseq_cs
] "m" (__rseq_abi
.rseq_cs
),
345 : "memory", RSEQ_ASM_TMP_REG
347 #ifdef RSEQ_COMPARE_TWICE
355 #ifdef RSEQ_COMPARE_TWICE
357 rseq_bug("cpu_id comparison failed");
361 static inline __attribute__((always_inline
))
362 int rseq_cmpeqv_trystorev_storev(intptr_t *v
, intptr_t expect
,
363 intptr_t *v2
, intptr_t newv2
,
364 intptr_t newv
, int cpu
)
368 __asm__ __volatile__
goto (
369 RSEQ_ASM_DEFINE_TABLE(1, 2f
, 3f
, 4f
)
370 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[cmpfail
])
371 #ifdef RSEQ_COMPARE_TWICE
372 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[error1
])
373 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[error2
])
375 RSEQ_ASM_STORE_RSEQ_CS(2, 1b
, rseq_cs
)
376 RSEQ_ASM_CMP_CPU_ID(cpu_id
, current_cpu_id
, 4f
)
378 RSEQ_ASM_OP_CMPEQ(v
, expect
, %l
[cmpfail
])
380 #ifdef RSEQ_COMPARE_TWICE
381 RSEQ_ASM_CMP_CPU_ID(cpu_id
, current_cpu_id
, %l
[error1
])
382 RSEQ_ASM_OP_CMPEQ(v
, expect
, %l
[error2
])
384 RSEQ_ASM_OP_STORE(newv2
, v2
)
386 RSEQ_ASM_OP_FINAL_STORE(newv
, v
, 3)
388 RSEQ_ASM_DEFINE_ABORT(4, abort
)
389 : /* gcc asm goto does not allow outputs */
390 : [cpu_id
] "r" (cpu
),
391 [current_cpu_id
] "Qo" (__rseq_abi
.cpu_id
),
392 [rseq_cs
] "m" (__rseq_abi
.rseq_cs
),
393 [expect
] "r" (expect
),
399 : "memory", RSEQ_ASM_TMP_REG
401 #ifdef RSEQ_COMPARE_TWICE
412 #ifdef RSEQ_COMPARE_TWICE
414 rseq_bug("cpu_id comparison failed");
416 rseq_bug("expected value comparison failed");
420 static inline __attribute__((always_inline
))
421 int rseq_cmpeqv_trystorev_storev_release(intptr_t *v
, intptr_t expect
,
422 intptr_t *v2
, intptr_t newv2
,
423 intptr_t newv
, int cpu
)
427 __asm__ __volatile__
goto (
428 RSEQ_ASM_DEFINE_TABLE(1, 2f
, 3f
, 4f
)
429 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[cmpfail
])
430 #ifdef RSEQ_COMPARE_TWICE
431 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[error1
])
432 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[error2
])
434 RSEQ_ASM_STORE_RSEQ_CS(2, 1b
, rseq_cs
)
435 RSEQ_ASM_CMP_CPU_ID(cpu_id
, current_cpu_id
, 4f
)
437 RSEQ_ASM_OP_CMPEQ(v
, expect
, %l
[cmpfail
])
439 #ifdef RSEQ_COMPARE_TWICE
440 RSEQ_ASM_CMP_CPU_ID(cpu_id
, current_cpu_id
, %l
[error1
])
441 RSEQ_ASM_OP_CMPEQ(v
, expect
, %l
[error2
])
443 RSEQ_ASM_OP_STORE(newv2
, v2
)
445 RSEQ_ASM_OP_FINAL_STORE_RELEASE(newv
, v
, 3)
447 RSEQ_ASM_DEFINE_ABORT(4, abort
)
448 : /* gcc asm goto does not allow outputs */
449 : [cpu_id
] "r" (cpu
),
450 [current_cpu_id
] "Qo" (__rseq_abi
.cpu_id
),
451 [rseq_cs
] "m" (__rseq_abi
.rseq_cs
),
452 [expect
] "r" (expect
),
458 : "memory", RSEQ_ASM_TMP_REG
460 #ifdef RSEQ_COMPARE_TWICE
471 #ifdef RSEQ_COMPARE_TWICE
473 rseq_bug("cpu_id comparison failed");
475 rseq_bug("expected value comparison failed");
479 static inline __attribute__((always_inline
))
480 int rseq_cmpeqv_cmpeqv_storev(intptr_t *v
, intptr_t expect
,
481 intptr_t *v2
, intptr_t expect2
,
482 intptr_t newv
, int cpu
)
486 __asm__ __volatile__
goto (
487 RSEQ_ASM_DEFINE_TABLE(1, 2f
, 3f
, 4f
)
488 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[cmpfail
])
489 #ifdef RSEQ_COMPARE_TWICE
490 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[error1
])
491 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[error2
])
492 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[error3
])
494 RSEQ_ASM_STORE_RSEQ_CS(2, 1b
, rseq_cs
)
495 RSEQ_ASM_CMP_CPU_ID(cpu_id
, current_cpu_id
, 4f
)
497 RSEQ_ASM_OP_CMPEQ(v
, expect
, %l
[cmpfail
])
499 RSEQ_ASM_OP_CMPEQ(v2
, expect2
, %l
[cmpfail
])
501 #ifdef RSEQ_COMPARE_TWICE
502 RSEQ_ASM_CMP_CPU_ID(cpu_id
, current_cpu_id
, %l
[error1
])
503 RSEQ_ASM_OP_CMPEQ(v
, expect
, %l
[error2
])
504 RSEQ_ASM_OP_CMPEQ(v2
, expect2
, %l
[error3
])
506 RSEQ_ASM_OP_FINAL_STORE(newv
, v
, 3)
508 RSEQ_ASM_DEFINE_ABORT(4, abort
)
509 : /* gcc asm goto does not allow outputs */
510 : [cpu_id
] "r" (cpu
),
511 [current_cpu_id
] "Qo" (__rseq_abi
.cpu_id
),
512 [rseq_cs
] "m" (__rseq_abi
.rseq_cs
),
514 [expect
] "r" (expect
),
516 [expect2
] "r" (expect2
),
519 : "memory", RSEQ_ASM_TMP_REG
521 #ifdef RSEQ_COMPARE_TWICE
522 , error1
, error2
, error3
532 #ifdef RSEQ_COMPARE_TWICE
534 rseq_bug("cpu_id comparison failed");
536 rseq_bug("expected value comparison failed");
538 rseq_bug("2nd expected value comparison failed");
542 static inline __attribute__((always_inline
))
543 int rseq_cmpeqv_trymemcpy_storev(intptr_t *v
, intptr_t expect
,
544 void *dst
, void *src
, size_t len
,
545 intptr_t newv
, int cpu
)
549 __asm__ __volatile__
goto (
550 RSEQ_ASM_DEFINE_TABLE(1, 2f
, 3f
, 4f
)
551 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[cmpfail
])
552 #ifdef RSEQ_COMPARE_TWICE
553 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[error1
])
554 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[error2
])
556 RSEQ_ASM_STORE_RSEQ_CS(2, 1b
, rseq_cs
)
557 RSEQ_ASM_CMP_CPU_ID(cpu_id
, current_cpu_id
, 4f
)
559 RSEQ_ASM_OP_CMPEQ(v
, expect
, %l
[cmpfail
])
561 #ifdef RSEQ_COMPARE_TWICE
562 RSEQ_ASM_CMP_CPU_ID(cpu_id
, current_cpu_id
, %l
[error1
])
563 RSEQ_ASM_OP_CMPEQ(v
, expect
, %l
[error2
])
565 RSEQ_ASM_OP_R_BAD_MEMCPY(dst
, src
, len
)
567 RSEQ_ASM_OP_FINAL_STORE(newv
, v
, 3)
569 RSEQ_ASM_DEFINE_ABORT(4, abort
)
570 : /* gcc asm goto does not allow outputs */
571 : [cpu_id
] "r" (cpu
),
572 [current_cpu_id
] "Qo" (__rseq_abi
.cpu_id
),
573 [rseq_cs
] "m" (__rseq_abi
.rseq_cs
),
574 [expect
] "r" (expect
),
581 : "memory", RSEQ_ASM_TMP_REG
, RSEQ_ASM_TMP_REG_2
583 #ifdef RSEQ_COMPARE_TWICE
594 #ifdef RSEQ_COMPARE_TWICE
596 rseq_bug("cpu_id comparison failed");
598 rseq_bug("expected value comparison failed");
602 static inline __attribute__((always_inline
))
603 int rseq_cmpeqv_trymemcpy_storev_release(intptr_t *v
, intptr_t expect
,
604 void *dst
, void *src
, size_t len
,
605 intptr_t newv
, int cpu
)
609 __asm__ __volatile__
goto (
610 RSEQ_ASM_DEFINE_TABLE(1, 2f
, 3f
, 4f
)
611 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[cmpfail
])
612 #ifdef RSEQ_COMPARE_TWICE
613 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[error1
])
614 RSEQ_ASM_DEFINE_EXIT_POINT(2f
, %l
[error2
])
616 RSEQ_ASM_STORE_RSEQ_CS(2, 1b
, rseq_cs
)
617 RSEQ_ASM_CMP_CPU_ID(cpu_id
, current_cpu_id
, 4f
)
619 RSEQ_ASM_OP_CMPEQ(v
, expect
, %l
[cmpfail
])
621 #ifdef RSEQ_COMPARE_TWICE
622 RSEQ_ASM_CMP_CPU_ID(cpu_id
, current_cpu_id
, %l
[error1
])
623 RSEQ_ASM_OP_CMPEQ(v
, expect
, %l
[error2
])
625 RSEQ_ASM_OP_R_BAD_MEMCPY(dst
, src
, len
)
627 RSEQ_ASM_OP_FINAL_STORE_RELEASE(newv
, v
, 3)
629 RSEQ_ASM_DEFINE_ABORT(4, abort
)
630 : /* gcc asm goto does not allow outputs */
631 : [cpu_id
] "r" (cpu
),
632 [current_cpu_id
] "Qo" (__rseq_abi
.cpu_id
),
633 [rseq_cs
] "m" (__rseq_abi
.rseq_cs
),
634 [expect
] "r" (expect
),
641 : "memory", RSEQ_ASM_TMP_REG
, RSEQ_ASM_TMP_REG_2
643 #ifdef RSEQ_COMPARE_TWICE
654 #ifdef RSEQ_COMPARE_TWICE
656 rseq_bug("cpu_id comparison failed");
658 rseq_bug("expected value comparison failed");
662 #endif /* !RSEQ_SKIP_FASTPATH */