aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/spinlock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-x86/spinlock.h')
-rw-r--r--include/asm-x86/spinlock.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/include/asm-x86/spinlock.h b/include/asm-x86/spinlock.h
index 63d3b610a5ef..b5a4551fd565 100644
--- a/include/asm-x86/spinlock.h
+++ b/include/asm-x86/spinlock.h
@@ -21,8 +21,10 @@
21 21
22#ifdef CONFIG_X86_32 22#ifdef CONFIG_X86_32
23# define LOCK_PTR_REG "a" 23# define LOCK_PTR_REG "a"
24# define REG_PTR_MODE "k"
24#else 25#else
25# define LOCK_PTR_REG "D" 26# define LOCK_PTR_REG "D"
27# define REG_PTR_MODE "q"
26#endif 28#endif
27 29
28#if defined(CONFIG_X86_32) && \ 30#if defined(CONFIG_X86_32) && \
@@ -77,19 +79,17 @@ static __always_inline void __ticket_spin_lock(raw_spinlock_t *lock)
77 79
78static __always_inline int __ticket_spin_trylock(raw_spinlock_t *lock) 80static __always_inline int __ticket_spin_trylock(raw_spinlock_t *lock)
79{ 81{
80 int tmp; 82 int tmp, new;
81 short new;
82 83
83 asm volatile("movw %2,%w0\n\t" 84 asm volatile("movzwl %2, %0\n\t"
84 "cmpb %h0,%b0\n\t" 85 "cmpb %h0,%b0\n\t"
86 "leal 0x100(%" REG_PTR_MODE "0), %1\n\t"
85 "jne 1f\n\t" 87 "jne 1f\n\t"
86 "movw %w0,%w1\n\t"
87 "incb %h1\n\t"
88 LOCK_PREFIX "cmpxchgw %w1,%2\n\t" 88 LOCK_PREFIX "cmpxchgw %w1,%2\n\t"
89 "1:" 89 "1:"
90 "sete %b1\n\t" 90 "sete %b1\n\t"
91 "movzbl %b1,%0\n\t" 91 "movzbl %b1,%0\n\t"
92 : "=&a" (tmp), "=&Q" (new), "+m" (lock->slock) 92 : "=&a" (tmp), "=&q" (new), "+m" (lock->slock)
93 : 93 :
94 : "memory", "cc"); 94 : "memory", "cc");
95 95
@@ -136,8 +136,8 @@ static __always_inline int __ticket_spin_trylock(raw_spinlock_t *lock)
136 "movl %0,%1\n\t" 136 "movl %0,%1\n\t"
137 "roll $16, %0\n\t" 137 "roll $16, %0\n\t"
138 "cmpl %0,%1\n\t" 138 "cmpl %0,%1\n\t"
139 "leal 0x00010000(%" REG_PTR_MODE "0), %1\n\t"
139 "jne 1f\n\t" 140 "jne 1f\n\t"
140 "addl $0x00010000, %1\n\t"
141 LOCK_PREFIX "cmpxchgl %1,%2\n\t" 141 LOCK_PREFIX "cmpxchgl %1,%2\n\t"
142 "1:" 142 "1:"
143 "sete %b1\n\t" 143 "sete %b1\n\t"