Commit | Line | Data |
---|---|---|
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> | |
79e1dd05 AV |
10 | #include <asm/dwarf2.h> |
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 | */ | |
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 | # | |
5f1d919a | 30 | pushfl_cfi |
79e1dd05 AV |
31 | cli |
32 | ||
33 | cmpl (%esi), %eax | |
5f1d919a | 34 | jne .Lnot_same |
79e1dd05 | 35 | cmpl 4(%esi), %edx |
5f1d919a | 36 | jne .Lhalf_same |
79e1dd05 AV |
37 | |
38 | movl %ebx, (%esi) | |
39 | movl %ecx, 4(%esi) | |
40 | ||
5f1d919a JB |
41 | CFI_REMEMBER_STATE |
42 | popfl_cfi | |
79e1dd05 AV |
43 | ret |
44 | ||
5f1d919a JB |
45 | CFI_RESTORE_STATE |
46 | .Lnot_same: | |
79e1dd05 | 47 | movl (%esi), %eax |
5f1d919a | 48 | .Lhalf_same: |
79e1dd05 AV |
49 | movl 4(%esi), %edx |
50 | ||
5f1d919a | 51 | popfl_cfi |
79e1dd05 AV |
52 | ret |
53 | ||
54 | CFI_ENDPROC | |
55 | ENDPROC(cmpxchg8b_emu) |