Add xen_atomic_cmpxchg16(), which exports the cmpxchgw instruction to C.
This commit is contained in:
parent
2e6c8a97d2
commit
fa2d4a51e2
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: xen.h,v 1.20 2006/02/16 20:17:15 perry Exp $ */
|
||||
/* $NetBSD: xen.h,v 1.21 2006/03/06 19:55:47 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -201,6 +201,20 @@ xen_atomic_xchg(volatile XATOMIC_T *ptr, unsigned long val)
|
|||
return result;
|
||||
}
|
||||
|
||||
static inline uint16_t
|
||||
xen_atomic_cmpxchg16(volatile uint16_t *ptr, uint16_t val, uint16_t newval)
|
||||
{
|
||||
unsigned long result;
|
||||
|
||||
__asm volatile(__LOCK_PREFIX
|
||||
"cmpxchgw %w1,%2"
|
||||
:"=a" (result)
|
||||
:"q"(newval), "m" (*ptr), "0" (val)
|
||||
:"memory");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static __inline void
|
||||
xen_atomic_setbits_l (volatile XATOMIC_T *ptr, unsigned long bits) {
|
||||
__asm volatile("lock ; orl %1,%0" : "=m" (*ptr) : "ir" (bits));
|
||||
|
|
Loading…
Reference in New Issue