patch-2.2.8 linux/include/asm-arm/proc-armo/semaphore.h

Next file: linux/include/asm-arm/proc-armv/io.h
Previous file: linux/include/asm-arm/proc-armo/ptrace.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.7/linux/include/asm-arm/proc-armo/semaphore.h linux/include/asm-arm/proc-armo/semaphore.h
@@ -13,17 +13,19 @@
 	__asm__ __volatile__ ("
 	@ atomic down operation
 	mov	r0, pc
-	orr	r1, r0, #0x08000000
+	orr	lr, r0, #0x08000000
 	and	r0, r0, #0x0c000003
-	teqp	r1, #0
-	ldr	r1, [%0]
-	subs	r1, r1, #1
-	str	r1, [%0]
-	mov	r1, pc, lsr #28
-	teqp	r0, r1, lsl #28
+	teqp	lr, #0
+	ldr	lr, [%0]
+	subs	lr, lr, #1
+	str	lr, [%0]
+	mov	lr, pc, lsr #28
+	teqp	r0, lr, lsl #28
 	movmi	r0, %0
-	blmi	" SYMBOL_NAME_STR(__down)
-		: : "r" (sem) : "r0", "r1", "r2", "r3", "ip", "lr", "cc");
+	blmi	" SYMBOL_NAME_STR(__down_failed)
+		:
+		: "r" (sem)
+		: "r0", "lr", "cc");
 }
 
 /*
@@ -36,22 +38,47 @@
 	__asm__ __volatile__ ("
 	@ atomic down operation
 	mov	r0, pc
-	orr	r1, r0, #0x08000000
+	orr	lr, r0, #0x08000000
 	and	r0, r0, #0x0c000003
-	teqp	r1, #0
-	ldr	r1, [%1]
-	subs	r1, r1, #1
-	str	r1, [%1]
-	mov	r1, pc, lsr #28
+	teqp	lr, #0
+	ldr	lr, [%1]
+	subs	lr, lr, #1
+	str	lr, [%1]
+	mov	lr, pc, lsr #28
 	orrmi	r0, r0, #0x80000000	@ set N
-	teqp	r0, r1, lsl #28
+	teqp	r0, lr, lsl #28
 	movmi	r0, %1
 	movpl	r0, #0
-	blmi	" SYMBOL_NAME_STR(__down_interruptible) "
+	blmi	" SYMBOL_NAME_STR(__down_interruptible_failed) "
 	mov	%0, r0"
 		: "=r" (result)
 		: "r" (sem)
-		: "r0", "r1", "r2", "r3", "ip", "lr", "cc");
+		: "r0", "lr", "cc");
+	return result;
+}
+
+extern inline int down_trylock(struct semaphore * sem)
+{
+	int result;
+	__asm__ __volatile__ ("
+	@ atomic down operation
+	mov	r0, pc
+	orr	lr, r0, #0x08000000
+	and	r0, r0, #0x0c000003
+	teqp	lr, #0
+	ldr	lr, [%1]
+	subs	lr, lr, #1
+	str	lr, [%1]
+	mov	lr, pc, lsr #28
+	orrmi	r0, r0, #0x80000000	@ set N
+	teqp	r0, lr, lsl #28
+	movmi	r0, %1
+	movpl	r0, #0
+	blmi	" SYMBOL_NAME_STR(__down_trylock_failed) "
+	mov	%0, r0"
+		: "=r" (result)
+		: "r" (sem)
+		: "r0", "lr", "cc");
 	return result;
 }
 
@@ -66,18 +93,20 @@
 	__asm__ __volatile__ ("
 	@ atomic up operation
 	mov	r0, pc
-	orr	r1, r0, #0x08000000
+	orr	lr, r0, #0x08000000
 	and	r0, r0, #0x0c000003
-	teqp	r1, #0
-	ldr	r1, [%0]
-	adds	r1, r1, #1
-	str	r1, [%0]
-	mov	r1, pc, lsr #28
+	teqp	lr, #0
+	ldr	lr, [%0]
+	adds	lr, lr, #1
+	str	lr, [%0]
+	mov	lr, pc, lsr #28
 	orrls	r0, r0, #0x80000000	@ set N
-	teqp	r0, r1, lsl #28
+	teqp	r0, lr, lsl #28
 	movmi	r0, %0
-	blmi	" SYMBOL_NAME_STR(__up)
-		: : "r" (sem) : "r0", "r1", "r2", "r3", "ip", "lr", "cc");
+	blmi	" SYMBOL_NAME_STR(__up_wakeup)
+		:
+		: "r" (sem)
+		: "r0", "lr", "cc");
 }
 
 #endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)