From 7803e9735dde445be3046a79bf1b4ca5ab525ac1 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 2 May 2015 20:53:54 +0200 Subject: Fix semaphore failure path special calling convention * linux/src/include/asm-i386/semaphore.h (down): Pass semaphore address to down_failed through ecx. (down_interruptible): Likewise to down_failed_interruptible. (up): Likewise to up_wakeup. --- linux/src/include/asm-i386/semaphore.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/linux/src/include/asm-i386/semaphore.h b/linux/src/include/asm-i386/semaphore.h index 2a5f5b7..c351c3a 100644 --- a/linux/src/include/asm-i386/semaphore.h +++ b/linux/src/include/asm-i386/semaphore.h @@ -30,6 +30,10 @@ struct semaphore { #define MUTEX ((struct semaphore) { 1, 0, 0, NULL }) #define MUTEX_LOCKED ((struct semaphore) { 0, 0, 0, NULL }) +/* Special register calling convention: + * eax contains return address + * ecx contains semaphore address + */ asmlinkage void down_failed(void /* special register calling convention */); asmlinkage void up_wakeup(void /* special register calling convention */); @@ -54,7 +58,7 @@ extern inline void down(struct semaphore * sem) "js " SYMBOL_NAME_STR(down_failed) "\n" "1:\n" :"=&a" (d0), "=m" (sem->count) - : + :"c" (sem) :"memory"); } @@ -97,7 +101,7 @@ extern inline int down_interruptible(struct semaphore * sem) "xorl %%eax,%%eax\n" "2:\n" :"=&a" (ret), "=m" (sem->count) - : + :"c" (sem) :"memory"); return(ret) ; @@ -122,7 +126,7 @@ extern inline void up(struct semaphore * sem) "jle " SYMBOL_NAME_STR(up_wakeup) "\n1:" :"=&a" (d0), "=m" (sem->count) - : + :"c" (sem) :"memory"); } -- cgit v1.2.3