Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / arch / x86 / lib / cmpxchg8b_emu.S
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
9 #include <linux/linkage.h>
10 #include <asm/dwarf2.h>
11
12 .text
13
14 /*
15  * Inputs:
16  * %esi : memory location to compare
17  * %eax : low 32 bits of old value
18  * %edx : high 32 bits of old value
19  * %ebx : low 32 bits of new value
20  * %ecx : high 32 bits of new value
21  */
22 ENTRY(cmpxchg8b_emu)
23 CFI_STARTPROC
24
25 #
26 # Emulate 'cmpxchg8b (%esi)' on UP except we don't
27 # set the whole ZF thing (caller will just compare
28 # eax:edx with the expected value)
29 #
30         pushfl_cfi
31         cli
32
33         cmpl  (%esi), %eax
34         jne .Lnot_same
35         cmpl 4(%esi), %edx
36         jne .Lhalf_same
37
38         movl %ebx,  (%esi)
39         movl %ecx, 4(%esi)
40
41         CFI_REMEMBER_STATE
42         popfl_cfi
43         ret
44
45         CFI_RESTORE_STATE
46 .Lnot_same:
47         movl  (%esi), %eax
48 .Lhalf_same:
49         movl 4(%esi), %edx
50
51         popfl_cfi
52         ret
53
54 CFI_ENDPROC
55 ENDPROC(cmpxchg8b_emu)