diff -purN sem-10/arch/i386/kernel/Makefile sem-20/arch/i386/kernel/Makefile --- sem-10/arch/i386/kernel/Makefile 2005-04-21 12:03:36.000000000 -0400 +++ sem-20/arch/i386/kernel/Makefile 2005-04-27 17:30:01.000000000 -0400 @@ -32,6 +32,7 @@ obj-$(CONFIG_ACPI_SRAT) += srat.o obj-$(CONFIG_HPET_TIMER) += time_hpet.o obj-$(CONFIG_EFI) += efi.o efi_stub.o obj-$(CONFIG_EARLY_PRINTK) += early_printk.o +obj-$(CONFIG_SMP) += rwlock.o EXTRA_AFLAGS := -traditional diff -purN sem-10/arch/i386/kernel/rwlock.c sem-20/arch/i386/kernel/rwlock.c --- sem-10/arch/i386/kernel/rwlock.c 1969-12-31 19:00:00.000000000 -0500 +++ sem-20/arch/i386/kernel/rwlock.c 2005-04-27 17:30:01.000000000 -0400 @@ -0,0 +1,50 @@ +/* + * i386 rwlock fallbacks + * + * (C) Copyright 1999 Linus Torvalds + * + * Portions Copyright 1999 Red Hat, Inc. + * + * 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; either version + * 2 of the License, or (at your option) any later version. + * + * rw semaphores implemented November 1999 by Benjamin LaHaise + */ +#include +#include +#include + +/* + * rw spinlock fallbacks + */ +#if defined(CONFIG_SMP) +asm( +".section .sched.text\n" +".align 4\n" +".globl __write_lock_failed\n" +"__write_lock_failed:\n\t" + LOCK "addl $" RW_LOCK_BIAS_STR ",(%eax)\n" +"1: rep; nop\n\t" + "cmpl $" RW_LOCK_BIAS_STR ",(%eax)\n\t" + "jne 1b\n\t" + LOCK "subl $" RW_LOCK_BIAS_STR ",(%eax)\n\t" + "jnz __write_lock_failed\n\t" + "ret" +); + +asm( +".section .sched.text\n" +".align 4\n" +".globl __read_lock_failed\n" +"__read_lock_failed:\n\t" + LOCK "incl (%eax)\n" +"1: rep; nop\n\t" + "cmpl $1,(%eax)\n\t" + "js 1b\n\t" + LOCK "decl (%eax)\n\t" + "js __read_lock_failed\n\t" + "ret" +); +#endif diff -purN sem-10/arch/i386/kernel/semaphore.c sem-20/arch/i386/kernel/semaphore.c --- sem-10/arch/i386/kernel/semaphore.c 2005-04-27 17:29:30.000000000 -0400 +++ sem-20/arch/i386/kernel/semaphore.c 2005-04-27 17:30:01.000000000 -0400 @@ -262,36 +262,3 @@ asm( "popl %edx\n\t" "ret" ); - -/* - * rw spinlock fallbacks - */ -#if defined(CONFIG_SMP) -asm( -".section .sched.text\n" -".align 4\n" -".globl __write_lock_failed\n" -"__write_lock_failed:\n\t" - LOCK "addl $" RW_LOCK_BIAS_STR ",(%eax)\n" -"1: rep; nop\n\t" - "cmpl $" RW_LOCK_BIAS_STR ",(%eax)\n\t" - "jne 1b\n\t" - LOCK "subl $" RW_LOCK_BIAS_STR ",(%eax)\n\t" - "jnz __write_lock_failed\n\t" - "ret" -); - -asm( -".section .sched.text\n" -".align 4\n" -".globl __read_lock_failed\n" -"__read_lock_failed:\n\t" - LOCK "incl (%eax)\n" -"1: rep; nop\n\t" - "cmpl $1,(%eax)\n\t" - "js 1b\n\t" - LOCK "decl (%eax)\n\t" - "js __read_lock_failed\n\t" - "ret" -); -#endif