2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; version 2
8 #include <linux/linkage.h>
9 #include <asm/percpu.h>
15 * %rsi : memory location to compare
16 * %rax : low 64 bits of old value
17 * %rdx : high 64 bits of old value
18 * %rbx : low 64 bits of new value
19 * %rcx : high 64 bits of new value
20 * %al : Operation successful
22 ENTRY(this_cpu_cmpxchg16b_emu)
25 # Emulate 'cmpxchg16b %gs:(%rsi)' except we return the result in %al not
26 # via the ZF. Caller will access %al to get result.
28 # Note that this is only useful for a cpuops operation. Meaning that we
29 # do *not* have a fully atomic operation but just an operation that is
30 # *atomic* on a single cpu (as provided by the this_cpu_xx class of
36 cmpq PER_CPU_VAR((%rsi)), %rax
38 cmpq PER_CPU_VAR(8(%rsi)), %rdx
41 movq %rbx, PER_CPU_VAR((%rsi))
42 movq %rcx, PER_CPU_VAR(8(%rsi))
53 ENDPROC(this_cpu_cmpxchg16b_emu)