blob: b4807fce517760ac4a72dceae939ae322b0bda6b [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#include <asm/dwarf2.h>
11
Arjan van de Ven79e1dd02009-09-30 17:07:54 +020012.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)
23CFI_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#
Jan Beulich5f1d9192014-09-24 08:40:14 +010030 pushfl_cfi
Arjan van de Ven79e1dd02009-09-30 17:07:54 +020031 cli
32
33 cmpl (%esi), %eax
Jan Beulich5f1d9192014-09-24 08:40:14 +010034 jne .Lnot_same
Arjan van de Ven79e1dd02009-09-30 17:07:54 +020035 cmpl 4(%esi), %edx
Jan Beulich5f1d9192014-09-24 08:40:14 +010036 jne .Lhalf_same
Arjan van de Ven79e1dd02009-09-30 17:07:54 +020037
38 movl %ebx, (%esi)
39 movl %ecx, 4(%esi)
40
Jan Beulich5f1d9192014-09-24 08:40:14 +010041 CFI_REMEMBER_STATE
42 popfl_cfi
Arjan van de Ven79e1dd02009-09-30 17:07:54 +020043 ret
44
Jan Beulich5f1d9192014-09-24 08:40:14 +010045 CFI_RESTORE_STATE
46.Lnot_same:
Arjan van de Ven79e1dd02009-09-30 17:07:54 +020047 movl (%esi), %eax
Jan Beulich5f1d9192014-09-24 08:40:14 +010048.Lhalf_same:
Arjan van de Ven79e1dd02009-09-30 17:07:54 +020049 movl 4(%esi), %edx
50
Jan Beulich5f1d9192014-09-24 08:40:14 +010051 popfl_cfi
Arjan van de Ven79e1dd02009-09-30 17:07:54 +020052 ret
53
54CFI_ENDPROC
55ENDPROC(cmpxchg8b_emu)