Merge tag 'wireless-drivers-for-davem-2015-06-01' of git://git.kernel.org/pub/scm...
[deliverable/linux.git] / arch / x86 / lib / cmpxchg16b_emu.S
CommitLineData
b9ec40af
CL
1/*
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
5 * of the License.
6 *
7 */
8#include <linux/linkage.h>
b9ec40af 9#include <asm/dwarf2.h>
3f635721 10#include <asm/percpu.h>
d7c3f8ce 11
b9ec40af
CL
12.text
13
14/*
15 * Inputs:
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
22 */
23ENTRY(this_cpu_cmpxchg16b_emu)
24CFI_STARTPROC
25
26#
27# Emulate 'cmpxchg16b %gs:(%rsi)' except we return the result in %al not
28# via the ZF. Caller will access %al to get result.
29#
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
33# macros).
34#
3f635721 35 pushfq_cfi
b9ec40af
CL
36 cli
37
3f635721
JB
38 cmpq PER_CPU_VAR((%rsi)), %rax
39 jne .Lnot_same
40 cmpq PER_CPU_VAR(8(%rsi)), %rdx
41 jne .Lnot_same
b9ec40af 42
3f635721
JB
43 movq %rbx, PER_CPU_VAR((%rsi))
44 movq %rcx, PER_CPU_VAR(8(%rsi))
b9ec40af 45
3f635721
JB
46 CFI_REMEMBER_STATE
47 popfq_cfi
b9ec40af
CL
48 mov $1, %al
49 ret
50
3f635721
JB
51 CFI_RESTORE_STATE
52.Lnot_same:
53 popfq_cfi
b9ec40af
CL
54 xor %al,%al
55 ret
56
57CFI_ENDPROC
58
59ENDPROC(this_cpu_cmpxchg16b_emu)
This page took 0.320078 seconds and 5 git commands to generate.