Thomas Gleixner | b886d83c | 2019-06-01 10:08:55 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 2 | |
3 | #include <linux/linkage.h> | ||||
Al Viro | 784d569 | 2016-01-11 11:04:34 -0500 | [diff] [blame] | 4 | #include <asm/export.h> |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 5 | |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 6 | .text |
7 | |||||
8 | /* | ||||
9 | * Inputs: | ||||
10 | * %esi : memory location to compare | ||||
11 | * %eax : low 32 bits of old value | ||||
12 | * %edx : high 32 bits of old value | ||||
13 | * %ebx : low 32 bits of new value | ||||
14 | * %ecx : high 32 bits of new value | ||||
15 | */ | ||||
Jiri Slaby | 6dcc562 | 2019-10-11 13:51:04 +0200 | [diff] [blame] | 16 | SYM_FUNC_START(cmpxchg8b_emu) |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 17 | |
18 | # | ||||
19 | # Emulate 'cmpxchg8b (%esi)' on UP except we don't | ||||
20 | # set the whole ZF thing (caller will just compare | ||||
21 | # eax:edx with the expected value) | ||||
22 | # | ||||
Ingo Molnar | 131484c | 2015-05-28 12:21:47 +0200 | [diff] [blame] | 23 | pushfl |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 24 | cli |
25 | |||||
26 | cmpl (%esi), %eax | ||||
Jan Beulich | 5f1d919 | 2014-09-24 08:40:14 +0100 | [diff] [blame] | 27 | jne .Lnot_same |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 28 | cmpl 4(%esi), %edx |
Jan Beulich | 5f1d919 | 2014-09-24 08:40:14 +0100 | [diff] [blame] | 29 | jne .Lhalf_same |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 30 | |
31 | movl %ebx, (%esi) | ||||
32 | movl %ecx, 4(%esi) | ||||
33 | |||||
Ingo Molnar | 131484c | 2015-05-28 12:21:47 +0200 | [diff] [blame] | 34 | popfl |
Peter Zijlstra | f94909c | 2021-12-04 14:43:40 +0100 | [diff] [blame] | 35 | RET |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 36 | |
Jan Beulich | 5f1d919 | 2014-09-24 08:40:14 +0100 | [diff] [blame] | 37 | .Lnot_same: |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 38 | movl (%esi), %eax |
Jan Beulich | 5f1d919 | 2014-09-24 08:40:14 +0100 | [diff] [blame] | 39 | .Lhalf_same: |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 40 | movl 4(%esi), %edx |
41 | |||||
Ingo Molnar | 131484c | 2015-05-28 12:21:47 +0200 | [diff] [blame] | 42 | popfl |
Peter Zijlstra | f94909c | 2021-12-04 14:43:40 +0100 | [diff] [blame] | 43 | RET |
Arjan van de Ven | 79e1dd0 | 2009-09-30 17:07:54 +0200 | [diff] [blame] | 44 | |
Jiri Slaby | 6dcc562 | 2019-10-11 13:51:04 +0200 | [diff] [blame] | 45 | SYM_FUNC_END(cmpxchg8b_emu) |
Al Viro | 784d569 | 2016-01-11 11:04:34 -0500 | [diff] [blame] | 46 | EXPORT_SYMBOL(cmpxchg8b_emu) |