blob: 03a186fc06eab6217a4d461174409ac1cc9366ee [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001/*
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/export.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 */
22ENTRY(cmpxchg8b_emu)
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#
29 pushfl
30 cli
31
32 cmpl (%esi), %eax
33 jne .Lnot_same
34 cmpl 4(%esi), %edx
35 jne .Lhalf_same
36
37 movl %ebx, (%esi)
38 movl %ecx, 4(%esi)
39
40 popfl
41 ret
42
43.Lnot_same:
44 movl (%esi), %eax
45.Lhalf_same:
46 movl 4(%esi), %edx
47
48 popfl
49 ret
50
51ENDPROC(cmpxchg8b_emu)
52EXPORT_SYMBOL(cmpxchg8b_emu)