aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>2003-07-30 19:31:11 +0000
committerBruce Evans <bde@FreeBSD.org>2003-07-30 19:31:11 +0000
commite81dc827312ff1562e1db3bb907c6e4309f60578 (patch)
tree3d81d0fc31e600399564dbd012e6d3ed8b5c8ff0
parent23047d3472fb2771f3d19ac94d33fc8b83c506be (diff)
downloadsrc-e81dc827312ff1562e1db3bb907c6e4309f60578.tar.gz
src-e81dc827312ff1562e1db3bb907c6e4309f60578.zip
MFC (1.24: pass in the constraints on the V parameter so that the char
versions can be given different, non-bogus constraints). This is part of making some RELENG_3 kernels work when compiled by gcc-3.3. I started out only wanting them to compile, but had to test them for delicate changes like this. This change makes no difference for LINT compiled by the RELENG_3 compiler, except for vfs_cluster.o where it gives some differences related to register selection near an atomic_add_char().
Notes
Notes: svn path=/stable/3/; revision=118222
-rw-r--r--sys/i386/include/atomic.h38
1 files changed, 19 insertions, 19 deletions
diff --git a/sys/i386/include/atomic.h b/sys/i386/include/atomic.h
index 5471e0cace9f..6b4da95b47aa 100644
--- a/sys/i386/include/atomic.h
+++ b/sys/i386/include/atomic.h
@@ -65,7 +65,7 @@
* require different constraints in the asm statement.
*/
#if defined(KLD_MODULE)
-#define ATOMIC_ASM(NAME, TYPE, OP, V) \
+#define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \
extern void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v);
#else /* !KLD_MODULE */
@@ -79,34 +79,34 @@
* The assembly is volatilized to demark potential before-and-after side
* effects if an interrupt or SMP collision were to occur.
*/
-#define ATOMIC_ASM(NAME, TYPE, OP, V) \
+#define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \
static __inline void \
atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\
{ \
__asm __volatile(MPLOCKED OP \
: "=m" (*p) \
- : "ir" (V)); \
+ : CONS (V)); \
}
#endif /* KLD_MODULE */
-ATOMIC_ASM(set, char, "orb %1,%0", v)
-ATOMIC_ASM(clear, char, "andb %1,%0", ~v)
-ATOMIC_ASM(add, char, "addb %1,%0", v)
-ATOMIC_ASM(subtract, char, "subb %1,%0", v)
+ATOMIC_ASM(set, char, "orb %b1,%0", "iq", v)
+ATOMIC_ASM(clear, char, "andb %b1,%0", "iq", ~v)
+ATOMIC_ASM(add, char, "addb %b1,%0", "iq", v)
+ATOMIC_ASM(subtract, char, "subb %b1,%0", "iq", v)
-ATOMIC_ASM(set, short, "orw %1,%0", v)
-ATOMIC_ASM(clear, short, "andw %1,%0", ~v)
-ATOMIC_ASM(add, short, "addw %1,%0", v)
-ATOMIC_ASM(subtract, short, "subw %1,%0", v)
+ATOMIC_ASM(set, short, "orw %w1,%0", "ir", v)
+ATOMIC_ASM(clear, short, "andw %w1,%0", "ir", ~v)
+ATOMIC_ASM(add, short, "addw %w1,%0", "ir", v)
+ATOMIC_ASM(subtract, short, "subw %w1,%0", "ir", v)
-ATOMIC_ASM(set, int, "orl %1,%0", v)
-ATOMIC_ASM(clear, int, "andl %1,%0", ~v)
-ATOMIC_ASM(add, int, "addl %1,%0", v)
-ATOMIC_ASM(subtract, int, "subl %1,%0", v)
+ATOMIC_ASM(set, int, "orl %1,%0", "ir", v)
+ATOMIC_ASM(clear, int, "andl %1,%0", "ir", ~v)
+ATOMIC_ASM(add, int, "addl %1,%0", "ir", v)
+ATOMIC_ASM(subtract, int, "subl %1,%0", "ir", v)
-ATOMIC_ASM(set, long, "orl %1,%0", v)
-ATOMIC_ASM(clear, long, "andl %1,%0", ~v)
-ATOMIC_ASM(add, long, "addl %1,%0", v)
-ATOMIC_ASM(subtract, long, "subl %1,%0", v)
+ATOMIC_ASM(set, long, "orl %1,%0", "ir", v)
+ATOMIC_ASM(clear, long, "andl %1,%0", "ir", ~v)
+ATOMIC_ASM(add, long, "addl %1,%0", "ir", v)
+ATOMIC_ASM(subtract, long, "subl %1,%0", "ir", v)
#endif /* ! _MACHINE_ATOMIC_H_ */