voron

experimental ARM OS
git clone git://git.2f30.org/voron
Log | Files | Refs | README | LICENSE

commit 5fda517df305792ab2430c287130ebfbd8c98adf
parent 4afc94ef43c676b8a0addd1850a6dfa571b674d7
Author: oblique <psyberbits@gmail.com>
Date:   Mon, 29 Oct 2012 13:41:09 +0200

fix a bug in spinlock_trylock()

Diffstat:
Minclude/spinlock.h | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/spinlock.h b/include/spinlock.h @@ -16,7 +16,7 @@ spinlock_lock(spinlock_t *sl) "1: \n\t" "ldrex v1, [%0] \n\t" "teq v1, #0 \n\t" - /* wait for event */ + /* wait for event if it's lock */ "wfene \n\t" "bne 1b \n\t" "strex v1, %1, [%0] \n\t" @@ -41,7 +41,7 @@ spinlock_unlock(spinlock_t *sl) ); dsb(); /* signal event */ - asm volatile("sev"); + asm volatile("sev" : : : "memory"); } /* returns 1 if locked and 0 if not */ @@ -54,7 +54,7 @@ spinlock_trylock(spinlock_t *sl) "ldrex %0, [%1] \n\t" "teq %0, #0 \n\t" "strexeq %0, %2, [%1] \n\t" - : "=r" (tmp) + : "=&r" (tmp) : "r" (sl), "r" (0x80000000) : "memory" );