Merge remote-tracking branch 'xen-tip/linux-next'
[deliverable/linux.git] / arch / x86 / lib / cmpxchg8b_emu.S
CommitLineData
79e1dd05
AV
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>
784d5699 10#include <asm/export.h>
79e1dd05 11
79e1dd05
AV
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 */
22ENTRY(cmpxchg8b_emu)
79e1dd05
AV
23
24#
25# Emulate 'cmpxchg8b (%esi)' on UP except we don't
26# set the whole ZF thing (caller will just compare
27# eax:edx with the expected value)
28#
131484c8 29 pushfl
79e1dd05
AV
30 cli
31
32 cmpl (%esi), %eax
5f1d919a 33 jne .Lnot_same
79e1dd05 34 cmpl 4(%esi), %edx
5f1d919a 35 jne .Lhalf_same
79e1dd05
AV
36
37 movl %ebx, (%esi)
38 movl %ecx, 4(%esi)
39
131484c8 40 popfl
79e1dd05
AV
41 ret
42
5f1d919a 43.Lnot_same:
79e1dd05 44 movl (%esi), %eax
5f1d919a 45.Lhalf_same:
79e1dd05
AV
46 movl 4(%esi), %edx
47
131484c8 48 popfl
79e1dd05
AV
49 ret
50
79e1dd05 51ENDPROC(cmpxchg8b_emu)
784d5699 52EXPORT_SYMBOL(cmpxchg8b_emu)
This page took 0.366035 seconds and 5 git commands to generate.