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> |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 10 | #include <asm/dwarf2.h> |
| 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) |
| 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 | # |
Jan Beulich | 5f1d919 | 2014-09-24 08:40:14 +0100 | [diff] [blame] | 30 | pushfl_cfi |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 31 | cli |
| 32 | |
| 33 | cmpl (%esi), %eax |
Jan Beulich | 5f1d919 | 2014-09-24 08:40:14 +0100 | [diff] [blame] | 34 | jne .Lnot_same |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 35 | cmpl 4(%esi), %edx |
Jan Beulich | 5f1d919 | 2014-09-24 08:40:14 +0100 | [diff] [blame] | 36 | jne .Lhalf_same |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 37 | |
| 38 | movl %ebx, (%esi) |
| 39 | movl %ecx, 4(%esi) |
| 40 | |
Jan Beulich | 5f1d919 | 2014-09-24 08:40:14 +0100 | [diff] [blame] | 41 | CFI_REMEMBER_STATE |
| 42 | popfl_cfi |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 43 | ret |
| 44 | |
Jan Beulich | 5f1d919 | 2014-09-24 08:40:14 +0100 | [diff] [blame] | 45 | CFI_RESTORE_STATE |
| 46 | .Lnot_same: |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 47 | movl (%esi), %eax |
Jan Beulich | 5f1d919 | 2014-09-24 08:40:14 +0100 | [diff] [blame] | 48 | .Lhalf_same: |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 49 | movl 4(%esi), %edx |
| 50 | |
Jan Beulich | 5f1d919 | 2014-09-24 08:40:14 +0100 | [diff] [blame] | 51 | popfl_cfi |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 52 | ret |
| 53 | |
| 54 | CFI_ENDPROC |
| 55 | ENDPROC(cmpxchg8b_emu) |