Skip to content

Commit

Permalink
x86: Improve cmpxchg16b_emu.S
Browse files Browse the repository at this point in the history
- don't include unneeded headers
- don't open-code PER_CPU_VAR()
- drop redundant entry point label
- complete unwind annotations
- use .L prefix on local label to not clutter the symbol table

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Link: http://lkml.kernel.org/r/542290BC020000780003807D@mail.emea.novell.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Jan Beulich authored and Thomas Gleixner committed Oct 8, 2014
1 parent 212be3b commit 3f63572
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions arch/x86/lib/cmpxchg16b_emu.S
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,8 @@
*
*/
#include <linux/linkage.h>
#include <asm/alternative-asm.h>
#include <asm/frame.h>
#include <asm/dwarf2.h>

#ifdef CONFIG_SMP
#define SEG_PREFIX %gs:
#else
#define SEG_PREFIX
#endif
#include <asm/percpu.h>

.text

Expand All @@ -39,24 +32,25 @@ CFI_STARTPROC
# *atomic* on a single cpu (as provided by the this_cpu_xx class of
# macros).
#
this_cpu_cmpxchg16b_emu:
pushf
pushfq_cfi
cli

cmpq SEG_PREFIX(%rsi), %rax
jne not_same
cmpq SEG_PREFIX 8(%rsi), %rdx
jne not_same
cmpq PER_CPU_VAR((%rsi)), %rax
jne .Lnot_same
cmpq PER_CPU_VAR(8(%rsi)), %rdx
jne .Lnot_same

movq %rbx, SEG_PREFIX(%rsi)
movq %rcx, SEG_PREFIX 8(%rsi)
movq %rbx, PER_CPU_VAR((%rsi))
movq %rcx, PER_CPU_VAR(8(%rsi))

popf
CFI_REMEMBER_STATE
popfq_cfi
mov $1, %al
ret

not_same:
popf
CFI_RESTORE_STATE
.Lnot_same:
popfq_cfi
xor %al,%al
ret

Expand Down

0 comments on commit 3f63572

Please sign in to comment.