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

[Xen-devel] [PATCH RFC 10/18] OvmfPkg/XenbusDxe: Add TestAndClearBit.



This atomically test and clear a bit.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
 OvmfPkg/XenbusDxe/X64/TestAndClearBit.S | 10 ++++++++++
 OvmfPkg/XenbusDxe/XenbusDxe.h           | 11 +++++++++++
 OvmfPkg/XenbusDxe/XenbusDxe.inf         |  1 +
 3 files changed, 22 insertions(+)
 create mode 100644 OvmfPkg/XenbusDxe/X64/TestAndClearBit.S

diff --git a/OvmfPkg/XenbusDxe/X64/TestAndClearBit.S 
b/OvmfPkg/XenbusDxe/X64/TestAndClearBit.S
new file mode 100644
index 0000000..e266f68
--- /dev/null
+++ b/OvmfPkg/XenbusDxe/X64/TestAndClearBit.S
@@ -0,0 +1,10 @@
+# TestAndClearBit (
+#   IN  INT32 Bit,                // rcx
+#   IN  volatile VOID* Address    // rdx
+#   );
+ASM_GLOBAL ASM_PFX(TestAndClearBit)
+ASM_PFX(TestAndClearBit):
+  lock
+  btrl %ecx, (%rdx)
+  sbbl %eax, %eax
+  ret
diff --git a/OvmfPkg/XenbusDxe/XenbusDxe.h b/OvmfPkg/XenbusDxe/XenbusDxe.h
index 975fb6b..50d0925 100644
--- a/OvmfPkg/XenbusDxe/XenbusDxe.h
+++ b/OvmfPkg/XenbusDxe/XenbusDxe.h
@@ -94,4 +94,15 @@ struct _XENBUS_DEVICE {
   shared_info_t                 *SharedInfo;
 };
 
+/*
+ * Helpers
+ */
+
+INT32
+EFIAPI
+TestAndClearBit (
+  IN INT32 Bit,
+  IN volatile VOID *Address
+  );
+
 #endif
diff --git a/OvmfPkg/XenbusDxe/XenbusDxe.inf b/OvmfPkg/XenbusDxe/XenbusDxe.inf
index d4007db..dc27c13 100644
--- a/OvmfPkg/XenbusDxe/XenbusDxe.inf
+++ b/OvmfPkg/XenbusDxe/XenbusDxe.inf
@@ -43,6 +43,7 @@
   X64/hypercall.S
   X64/hypercall.asm
   X64/InterlockedCompareExchange16.c | GCC
+  X64/TestAndClearBit.S
 
 [LibraryClasses]
   UefiDriverEntryPoint
-- 
Anthony PERARD


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.