Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 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> |
Al Viro | 784d569 | 2016-01-11 11:04:34 -0500 | [diff] [blame] | 10 | #include <asm/export.h> |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 11 | |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 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) |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 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 | # |
Ingo Molnar | 131484c | 2015-05-28 12:21:47 +0200 | [diff] [blame] | 29 | pushfl |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 30 | cli |
| 31 | |
| 32 | cmpl (%esi), %eax |
Jan Beulich | 5f1d919 | 2014-09-24 08:40:14 +0100 | [diff] [blame] | 33 | jne .Lnot_same |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 34 | cmpl 4(%esi), %edx |
Jan Beulich | 5f1d919 | 2014-09-24 08:40:14 +0100 | [diff] [blame] | 35 | jne .Lhalf_same |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 36 | |
| 37 | movl %ebx, (%esi) |
| 38 | movl %ecx, 4(%esi) |
| 39 | |
Ingo Molnar | 131484c | 2015-05-28 12:21:47 +0200 | [diff] [blame] | 40 | popfl |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 41 | ret |
| 42 | |
Jan Beulich | 5f1d919 | 2014-09-24 08:40:14 +0100 | [diff] [blame] | 43 | .Lnot_same: |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 44 | movl (%esi), %eax |
Jan Beulich | 5f1d919 | 2014-09-24 08:40:14 +0100 | [diff] [blame] | 45 | .Lhalf_same: |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 46 | movl 4(%esi), %edx |
| 47 | |
Ingo Molnar | 131484c | 2015-05-28 12:21:47 +0200 | [diff] [blame] | 48 | popfl |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 49 | ret |
| 50 | |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 51 | ENDPROC(cmpxchg8b_emu) |
Al Viro | 784d569 | 2016-01-11 11:04:34 -0500 | [diff] [blame] | 52 | EXPORT_SYMBOL(cmpxchg8b_emu) |