^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #include <linux/linkage.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) #include <asm/export.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) .text
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Inputs:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * %esi : memory location to compare
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * %eax : low 32 bits of old value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * %edx : high 32 bits of old value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * %ebx : low 32 bits of new value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * %ecx : high 32 bits of new value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) SYM_FUNC_START(cmpxchg8b_emu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) # Emulate 'cmpxchg8b (%esi)' on UP except we don't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) # set the whole ZF thing (caller will just compare
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) # eax:edx with the expected value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) pushfl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) cli
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) cmpl (%esi), %eax
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) jne .Lnot_same
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) cmpl 4(%esi), %edx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) jne .Lhalf_same
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) movl %ebx, (%esi)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) movl %ecx, 4(%esi)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) popfl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) ret
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) .Lnot_same:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) movl (%esi), %eax
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) .Lhalf_same:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) movl 4(%esi), %edx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) popfl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) ret
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) SYM_FUNC_END(cmpxchg8b_emu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) EXPORT_SYMBOL(cmpxchg8b_emu)