patch-2.1.23 linux/arch/i386/lib/locks.S

Next file: linux/arch/i386/mm/fault.c
Previous file: linux/arch/i386/lib/Makefile
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.22/linux/arch/i386/lib/locks.S linux/arch/i386/lib/locks.S
@@ -0,0 +1,33 @@
+/* locks.S: Wheee... I'm coding Intel assembly...
+ *
+ * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
+ */
+
+#include <linux/linkage.h>
+
+	/* Caller does atomic increment on current->lock_depth,
+	 * if it was found to originally be zero then we get here,
+	 * %eax contains callers PC and %edx holds this cpu ID.
+	 */
+ENTRY(__lock_kernel)
+	pushl	%eax		! return address
+1:
+	lock
+	btsl	$0, SYMBOL_NAME(kernel_flag)
+	jnc	3f
+2:
+	btl	%dl, SYMBOL_NAME(smp_invalidate_needed)
+	jnc	0f
+	lock
+	btrl	%dl, SYMBOL_NAME(smp_invalidate_needed)
+	jnc	0f
+	movl	%cr3, %eax
+	movl	%eax, %cr3
+0:
+	btl	$0, SYMBOL_NAME(kernel_flag)
+	jc	2b
+	jmp	1b
+
+3:
+	movb	%dl, SYMBOL_NAME(active_kernel_processor)
+	ret

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov