blob: ad53497784904b2c1f420fd41576c9ffeea8ce0b [file] [log] [blame]
Arjan van de Ven79e1dd02009-09-30 17:07:54 +02001/*
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>
Arjan van de Ven79e1dd02009-09-30 17:07:54 +020010
Arjan van de Ven79e1dd02009-09-30 17:07:54 +020011.text
12
13/*
14 * Inputs:
15 * %esi : memory location to compare
16 * %eax : low 32 bits of old value
17 * %edx : high 32 bits of old value
18 * %ebx : low 32 bits of new value
19 * %ecx : high 32 bits of new value
20 */
21ENTRY(cmpxchg8b_emu)
Arjan van de Ven79e1dd02009-09-30 17:07:54 +020022
23#
24# Emulate 'cmpxchg8b (%esi)' on UP except we don't
25# set the whole ZF thing (caller will just compare
26# eax:edx with the expected value)
27#
Ingo Molnar131484c2015-05-28 12:21:47 +020028 pushfl
Arjan van de Ven79e1dd02009-09-30 17:07:54 +020029 cli
30
31 cmpl (%esi), %eax
Jan Beulich5f1d9192014-09-24 08:40:14 +010032 jne .Lnot_same
Arjan van de Ven79e1dd02009-09-30 17:07:54 +020033 cmpl 4(%esi), %edx
Jan Beulich5f1d9192014-09-24 08:40:14 +010034 jne .Lhalf_same
Arjan van de Ven79e1dd02009-09-30 17:07:54 +020035
36 movl %ebx, (%esi)
37 movl %ecx, 4(%esi)
38
Ingo Molnar131484c2015-05-28 12:21:47 +020039 popfl
Arjan van de Ven79e1dd02009-09-30 17:07:54 +020040 ret
41
Jan Beulich5f1d9192014-09-24 08:40:14 +010042.Lnot_same:
Arjan van de Ven79e1dd02009-09-30 17:07:54 +020043 movl (%esi), %eax
Jan Beulich5f1d9192014-09-24 08:40:14 +010044.Lhalf_same:
Arjan van de Ven79e1dd02009-09-30 17:07:54 +020045 movl 4(%esi), %edx
46
Ingo Molnar131484c2015-05-28 12:21:47 +020047 popfl
Arjan van de Ven79e1dd02009-09-30 17:07:54 +020048 ret
49
Arjan van de Ven79e1dd02009-09-30 17:07:54 +020050ENDPROC(cmpxchg8b_emu)