[PATCH kvm-unit-tests 1/9] x86: lib: Introduce utils for btr/bts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Liran Alon <liran.alon@xxxxxxxxxx>
Signed-off-by: Jim Mattson <jmattson@xxxxxxxxxx>
---
 lib/x86/processor.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib/x86/processor.h b/lib/x86/processor.h
index e850029173ab..89ee528a2e36 100644
--- a/lib/x86/processor.h
+++ b/lib/x86/processor.h
@@ -443,4 +443,16 @@ static inline bool is_canonical(u64 addr)
 	return (s64)(addr << 16) >> 16 == addr;
 }
 
+static inline void clear_bit(int bit, u8 *addr)
+{
+	__asm__ __volatile__("btr %1, %0"
+			     : "+m" (*addr) : "Ir" (bit) : "cc", "memory");
+}
+
+static inline void set_bit(int bit, u8 *addr)
+{
+	__asm__ __volatile__("bts %1, %0"
+			     : "+m" (*addr) : "Ir" (bit) : "cc", "memory");
+}
+
 #endif
-- 
1.9.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux