浏览代码

[PATCH] Use early clobber in semaphores

New code clobbers the result always early, so tell gcc about it
Signed-off-by: Andi Kleen <ak@suse.de>
Andi Kleen 18 年之前
父节点
当前提交
c84ef53059
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      include/asm-x86_64/semaphore.h

+ 2 - 2
include/asm-x86_64/semaphore.h

@@ -132,7 +132,7 @@ static inline int down_interruptible(struct semaphore * sem)
 		"jns 2f\n\t"
 		"call __down_failed_interruptible\n"
 		"2:\n"
-		:"=a" (result), "=m" (sem->count)
+		:"=&a" (result), "=m" (sem->count)
 		:"D" (sem)
 		:"memory");
 	return result;
@@ -153,7 +153,7 @@ static inline int down_trylock(struct semaphore * sem)
 		"jns 2f\n\t"
 		"call __down_failed_trylock\n\t"
 		"2:\n"
-		:"=a" (result), "=m" (sem->count)
+		:"=&a" (result), "=m" (sem->count)
 		:"D" (sem)
 		:"memory","cc");
 	return result;