From: Jan Beulich Date: Tue, 12 Mar 2019 13:43:50 +0000 (+0100) Subject: Arm/atomic: parameterize register modifier macro arguments X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~2495 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6233b297c968c0c1305a73ae7cc7b4cbffb7eb5c;p=xen.git Arm/atomic: parameterize register modifier macro arguments Make the abstracting macros take the asm() operand specifier as argument, in preparation of doing away with the split u64 read/write definitions. Signed-off-by: Jan Beulich Reviewed-by: Julien Grall --- diff --git a/xen/include/asm-arm/atomic.h b/xen/include/asm-arm/atomic.h index 4d5d452bda..a1d77c18d9 100644 --- a/xen/include/asm-arm/atomic.h +++ b/xen/include/asm-arm/atomic.h @@ -9,7 +9,7 @@ static inline type name(const volatile type *addr) \ { \ type ret; \ - asm volatile("ldr" size " %" width "0,%1" \ + asm volatile("ldr" size " %" width(0) ",%1" \ : "=r" (ret) \ : "m" (*(volatile type *)addr)); \ return ret; \ @@ -18,7 +18,7 @@ static inline type name(const volatile type *addr) \ #define build_atomic_write(name, size, width, type) \ static inline void name(volatile type *addr, type val) \ { \ - asm volatile("str" size " %"width"1,%0" \ + asm volatile("str" size " %" width(1) ",%0" \ : "=m" (*(volatile type *)addr) \ : "r" (val)); \ } @@ -27,19 +27,20 @@ static inline void name(volatile type *addr, type val) \ static inline void name(volatile type *addr, type val) \ { \ type t; \ - asm volatile("ldr" size " %"width"1,%0\n" \ - "add %"width"1,%"width"1,%"width"2\n" \ - "str" size " %"width"1,%0" \ + asm volatile("ldr" size " %" width(1) ",%0\n" \ + "add %" width(1) ",%" width(1) ",%" width(2) "\n" \ + "str" size " %" width(1) ",%0" \ : "+m" (*addr), "=&r" (t) \ : "ri" (val)); \ } #if defined (CONFIG_ARM_32) -#define BYTE "" -#define WORD "" +#define BYTE(n) #n +#define WORD(n) #n #elif defined (CONFIG_ARM_64) -#define BYTE "w" -#define WORD "w" +#define BYTE(n) "w" #n +#define WORD(n) "w" #n +#define DWORD(n) "" #n #endif build_atomic_read(read_u8_atomic, "b", BYTE, uint8_t) @@ -53,8 +54,8 @@ build_atomic_write(write_u32_atomic, "", WORD, uint32_t) build_atomic_write(write_int_atomic, "", WORD, int) #if defined (CONFIG_ARM_64) -build_atomic_read(read_u64_atomic, "", "", uint64_t) -build_atomic_write(write_u64_atomic, "", "", uint64_t) +build_atomic_read(read_u64_atomic, "", DWORD, uint64_t) +build_atomic_write(write_u64_atomic, "", DWORD, uint64_t) #elif defined (CONFIG_ARM_32) static inline uint64_t read_u64_atomic(const volatile uint64_t *addr) {