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/dwarf2.h>
10 #include <asm/percpu.h>
16 * %rsi : memory location to compare
17 * %rax : low 64 bits of old value
18 * %rdx : high 64 bits of old value
19 * %rbx : low 64 bits of new value
20 * %rcx : high 64 bits of new value
21 * %al : Operation successful
23 ENTRY(this_cpu_cmpxchg16b_emu)
27 # Emulate 'cmpxchg16b %gs:(%rsi)' except we return the result in %al not
28 # via the ZF. Caller will access %al to get result.
30 # Note that this is only useful for a cpuops operation. Meaning that we
31 # do *not* have a fully atomic operation but just an operation that is
32 # *atomic* on a single cpu (as provided by the this_cpu_xx class of
38 cmpq PER_CPU_VAR((%rsi)), %rax
40 cmpq PER_CPU_VAR(8(%rsi)), %rdx
43 movq %rbx, PER_CPU_VAR((%rsi))
44 movq %rcx, PER_CPU_VAR(8(%rsi))
59 ENDPROC(this_cpu_cmpxchg16b_emu)