Note in that TAS.B in inline asm clobbers "cc".

Use MOVT instead of clear+rotate with carry in __cpu_simple_lock_try.
This commit is contained in:
uwe 2007-03-12 01:33:50 +00:00
parent d96c2a32bc
commit 11957bf405
1 changed files with 8 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lock.h,v 1.11 2007/02/09 21:55:12 ad Exp $ */
/* $NetBSD: lock.h,v 1.12 2007/03/12 01:33:50 uwe Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -66,7 +66,9 @@ __cpu_simple_lock(__cpu_simple_lock_t *alp)
__asm volatile(
"1: tas.b %0 \n"
" bf 1b \n"
: "=m" (*alp));
: "=m" (*alp)
: /* no inputs */
: "cc");
}
static __inline int
@ -76,9 +78,10 @@ __cpu_simple_lock_try(__cpu_simple_lock_t *alp)
__asm volatile(
" tas.b %0 \n"
" mov #0, %1 \n"
" rotcl %1 \n"
: "=m" (*alp), "=r" (__rv));
" movt %1 \n"
: "=m" (*alp), "=r" (__rv)
: /* no inputs */
: "cc");
return (__rv);
}