Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 
0003 #include <linux/linkage.h>
0004 #include <asm/export.h>
0005 
0006 .text
0007 
0008 /*
0009  * Inputs:
0010  * %esi : memory location to compare
0011  * %eax : low 32 bits of old value
0012  * %edx : high 32 bits of old value
0013  * %ebx : low 32 bits of new value
0014  * %ecx : high 32 bits of new value
0015  */
0016 SYM_FUNC_START(cmpxchg8b_emu)
0017 
0018 #
0019 # Emulate 'cmpxchg8b (%esi)' on UP except we don't
0020 # set the whole ZF thing (caller will just compare
0021 # eax:edx with the expected value)
0022 #
0023     pushfl
0024     cli
0025 
0026     cmpl  (%esi), %eax
0027     jne .Lnot_same
0028     cmpl 4(%esi), %edx
0029     jne .Lhalf_same
0030 
0031     movl %ebx,  (%esi)
0032     movl %ecx, 4(%esi)
0033 
0034     popfl
0035     RET
0036 
0037 .Lnot_same:
0038     movl  (%esi), %eax
0039 .Lhalf_same:
0040     movl 4(%esi), %edx
0041 
0042     popfl
0043     RET
0044 
0045 SYM_FUNC_END(cmpxchg8b_emu)
0046 EXPORT_SYMBOL(cmpxchg8b_emu)