From 47158504d44a151c61461ba1acdef5b4240bdc30 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Mon, 4 Apr 2011 10:36:12 -0700 Subject: [PATCH] com32, bitops: an "m" constraint takes an object, not a pointer to one The argument to an "m" constraint is an object, not a pointer to an object. For a void pointer it needs to be cast to an indirectable type (like char) and then indirected. Reported-by: Matt Fleming Signed-off-by: H. Peter Anvin --- com32/include/sys/bitops.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/com32/include/sys/bitops.h b/com32/include/sys/bitops.h index bfc09d7..33bb0aa 100644 --- a/com32/include/sys/bitops.h +++ b/com32/include/sys/bitops.h @@ -38,12 +38,16 @@ static inline void set_bit(long __bit, void *__bitmap) { - asm volatile("btsl %1,%0" : "+m" (__bitmap) : "Ir" (__bit) : "memory"); + asm volatile("btsl %1,%0" + : "+m" (*(unsigned char *)__bitmap) + : "Ir" (__bit) : "memory"); } static inline void clr_bit(long __bit, void *__bitmap) { - asm volatile("btcl %1,%0" : "+m" (__bitmap) : "Ir" (__bit) : "memory"); + asm volatile("btcl %1,%0" + : "+m" (*(unsigned char *)__bitmap) + : "Ir" (__bit) : "memory"); } static inline int __purefunc test_bit(long __bit, const void *__bitmap) @@ -51,7 +55,7 @@ static inline int __purefunc test_bit(long __bit, const void *__bitmap) unsigned char __r; asm("btl %2,%1; setc %0" : "=r" (__r) - : "m" (__bitmap), "Ir" (__bit)); + : "m" (*(const unsigned char *)__bitmap), "Ir" (__bit)); return __r; } -- 2.7.4