From d5c690b554ae766db1b8f5ca5a647e22e7ef2b47 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Fri, 5 Sep 2008 13:27:45 +0100 Subject: [PATCH] --- yaml --- r: 113306 b: refs/heads/master c: 74e91604b2452c15bbe72d77b37cf47ed0310d13 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/asm-x86/spinlock.h | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/[refs] b/[refs] index 5815d76204d9..6365b583897f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 08f5fcbe6e0ea029c7e9b1b1c338700ab7809daf +refs/heads/master: 74e91604b2452c15bbe72d77b37cf47ed0310d13 diff --git a/trunk/include/asm-x86/spinlock.h b/trunk/include/asm-x86/spinlock.h index 63d3b610a5ef..b5a4551fd565 100644 --- a/trunk/include/asm-x86/spinlock.h +++ b/trunk/include/asm-x86/spinlock.h @@ -21,8 +21,10 @@ #ifdef CONFIG_X86_32 # define LOCK_PTR_REG "a" +# define REG_PTR_MODE "k" #else # define LOCK_PTR_REG "D" +# define REG_PTR_MODE "q" #endif #if defined(CONFIG_X86_32) && \ @@ -77,19 +79,17 @@ static __always_inline void __ticket_spin_lock(raw_spinlock_t *lock) static __always_inline int __ticket_spin_trylock(raw_spinlock_t *lock) { - int tmp; - short new; + int tmp, new; - asm volatile("movw %2,%w0\n\t" + asm volatile("movzwl %2, %0\n\t" "cmpb %h0,%b0\n\t" + "leal 0x100(%" REG_PTR_MODE "0), %1\n\t" "jne 1f\n\t" - "movw %w0,%w1\n\t" - "incb %h1\n\t" LOCK_PREFIX "cmpxchgw %w1,%2\n\t" "1:" "sete %b1\n\t" "movzbl %b1,%0\n\t" - : "=&a" (tmp), "=&Q" (new), "+m" (lock->slock) + : "=&a" (tmp), "=&q" (new), "+m" (lock->slock) : : "memory", "cc"); @@ -136,8 +136,8 @@ static __always_inline int __ticket_spin_trylock(raw_spinlock_t *lock) "movl %0,%1\n\t" "roll $16, %0\n\t" "cmpl %0,%1\n\t" + "leal 0x00010000(%" REG_PTR_MODE "0), %1\n\t" "jne 1f\n\t" - "addl $0x00010000, %1\n\t" LOCK_PREFIX "cmpxchgl %1,%2\n\t" "1:" "sete %b1\n\t"