diff options
Diffstat (limited to 'sys/dev/pv/xenvar.h')
-rw-r--r-- | sys/dev/pv/xenvar.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/dev/pv/xenvar.h b/sys/dev/pv/xenvar.h index a3cb403499a..428002d6a72 100644 --- a/sys/dev/pv/xenvar.h +++ b/sys/dev/pv/xenvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: xenvar.h,v 1.34 2016/08/03 14:55:58 mikeb Exp $ */ +/* $OpenBSD: xenvar.h,v 1.35 2016/08/03 17:14:41 mikeb Exp $ */ /* * Copyright (c) 2015 Mike Belopuhov @@ -144,6 +144,18 @@ struct xs_transaction { }; static inline int +atomic_setbit_ptr(volatile void *ptr, int bit) +{ + int obit; + + __asm__ __volatile__ ("lock btsl %2,%1; sbbl %0,%0" : + "=r" (obit), "=m" (*(volatile long *)ptr) : "Ir" (bit) : + "memory"); + + return (obit); +} + +static inline int atomic_clearbit_ptr(volatile void *ptr, int bit) { int obit; |