mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-26 06:04:14 +08:00
b886d83c5b
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation version 2 of the license extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 315 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Armijn Hemel <armijn@tjaldur.nl> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190531190115.503150771@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
48 lines
993 B
ArmAsm
48 lines
993 B
ArmAsm
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
#include <linux/linkage.h>
|
|
#include <asm/percpu.h>
|
|
|
|
.text
|
|
|
|
/*
|
|
* Inputs:
|
|
* %rsi : memory location to compare
|
|
* %rax : low 64 bits of old value
|
|
* %rdx : high 64 bits of old value
|
|
* %rbx : low 64 bits of new value
|
|
* %rcx : high 64 bits of new value
|
|
* %al : Operation successful
|
|
*/
|
|
ENTRY(this_cpu_cmpxchg16b_emu)
|
|
|
|
#
|
|
# Emulate 'cmpxchg16b %gs:(%rsi)' except we return the result in %al not
|
|
# via the ZF. Caller will access %al to get result.
|
|
#
|
|
# Note that this is only useful for a cpuops operation. Meaning that we
|
|
# do *not* have a fully atomic operation but just an operation that is
|
|
# *atomic* on a single cpu (as provided by the this_cpu_xx class of
|
|
# macros).
|
|
#
|
|
pushfq
|
|
cli
|
|
|
|
cmpq PER_CPU_VAR((%rsi)), %rax
|
|
jne .Lnot_same
|
|
cmpq PER_CPU_VAR(8(%rsi)), %rdx
|
|
jne .Lnot_same
|
|
|
|
movq %rbx, PER_CPU_VAR((%rsi))
|
|
movq %rcx, PER_CPU_VAR(8(%rsi))
|
|
|
|
popfq
|
|
mov $1, %al
|
|
ret
|
|
|
|
.Lnot_same:
|
|
popfq
|
|
xor %al,%al
|
|
ret
|
|
|
|
ENDPROC(this_cpu_cmpxchg16b_emu)
|