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/alternative-asm.h>
10 #include <asm/frame.h>
11 #include <asm/dwarf2.h>
14 #define SEG_PREFIX %gs:
23 * %rsi : memory location to compare
24 * %rax : low 64 bits of old value
25 * %rdx : high 64 bits of old value
26 * %rbx : low 64 bits of new value
27 * %rcx : high 64 bits of new value
28 * %al : Operation successful
30 ENTRY(this_cpu_cmpxchg16b_emu)
34 # Emulate 'cmpxchg16b %gs:(%rsi)' except we return the result in %al not
35 # via the ZF. Caller will access %al to get result.
37 # Note that this is only useful for a cpuops operation. Meaning that we
38 # do *not* have a fully atomic operation but just an operation that is
39 # *atomic* on a single cpu (as provided by the this_cpu_xx class of
42 this_cpu_cmpxchg16b_emu:
46 cmpq SEG_PREFIX(%rsi), %rax
48 cmpq SEG_PREFIX 8(%rsi), %rdx
51 movq %rbx, SEG_PREFIX(%rsi)
52 movq %rcx, SEG_PREFIX 8(%rsi)
65 ENDPROC(this_cpu_cmpxchg16b_emu)