1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #include <linux/linkage.h>
3 #include <asm/percpu.h>
9 * %rsi : memory location to compare
10 * %rax : low 64 bits of old value
11 * %rdx : high 64 bits of old value
12 * %rbx : low 64 bits of new value
13 * %rcx : high 64 bits of new value
14 * %al : Operation successful
16 SYM_FUNC_START(this_cpu_cmpxchg16b_emu)
19 # Emulate 'cmpxchg16b %gs:(%rsi)' except we return the result in %al not
20 # via the ZF. Caller will access %al to get result.
22 # Note that this is only useful for a cpuops operation. Meaning that we
23 # do *not* have a fully atomic operation but just an operation that is
24 # *atomic* on a single cpu (as provided by the this_cpu_xx class of
30 cmpq PER_CPU_VAR((%rsi)), %rax
32 cmpq PER_CPU_VAR(8(%rsi)), %rdx
35 movq %rbx, PER_CPU_VAR((%rsi))
36 movq %rcx, PER_CPU_VAR(8(%rsi))
47 SYM_FUNC_END(this_cpu_cmpxchg16b_emu)