1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <linux/export.h>
4 #include <linux/linkage.h>
5 #include <asm/percpu.h>
6 #include <asm/processor-flags.h>
10 #ifndef CONFIG_X86_CMPXCHG64
13 * Emulate 'cmpxchg8b (%esi)' on UP
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
22 SYM_FUNC_START(cmpxchg8b_emu)
35 orl $X86_EFLAGS_ZF, (%esp)
44 andl $(~X86_EFLAGS_ZF), (%esp)
49 SYM_FUNC_END(cmpxchg8b_emu)
50 EXPORT_SYMBOL(cmpxchg8b_emu)
56 SYM_FUNC_START(this_cpu_cmpxchg8b_emu)
61 cmpl PER_CPU_VAR(0(%esi)), %eax
63 cmpl PER_CPU_VAR(4(%esi)), %edx
66 movl %ebx, PER_CPU_VAR(0(%esi))
67 movl %ecx, PER_CPU_VAR(4(%esi))
69 orl $X86_EFLAGS_ZF, (%esp)
75 movl PER_CPU_VAR(0(%esi)), %eax
76 movl PER_CPU_VAR(4(%esi)), %edx
78 andl $(~X86_EFLAGS_ZF), (%esp)
83 SYM_FUNC_END(this_cpu_cmpxchg8b_emu)