Changeset View
Changeset View
Standalone View
Standalone View
sys/xen/xen-os.h
Show First 20 Lines • Show All 119 Lines • ▼ Show 20 Lines | |||||
* | * | ||||
* Those helpers are prefixed by xen_ because xen-os.h is widely included | * Those helpers are prefixed by xen_ because xen-os.h is widely included | ||||
* and we don't want the other drivers using them. | * and we don't want the other drivers using them. | ||||
* | * | ||||
*/ | */ | ||||
#define NBPL (NBBY * sizeof(long)) | #define NBPL (NBBY * sizeof(long)) | ||||
static inline bool | static inline bool | ||||
xen_test_bit(int bit, volatile long *addr) | xen_test_bit(u_int bit, volatile long *addr) | ||||
{ | { | ||||
unsigned long mask = 1UL << (bit % NBPL); | unsigned long mask = 1UL << (bit % NBPL); | ||||
return !!(atomic_load_acq_long(&addr[bit / NBPL]) & mask); | return !!(atomic_load_acq_long(&addr[bit / NBPL]) & mask); | ||||
} | } | ||||
static inline void | static inline void | ||||
xen_set_bit(int bit, volatile long *addr) | xen_set_bit(u_int bit, volatile long *addr) | ||||
{ | { | ||||
atomic_set_long(&addr[bit / NBPL], 1UL << (bit % NBPL)); | atomic_set_long(&addr[bit / NBPL], 1UL << (bit % NBPL)); | ||||
} | } | ||||
static inline void | static inline void | ||||
xen_clear_bit(int bit, volatile long *addr) | xen_clear_bit(u_int bit, volatile long *addr) | ||||
{ | { | ||||
atomic_clear_long(&addr[bit / NBPL], 1UL << (bit % NBPL)); | atomic_clear_long(&addr[bit / NBPL], 1UL << (bit % NBPL)); | ||||
} | } | ||||
#undef NBPL | #undef NBPL | ||||
/* | /* | ||||
* Functions to allocate/free unused memory in order | * Functions to allocate/free unused memory in order | ||||
Show All 21 Lines |