From 75a78c0eb4ed2d4bb9b461c4dae8aa71804b238b Mon Sep 17 00:00:00 2001
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Fri, 1 May 2015 19:35:50 +0200
Subject: Replace clobbers with earlyclobbers

Newer gccs consider the former "impossible"

* linux/src/include/asm-i386/bitops.h (find_first_zero_bit): Replace
clobbers with earlyclobbers.
* linux/src/include/asm-i386/semaphore.h (down, down_interruptible, up):
Likewise.
---
 linux/src/include/asm-i386/bitops.h    |  6 +++---
 linux/src/include/asm-i386/semaphore.h | 26 ++++++++++++++------------
 2 files changed, 17 insertions(+), 15 deletions(-)

(limited to 'linux/src')

diff --git a/linux/src/include/asm-i386/bitops.h b/linux/src/include/asm-i386/bitops.h
index fc4cf192..0bfa9fd3 100644
--- a/linux/src/include/asm-i386/bitops.h
+++ b/linux/src/include/asm-i386/bitops.h
@@ -108,6 +108,7 @@ extern __inline__ int test_bit(int nr, const SMPVOL void * addr)
  */
 extern __inline__ int find_first_zero_bit(void * addr, unsigned size)
 {
+	int d0, d1, d2;
 	int res;
 
 	if (!size)
@@ -123,9 +124,8 @@ extern __inline__ int find_first_zero_bit(void * addr, unsigned size)
 		"1:\tsubl %%ebx,%%edi\n\t"
 		"shll $3,%%edi\n\t"
 		"addl %%edi,%%edx"
-		:"=d" (res)
-		:"c" ((size + 31) >> 5), "D" (addr), "b" (addr)
-		:"ax", "cx", "di");
+		:"=d" (res), "=&c" (d0), "=&D" (d1), "=&a" (d2)
+		:"1" ((size + 31) >> 5), "2" (addr), "b" (addr));
 	return res;
 }
 
diff --git a/linux/src/include/asm-i386/semaphore.h b/linux/src/include/asm-i386/semaphore.h
index 1486d1c1..2a5f5b78 100644
--- a/linux/src/include/asm-i386/semaphore.h
+++ b/linux/src/include/asm-i386/semaphore.h
@@ -43,18 +43,19 @@ extern void __up(struct semaphore * sem);
  */
 extern inline void down(struct semaphore * sem)
 {
+	int d0;
 	__asm__ __volatile__(
 		"# atomic down operation\n\t"
 		"movl $1f,%%eax\n\t"
 #ifdef __SMP__
 		"lock ; "
 #endif
-		"decl 0(%0)\n\t"
+		"decl %1\n\t"
 		"js " SYMBOL_NAME_STR(down_failed) "\n"
 		"1:\n"
-		:/* no outputs */
-		:"c" (sem)
-		:"ax","dx","memory");
+		:"=&a" (d0), "=m" (sem->count)
+		:
+		:"memory");
 }
 
 /*
@@ -91,13 +92,13 @@ extern inline int down_interruptible(struct semaphore * sem)
 #ifdef __SMP__
                 "lock ; "
 #endif
-                "decl 0(%1)\n\t"
+                "decl %1\n\t"
                 "js " SYMBOL_NAME_STR(down_failed_interruptible) "\n\t"
                 "xorl %%eax,%%eax\n"
                 "2:\n"
-                :"=a" (ret)
-                :"c" (sem)
-                :"ax","dx","memory");
+                :"=&a" (ret), "=m" (sem->count)
+                :
+                :"memory");
 
 	return(ret) ;
 }
@@ -110,18 +111,19 @@ extern inline int down_interruptible(struct semaphore * sem)
  */
 extern inline void up(struct semaphore * sem)
 {
+	int d0;
 	__asm__ __volatile__(
 		"# atomic up operation\n\t"
 		"movl $1f,%%eax\n\t"
 #ifdef __SMP__
 		"lock ; "
 #endif
-		"incl 0(%0)\n\t"
+		"incl %1\n\t"
 		"jle " SYMBOL_NAME_STR(up_wakeup)
 		"\n1:"
-		:/* no outputs */
-		:"c" (sem)
-		:"ax", "dx", "memory");
+		:"=&a" (d0), "=m" (sem->count)
+		:
+		:"memory");
 }
 
 #endif
-- 
cgit v1.2.3