]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseLib/X64/InterlockedCompareExchange64.c
Split out Synchronization Library from Base Library
[mirror_edk2.git] / MdePkg / Library / BaseLib / X64 / InterlockedCompareExchange64.c
index 8cd90b393ba6ed9024769a031a9c8f3675bb0726..0a88eda2eaf049b4331dc281f6c298b04caa20fa 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   InterlockedCompareExchange64 function\r
 \r
-  Copyright (c) 2006, Intel Corporation<BR>\r
+  Copyright (c) 2006 - 2008, Intel Corporation<BR>\r
   All rights reserved. This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
 \r
 **/\r
 \r
-#if _MSC_EXTENSIONS\r
+/**\r
+  Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.\r
+**/\r
 \r
-//\r
-// Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics\r
-//\r
 __int64 _InterlockedCompareExchange64(\r
    __int64 volatile * Destination,\r
    __int64 Exchange,\r
@@ -25,6 +24,22 @@ __int64 _InterlockedCompareExchange64(
 \r
 #pragma intrinsic(_InterlockedCompareExchange64)\r
 \r
+/**\r
+  Performs an atomic compare exchange operation on a 64-bit unsigned integer.\r
+\r
+  Performs an atomic compare exchange operation on the 64-bit unsigned integer specified\r
+  by Value.  If Value is equal to CompareValue, then Value is set to ExchangeValue and\r
+  CompareValue is returned.  If Value is not equal to CompareValue, then Value is returned.\r
+  The compare exchange operation must be performed using MP safe mechanisms.\r
+\r
+  @param  Value         A pointer to the 64-bit value for the compare exchange\r
+                        operation.\r
+  @param  CompareValue  64-bit value used in compare operation.\r
+  @param  ExchangeValue 64-bit value used in exchange operation.\r
+\r
+  @return The original *Value before exchange.\r
+\r
+**/\r
 UINT64\r
 EFIAPI\r
 InternalSyncCompareExchange64 (\r
@@ -36,4 +51,3 @@ InternalSyncCompareExchange64 (
   return _InterlockedCompareExchange64 (Value, ExchangeValue, CompareValue);\r
 }\r
 \r
-#endif\r