Loading include/asm-x86/mutex_64.h +34 −39 Original line number Diff line number Diff line Loading @@ -23,12 +23,10 @@ do { \ typecheck(atomic_t *, v); \ typecheck_fn(void (*)(atomic_t *), fail_fn); \ \ __asm__ __volatile__( \ LOCK_PREFIX " decl (%%rdi) \n" \ asm volatile(LOCK_PREFIX " decl (%%rdi)\n" \ " jns 1f \n" \ " call " #fail_fn "\n" \ "1:" \ \ : "=D" (dummy) \ : "D" (v) \ : "rax", "rsi", "rdx", "rcx", \ Loading @@ -45,8 +43,7 @@ do { \ * it wasn't 1 originally. This function returns 0 if the fastpath succeeds, * or anything the slow path function returns */ static inline int __mutex_fastpath_lock_retval(atomic_t *count, static inline int __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) { if (unlikely(atomic_dec_return(count) < 0)) Loading @@ -69,12 +66,10 @@ do { \ typecheck(atomic_t *, v); \ typecheck_fn(void (*)(atomic_t *), fail_fn); \ \ __asm__ __volatile__( \ LOCK_PREFIX " incl (%%rdi) \n" \ asm volatile(LOCK_PREFIX " incl (%%rdi)\n" \ " jg 1f\n" \ " call " #fail_fn "\n" \ "1:" \ \ : "=D" (dummy) \ : "D" (v) \ : "rax", "rsi", "rdx", "rcx", \ Loading @@ -93,8 +88,8 @@ do { \ * if it wasn't 1 originally. [the fallback function is never used on * x86_64, because all x86_64 CPUs have a CMPXCHG instruction.] */ static inline int __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *)) static inline int __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *)) { if (likely(atomic_cmpxchg(count, 1, 0) == 1)) return 1; Loading Loading
include/asm-x86/mutex_64.h +34 −39 Original line number Diff line number Diff line Loading @@ -23,12 +23,10 @@ do { \ typecheck(atomic_t *, v); \ typecheck_fn(void (*)(atomic_t *), fail_fn); \ \ __asm__ __volatile__( \ LOCK_PREFIX " decl (%%rdi) \n" \ asm volatile(LOCK_PREFIX " decl (%%rdi)\n" \ " jns 1f \n" \ " call " #fail_fn "\n" \ "1:" \ \ : "=D" (dummy) \ : "D" (v) \ : "rax", "rsi", "rdx", "rcx", \ Loading @@ -45,8 +43,7 @@ do { \ * it wasn't 1 originally. This function returns 0 if the fastpath succeeds, * or anything the slow path function returns */ static inline int __mutex_fastpath_lock_retval(atomic_t *count, static inline int __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) { if (unlikely(atomic_dec_return(count) < 0)) Loading @@ -69,12 +66,10 @@ do { \ typecheck(atomic_t *, v); \ typecheck_fn(void (*)(atomic_t *), fail_fn); \ \ __asm__ __volatile__( \ LOCK_PREFIX " incl (%%rdi) \n" \ asm volatile(LOCK_PREFIX " incl (%%rdi)\n" \ " jg 1f\n" \ " call " #fail_fn "\n" \ "1:" \ \ : "=D" (dummy) \ : "D" (v) \ : "rax", "rsi", "rdx", "rcx", \ Loading @@ -93,8 +88,8 @@ do { \ * if it wasn't 1 originally. [the fallback function is never used on * x86_64, because all x86_64 CPUs have a CMPXCHG instruction.] */ static inline int __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *)) static inline int __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *)) { if (likely(atomic_cmpxchg(count, 1, 0) == 1)) return 1; Loading