Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sh3/include Fix inline asm for tas.b. "=m" is not ...
details: https://anonhg.NetBSD.org/src/rev/3f7f449f8c75
branches: trunk
changeset: 748096:3f7f449f8c75
user: uwe <uwe%NetBSD.org@localhost>
date: Tue Oct 13 12:55:53 2009 +0000
description:
Fix inline asm for tas.b. "=m" is not restrictive enough and gcc may
decide to use addressing modes that tas.b does not support. 'V' is
advertised to be "non-offsettable" subset of 'm' but there's a bug in
gcc that prevents "=V" from working.
When in doubt use brute force, so pass lock pointer as "r" input and
declare "memory" as clobbered.
Landisk kernel diff is 5 instructions (register choice for lock
address in __cpu_simple_lock_try).
sys/dev/raidframe/rf_copyback.c - where old __asm triggered incorrect code
- successfully compiles (as part of sys/rump/dev/lib/libraidframe).
diffstat:
sys/arch/sh3/include/lock.h | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diffs (42 lines):
diff -r f8f9df8dc4c5 -r 3f7f449f8c75 sys/arch/sh3/include/lock.h
--- a/sys/arch/sh3/include/lock.h Tue Oct 13 12:38:14 2009 +0000
+++ b/sys/arch/sh3/include/lock.h Tue Oct 13 12:55:53 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lock.h,v 1.15 2008/04/28 20:23:35 martin Exp $ */
+/* $NetBSD: lock.h,v 1.16 2009/10/13 12:55:53 uwe Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -81,11 +81,11 @@
{
__asm volatile(
- "1: tas.b %0 \n"
+ "1: tas.b @%0 \n"
" bf 1b \n"
- : "=m" (*alp)
- : /* no inputs */
- : "cc");
+ : /* no outputs */
+ : "r" (alp)
+ : "cc", "memory");
}
static __inline int
@@ -94,11 +94,11 @@
int __rv;
__asm volatile(
- " tas.b %0 \n"
- " movt %1 \n"
- : "=m" (*alp), "=r" (__rv)
- : /* no inputs */
- : "cc");
+ " tas.b @%1 \n"
+ " movt %0 \n"
+ : "=r" (__rv)
+ : "r" (alp)
+ : "cc", "memory");
return (__rv);
}
Home |
Main Index |
Thread Index |
Old Index