--- /dev/null
+# UINT16\r
+# EFIAPI\r
+# InternalSyncCompareExchange16 (\r
+# IN volatile UINT16 *Value,\r
+# IN UINT16 CompareValue,\r
+# IN UINT16 ExchangeValue\r
+# );\r
+ASM_GLOBAL ASM_PFX(InternalSyncCompareExchange16)\r
+ASM_PFX(InternalSyncCompareExchange16):\r
+ mov 4(%esp), %ecx\r
+ mov 8(%esp), %eax\r
+ mov 12(%esp), %edx\r
+ lock\r
+ cmpxchgw %dx, (%ecx)\r
+ ret\r
--- /dev/null
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
+; 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
+; http://opensource.org/licenses/bsd-license.php.\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+; InterlockedCompareExchange16.Asm\r
+;\r
+; Abstract:\r
+;\r
+; InterlockedCompareExchange16 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .486\r
+ .model flat,C\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT32\r
+; EFIAPI\r
+; InternalSyncCompareExchange16 (\r
+; IN UINT16 *Value,\r
+; IN UINT16 CompareValue,\r
+; IN UINT16 ExchangeValue\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalSyncCompareExchange16 PROC\r
+ mov ecx, [esp + 4]\r
+ mov eax, [esp + 8]\r
+ mov edx, [esp + 12]\r
+ lock cmpxchg [ecx], dx\r
+ ret\r
+InternalSyncCompareExchange16 ENDP\r
+\r
+ END\r
--- /dev/null
+#include <Library/DebugLib.h>\r
+#include "InterlockedCompareExchange16.h"\r
+\r
+/**\r
+ Performs an atomic compare exchange operation on a 16-bit unsigned integer.\r
+\r
+ Performs an atomic compare exchange operation on the 16-bit unsigned integer\r
+ specified by Value. If Value is equal to CompareValue, then Value is set to\r
+ ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,\r
+ then Value is returned. The compare exchange operation must be performed using\r
+ MP safe mechanisms.\r
+\r
+ If Value is NULL, then ASSERT().\r
+\r
+ @param Value A pointer to the 16-bit value for the compare exchange\r
+ operation.\r
+ @param CompareValue 16-bit value used in compare operation.\r
+ @param ExchangeValue 16-bit value used in exchange operation.\r
+\r
+ @return The original *Value before exchange.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+InterlockedCompareExchange16 (\r
+ IN OUT UINT16 *Value,\r
+ IN UINT16 CompareValue,\r
+ IN UINT16 ExchangeValue\r
+ )\r
+{\r
+ ASSERT (Value != NULL);\r
+ return InternalSyncCompareExchange16 (Value, CompareValue, ExchangeValue);\r
+}\r
--- /dev/null
+/**\r
+ Assembly implementation of InterlockedCompareExchange16.\r
+\r
+ Look at the documentation of InterlockedCompareExchange16.\r
+**/\r
+UINT16\r
+EFIAPI\r
+InternalSyncCompareExchange16 (\r
+ IN volatile UINT16 *Value,\r
+ IN UINT16 CompareValue,\r
+ IN UINT16 ExchangeValue\r
+ );\r
+\r
+/**\r
+ Performs an atomic compare exchange operation on a 16-bit unsigned integer.\r
+\r
+ Performs an atomic compare exchange operation on the 16-bit unsigned integer\r
+ specified by Value. If Value is equal to CompareValue, then Value is set to\r
+ ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,\r
+ then Value is returned. The compare exchange operation must be performed using\r
+ MP safe mechanisms.\r
+\r
+ If Value is NULL, then ASSERT().\r
+\r
+ @param Value A pointer to the 16-bit value for the compare exchange\r
+ operation.\r
+ @param CompareValue 16-bit value used in compare operation.\r
+ @param ExchangeValue 16-bit value used in exchange operation.\r
+\r
+ @return The original *Value before exchange.\r
+**/\r
+UINT16\r
+EFIAPI\r
+InterlockedCompareExchange16 (\r
+ IN OUT UINT16 *Value,\r
+ IN UINT16 CompareValue,\r
+ IN UINT16 ExchangeValue\r
+ );\r
--- /dev/null
+# UINT16\r
+# EFIAPI\r
+# InternalSyncCompareExchange16 (\r
+# IN volatile UINT16 *Value,\r
+# IN UINT16 CompareValue,\r
+# IN UINT16 ExchangeValue\r
+# );\r
+ASM_GLOBAL ASM_PFX(InternalSyncCompareExchange16)\r
+ASM_PFX(InternalSyncCompareExchange16):\r
+ mov %edx, %eax\r
+ lock\r
+ cmpxchgw %r8w, (%rcx)\r
+ ret\r
--- /dev/null
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
+; 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
+; http://opensource.org/licenses/bsd-license.php.\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+; InterlockedCompareExchange16.Asm\r
+;\r
+; Abstract:\r
+;\r
+; InterlockedCompareExchange16 function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+ .code\r
+\r
+;------------------------------------------------------------------------------\r
+; UINT16\r
+; EFIAPI\r
+; InterlockedCompareExchange16 (\r
+; IN UINT16 *Value,\r
+; IN UINT16 CompareValue,\r
+; IN UINT16 ExchangeValue\r
+; );\r
+;------------------------------------------------------------------------------\r
+InternalSyncCompareExchange16 PROC\r
+ mov eax, edx\r
+ lock cmpxchg [rcx], r8w\r
+ ret\r
+InternalSyncCompareExchange16 ENDP\r
+\r
+ END\r
ComponentName.h\r
XenHypercall.c\r
XenHypercall.h\r
+ InterlockedCompareExchange16.c\r
+ InterlockedCompareExchange16.h\r
\r
[Sources.IA32]\r
Ia32/hypercall.S\r
Ia32/hypercall.asm\r
+ Ia32/InterlockedCompareExchange16.S\r
+ Ia32/InterlockedCompareExchange16.asm\r
\r
[Sources.X64]\r
X64/hypercall.S\r
X64/hypercall.asm\r
+ X64/InterlockedCompareExchange16.S\r
+ X64/InterlockedCompareExchange16.asm\r
\r
[LibraryClasses]\r
UefiDriverEntryPoint\r