From ec13f4e1f2a765aa7aed2ff4988937259a760e83 Mon Sep 17 00:00:00 2001 From: Zhao Yakui Date: Fri, 20 Apr 2018 10:42:09 +0800 Subject: [PATCH] HV:Remove the "immediate" constraint for inline assembly in bits operation The input operand for inline assembly is passed from the caller. And they are not the immediate type. Instead the register should be used. This also helps to reduce the compile error if the optimizatin is enabled. Signed-off-by: Zhao Yakui Acked-by: Eddie Dong --- hypervisor/include/lib/bits.h | 44 +++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/hypervisor/include/lib/bits.h b/hypervisor/include/lib/bits.h index dbe73bec8..9d6538a3b 100644 --- a/hypervisor/include/lib/bits.h +++ b/hypervisor/include/lib/bits.h @@ -38,7 +38,7 @@ static inline void atomic_set_char(unsigned char *p, unsigned char v) { __asm __volatile(BUS_LOCK "orb %b1,%0" : "+m" (*p) - : "iq" (v) + : "q" (v) : "cc", "memory"); } @@ -49,7 +49,7 @@ static inline void atomic_clear_char(unsigned char *p, unsigned char v) { __asm __volatile(BUS_LOCK "andb %b1,%0" : "+m" (*p) - : "iq" (~v) + : "q" (~v) : "cc", "memory"); } @@ -60,7 +60,7 @@ static inline void atomic_add_char(unsigned char *p, unsigned char v) { __asm __volatile(BUS_LOCK "addb %b1,%0" : "+m" (*p) - : "iq" (v) + : "q" (v) : "cc", "memory"); } @@ -71,7 +71,7 @@ static inline void atomic_subtract_char(unsigned char *p, unsigned char v) { __asm __volatile(BUS_LOCK "subb %b1,%0" : "+m" (*p) - : "iq" (v) + : "q" (v) : "cc", "memory"); } @@ -82,7 +82,7 @@ static inline void atomic_set_short(unsigned short *p, unsigned short v) { __asm __volatile(BUS_LOCK "orw %w1,%0" : "+m" (*p) - : "ir" (v) + : "r" (v) : "cc", "memory"); } @@ -93,7 +93,7 @@ static inline void atomic_clear_short(unsigned short *p, unsigned short v) { __asm __volatile(BUS_LOCK "andw %w1,%0" : "+m" (*p) - : "ir" (~v) + : "r" (~v) : "cc", "memory"); } @@ -104,7 +104,7 @@ static inline void atomic_add_short(unsigned short *p, unsigned short v) { __asm __volatile(BUS_LOCK "addw %w1,%0" : "+m" (*p) - : "ir" (v) + : "r" (v) : "cc", "memory"); } @@ -115,7 +115,7 @@ static inline void atomic_subtract_short(unsigned short *p, unsigned short v) { __asm __volatile(BUS_LOCK "subw %w1,%0" : "+m" (*p) - : "ir" (v) + : "r" (v) : "cc", "memory"); } @@ -126,7 +126,7 @@ static inline void atomic_set_int(unsigned int *p, unsigned int v) { __asm __volatile(BUS_LOCK "orl %1,%0" : "+m" (*p) - : "ir" (v) + : "r" (v) : "cc", "memory"); } @@ -137,7 +137,7 @@ static inline void atomic_clear_int(unsigned int *p, unsigned int v) { __asm __volatile(BUS_LOCK "andl %1,%0" : "+m" (*p) - : "ir" (~v) + : "r" (~v) : "cc", "memory"); } @@ -148,7 +148,7 @@ static inline void atomic_add_int(unsigned int *p, unsigned int v) { __asm __volatile(BUS_LOCK "addl %1,%0" : "+m" (*p) - : "ir" (v) + : "r" (v) : "cc", "memory"); } @@ -159,7 +159,7 @@ static inline void atomic_subtract_int(unsigned int *p, unsigned int v) { __asm __volatile(BUS_LOCK "subl %1,%0" : "+m" (*p) - : "ir" (v) + : "r" (v) : "cc", "memory"); } @@ -189,7 +189,7 @@ static inline void atomic_set_long(unsigned long *p, unsigned long v) { __asm __volatile(BUS_LOCK "orq %1,%0" : "+m" (*p) - : "ir" (v) + : "r" (v) : "cc", "memory"); } @@ -200,7 +200,7 @@ static inline void atomic_clear_long(unsigned long *p, unsigned long v) { __asm __volatile(BUS_LOCK "andq %1,%0" : "+m" (*p) - : "ir" (~v) + : "r" (~v) : "cc", "memory"); } @@ -211,7 +211,7 @@ static inline void atomic_add_long(unsigned long *p, unsigned long v) { __asm __volatile(BUS_LOCK "addq %1,%0" : "+m" (*p) - : "ir" (v) + : "r" (v) : "cc", "memory"); } @@ -222,7 +222,7 @@ static inline void atomic_subtract_long(unsigned long *p, unsigned long v) { __asm __volatile(BUS_LOCK "subq %1,%0" : "+m" (*p) - : "ir" (v) + : "r" (v) : "cc", "memory"); } @@ -439,7 +439,7 @@ bitmap_set(int mask, unsigned long *bits) /* (*bits) |= (1UL<