Index: linux-2.6.7-rc1-mm1/arch/i386/kernel/i386_ksyms.c=================================================================== RCS file: /home/cvsroot/linux-2.6.7-rc1-mm1/arch/i386/kernel/i386_ksyms.c,v retrieving revision 1.1.1.1 Index: linux-2.6.8-rc1/arch/i386/kernel/i386_ksyms.c =================================================================== --- linux-2.6.8-rc1.orig/arch/i386/kernel/i386_ksyms.c 2004-07-15 02:41:37.000000000 +1000 +++ linux-2.6.8-rc1/arch/i386/kernel/i386_ksyms.c 2004-07-15 10:03:19.400340547 +1000 @@ -49,6 +49,14 @@ #ifdef CONFIG_SMP extern void FASTCALL( __write_lock_failed(rwlock_t *rw)); extern void FASTCALL( __read_lock_failed(rwlock_t *rw)); +extern void asmlinkage __spin_lock_failed(spinlock_t *); +extern void asmlinkage __spin_lock_failed_flags(spinlock_t *, unsigned long); +extern void asmlinkage __spin_lock_loop(spinlock_t *); +extern void asmlinkage __spin_lock_loop_flags(spinlock_t *, unsigned long); +EXPORT_SYMBOL(__spin_lock_failed); +EXPORT_SYMBOL(__spin_lock_failed_flags); +EXPORT_SYMBOL(__spin_lock_loop); +EXPORT_SYMBOL(__spin_lock_loop_flags); #endif #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE) Index: linux-2.6.8-rc1/arch/i386/lib/Makefile =================================================================== --- linux-2.6.8-rc1.orig/arch/i386/lib/Makefile 2004-07-15 02:41:37.000000000 +1000 +++ linux-2.6.8-rc1/arch/i386/lib/Makefile 2004-07-15 10:03:19.427336252 +1000 @@ -6,5 +6,6 @@ lib-y = checksum.o delay.o usercopy.o getuser.o memcpy.o strstr.o \ bitops.o +lib-$(CONFIG_SMP) += spinlock.o lib-$(CONFIG_X86_USE_3DNOW) += mmx.o lib-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o Index: linux-2.6.8-rc1/arch/i386/lib/spinlock.c =================================================================== --- linux-2.6.8-rc1.orig/arch/i386/lib/spinlock.c 2003-03-27 19:01:40.000000000 +1100 +++ linux-2.6.8-rc1/arch/i386/lib/spinlock.c 2004-07-15 10:03:19.428336093 +1000 @@ -0,0 +1,53 @@ +#define PROC(name) \ + ".align 4\n" \ + ".globl " #name"\n" \ + #name":\n" + +asm (PROC(__spin_lock_failed_flags) + "testl $0x200, %ebx\n" + "jz 1f\n" + "sti\n" + "1:\n\t" + "rep; nop\n" + "cmpb $0, (%eax)\n" + "jle 1b\n" + "cli\n" + "lock; decb (%eax)\n\t" + "js __spin_lock_failed_flags\n\t" + "ret\n" +); + +asm (PROC(__spin_lock_loop_flags) + "lock; decb (%eax)\n\t" + "js 1f\n\t" + "ret\n\t" + "1:\n\t" + "testl $0x200, %ebx\n\t" + "jz 1f\n\t" + "sti\n\t" + "2: rep; nop\n\t" + "cmpb $0, (%eax)\n\t" + "jle 2b\n\t" + "cli\n\t" + "jmp __spin_lock_loop_flags\n\t" +); + +asm (PROC(__spin_lock_failed) + "rep; nop\n\t" + "cmpb $0, (%eax)\n\t" + "jle __spin_lock_failed\n\t" + "lock; decb (%eax)\n\t" + "js __spin_lock_failed\n\t" + "ret\n\t" +); + +asm (PROC(__spin_lock_loop) + "lock; decb (%eax)\n\t" + "js 1f\n\t" + "ret\n\t" + "1: rep; nop\n\t" + "cmpb $0, (%eax)\n\t" + "jle 1b\n\t" + "jmp __spin_lock_loop\n\t" +); + Index: linux-2.6.8-rc1/include/asm-i386/spinlock.h =================================================================== --- linux-2.6.8-rc1.orig/include/asm-i386/spinlock.h 2004-07-15 10:03:17.540636438 +1000 +++ linux-2.6.8-rc1/include/asm-i386/spinlock.h 2004-07-15 10:03:19.428336093 +1000 @@ -44,33 +44,10 @@ #define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x)) #define spin_lock_string \ - "\n1:\t" \ - "lock ; decb %0\n\t" \ - "js 2f\n" \ - LOCK_SECTION_START("") \ - "2:\t" \ - "rep;nop\n\t" \ - "cmpb $0,%0\n\t" \ - "jle 2b\n\t" \ - "jmp 1b\n" \ - LOCK_SECTION_END + "call __spin_lock_loop\n\t" #define spin_lock_string_flags \ - "\n1:\t" \ - "lock ; decb %0\n\t" \ - "js 2f\n\t" \ - LOCK_SECTION_START("") \ - "2:\t" \ - "testl $0x200, %1\n\t" \ - "jz 3f\n\t" \ - "sti\n\t" \ - "3:\t" \ - "rep;nop\n\t" \ - "cmpb $0, %0\n\t" \ - "jle 3b\n\t" \ - "cli\n\t" \ - "jmp 1b\n" \ - LOCK_SECTION_END + "call __spin_lock_loop_flags\n\t" /* * This works. Despite all the confusion. @@ -139,7 +116,7 @@ #endif __asm__ __volatile__( spin_lock_string - :"=m" (lock->lock) : : "memory"); + : : "a" (&lock->lock) : "memory"); } #define _raw_spin_lock_irq(lock) _raw_spin_lock_flags(lock, X86_EFLAGS_IF) @@ -155,7 +132,7 @@ #endif __asm__ __volatile__( spin_lock_string_flags - :"=m" (lock->lock) : "r" (flags) : "memory"); + : : "a" (&lock->lock), "b" (flags) : "memory"); } /*