]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.nasm
MdePkg/BaseSynchronizationLib: Add volatile Interlocked*() APIs
[mirror_edk2.git] / MdePkg / Library / BaseSynchronizationLib / Ia32 / InterlockedCompareExchange16.nasm
CommitLineData
0b45f691
JJ
1;------------------------------------------------------------------------------\r
2;\r
4cee954e 3; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
0b45f691
JJ
4; Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>\r
5; This program and the accompanying materials\r
6; are licensed and made available under the terms and conditions of the BSD License\r
7; which accompanies this distribution. The full text of the license may be found at\r
8; http://opensource.org/licenses/bsd-license.php.\r
9;\r
10; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12;\r
13; Module Name:\r
14;\r
15; InterlockedCompareExchange16.Asm\r
16;\r
17; Abstract:\r
18;\r
19; InterlockedCompareExchange16 function\r
20;\r
21; Notes:\r
22;\r
23;------------------------------------------------------------------------------\r
24\r
25 SECTION .text\r
26\r
27;------------------------------------------------------------------------------\r
28; UINT16\r
29; EFIAPI\r
30; InternalSyncCompareExchange16 (\r
4cee954e 31; IN volatile UINT16 *Value,\r
0b45f691
JJ
32; IN UINT16 CompareValue,\r
33; IN UINT16 ExchangeValue\r
34; );\r
35;------------------------------------------------------------------------------\r
36global ASM_PFX(InternalSyncCompareExchange16)\r
37ASM_PFX(InternalSyncCompareExchange16):\r
38 mov ecx, [esp + 4]\r
39 mov ax, [esp + 8]\r
40 mov dx, [esp + 12]\r
41 lock cmpxchg [ecx], dx\r
42 ret\r
43\r