mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-11 21:13:11 +00:00
HV: add volatile declaration to pointer parameter
Add a volatile declaration to pointer parameter to avoid compiler to optimize it by using old value saved in register instead of accessing system memory. Signed-off-by: Zheng, Gen <gen.zheng@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
24ccdf2807
commit
8f3b36b224
@ -145,7 +145,7 @@ static inline int clz64(unsigned long value)
|
|||||||
* (*addr) |= (1UL<<nr);
|
* (*addr) |= (1UL<<nr);
|
||||||
*/
|
*/
|
||||||
#define build_bitmap_set(name, lock, nr, addr) \
|
#define build_bitmap_set(name, lock, nr, addr) \
|
||||||
static inline void name(int nr, unsigned long *addr) \
|
static inline void name(int nr, volatile unsigned long *addr) \
|
||||||
{ \
|
{ \
|
||||||
asm volatile(lock "orq %1,%0" \
|
asm volatile(lock "orq %1,%0" \
|
||||||
: "+m" (*addr) \
|
: "+m" (*addr) \
|
||||||
@ -159,7 +159,7 @@ build_bitmap_set(bitmap_set, BUS_LOCK, nr, addr)
|
|||||||
* (*addr) &= ~(1UL<<nr);
|
* (*addr) &= ~(1UL<<nr);
|
||||||
*/
|
*/
|
||||||
#define build_bitmap_clear(name, lock, nr, addr) \
|
#define build_bitmap_clear(name, lock, nr, addr) \
|
||||||
static inline void name(int nr, unsigned long *addr) \
|
static inline void name(int nr, volatile unsigned long *addr) \
|
||||||
{ \
|
{ \
|
||||||
asm volatile(lock "andq %1,%0" \
|
asm volatile(lock "andq %1,%0" \
|
||||||
: "+m" (*addr) \
|
: "+m" (*addr) \
|
||||||
@ -172,7 +172,7 @@ build_bitmap_clear(bitmap_clear, BUS_LOCK, nr, addr)
|
|||||||
/*
|
/*
|
||||||
* return !!((*addr) & (1UL<<nr));
|
* return !!((*addr) & (1UL<<nr));
|
||||||
*/
|
*/
|
||||||
static inline bool bitmap_test(int nr, unsigned long *addr)
|
static inline bool bitmap_test(int nr, volatile unsigned long *addr)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ static inline bool bitmap_test(int nr, unsigned long *addr)
|
|||||||
* return ret;
|
* return ret;
|
||||||
*/
|
*/
|
||||||
#define build_bitmap_testandset(name, lock, nr, addr) \
|
#define build_bitmap_testandset(name, lock, nr, addr) \
|
||||||
static inline bool name(int nr, unsigned long *addr) \
|
static inline bool name(int nr, volatile unsigned long *addr) \
|
||||||
{ \
|
{ \
|
||||||
int ret; \
|
int ret; \
|
||||||
asm volatile(lock "btsq %2,%1\n\tsbbl %0,%0" \
|
asm volatile(lock "btsq %2,%1\n\tsbbl %0,%0" \
|
||||||
@ -207,7 +207,7 @@ build_bitmap_testandset(bitmap_test_and_set, BUS_LOCK, nr, addr)
|
|||||||
* return ret;
|
* return ret;
|
||||||
*/
|
*/
|
||||||
#define build_bitmap_testandclear(name, lock, nr, addr) \
|
#define build_bitmap_testandclear(name, lock, nr, addr) \
|
||||||
static inline bool name(int nr, unsigned long *addr) \
|
static inline bool name(int nr, volatile unsigned long *addr) \
|
||||||
{ \
|
{ \
|
||||||
int ret; \
|
int ret; \
|
||||||
asm volatile(lock "btrq %2,%1\n\tsbbl %0,%0" \
|
asm volatile(lock "btrq %2,%1\n\tsbbl %0,%0" \
|
||||||
|
Loading…
Reference in New Issue
Block a user