atomic: fix position of volatile qualifier

What needs to be volatile is not the pointer, but the pointed-to
value!

Backports commit 2cbcfb281afa041a41f6e4c4da0f5c9314084604 from qemu
This commit is contained in:
Paolo Bonzini 2018-02-22 15:52:14 -05:00 committed by Lioncash
parent e79e0881cd
commit 02e3eeff40
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7

View File

@ -138,11 +138,11 @@ void _ReadWriteBarrier(void);
#endif
#ifndef atomic_read
#define atomic_read(ptr) (*(__typeof__(*ptr) *volatile) (ptr))
#define atomic_read(ptr) (*(__typeof__(*ptr) volatile*) (ptr))
#endif
#ifndef atomic_set
#define atomic_set(ptr, i) ((*(__typeof__(*ptr) *volatile) (ptr)) = (i))
#define atomic_set(ptr, i) ((*(__typeof__(*ptr) volatile*) (ptr)) = (i))
#endif
/* These have the same semantics as Java volatile variables.