\r
Performs an atomic increment of the 32-bit unsigned integer specified by\r
Value and returns the incremented value. The increment operation must be\r
- performed using MP safe mechanisms. The state of the return value is not\r
- guaranteed to be MP safe.\r
+ performed using MP safe mechanisms.\r
\r
If Value is NULL, then ASSERT().\r
\r
\r
Performs an atomic decrement of the 32-bit unsigned integer specified by\r
Value and returns the decremented value. The decrement operation must be\r
- performed using MP safe mechanisms. The state of the return value is not\r
- guaranteed to be MP safe.\r
+ performed using MP safe mechanisms.\r
\r
If Value is NULL, then ASSERT().\r
\r
Ia32/InterlockedCompareExchange64.c | MSFT\r
Ia32/InterlockedCompareExchange32.c | MSFT\r
Ia32/InterlockedCompareExchange16.c | MSFT\r
- Ia32/InterlockedDecrement.c | MSFT\r
- Ia32/InterlockedIncrement.c | MSFT\r
- SynchronizationMsc.c | MSFT\r
+ InterlockedIncrementMsc.c | MSFT\r
+ InterlockedDecrementMsc.c | MSFT\r
+ SynchronizationMsc.c | MSFT\r
\r
Ia32/InterlockedCompareExchange64.nasm| INTEL\r
Ia32/InterlockedCompareExchange32.nasm| INTEL\r
X64/InterlockedCompareExchange64.c | MSFT\r
X64/InterlockedCompareExchange32.c | MSFT\r
X64/InterlockedCompareExchange16.c | MSFT\r
+ InterlockedIncrementMsc.c | MSFT\r
+ InterlockedDecrementMsc.c | MSFT\r
+ SynchronizationMsc.c | MSFT\r
\r
X64/InterlockedCompareExchange64.nasm| INTEL\r
X64/InterlockedCompareExchange32.nasm| INTEL\r
X64/InterlockedCompareExchange16.nasm| INTEL\r
-\r
- X64/InterlockedDecrement.c | MSFT\r
- X64/InterlockedIncrement.c | MSFT\r
- SynchronizationMsc.c | MSFT\r
-\r
- X64/InterlockedDecrement.nasm| INTEL\r
- X64/InterlockedIncrement.nasm| INTEL\r
+ X64/InterlockedDecrement.nasm | INTEL\r
+ X64/InterlockedIncrement.nasm | INTEL\r
Synchronization.c | INTEL\r
\r
Ia32/InternalGetSpinLockProperties.c | GCC\r
\r
Performs an atomic increment of the 32-bit unsigned integer specified by\r
Value and returns the incremented value. The increment operation must be\r
- performed using MP safe mechanisms. The state of the return value is not\r
- guaranteed to be MP safe.\r
+ performed using MP safe mechanisms.\r
\r
@param Value A pointer to the 32-bit value to increment.\r
\r
\r
Performs an atomic decrement of the 32-bit unsigned integer specified by\r
Value and returns the decrement value. The decrement operation must be\r
- performed using MP safe mechanisms. The state of the return value is not\r
- guaranteed to be MP safe.\r
+ performed using MP safe mechanisms.\r
\r
@param Value A pointer to the 32-bit value to decrement.\r
\r
\r
Performs an atomic increment of the 32-bit unsigned integer specified by\r
Value and returns the incremented value. The increment operation must be\r
- performed using MP safe mechanisms. The state of the return value is not\r
- guaranteed to be MP safe.\r
+ performed using MP safe mechanisms.\r
\r
@param Value A pointer to the 32-bit value to increment.\r
\r
UINT32 Result;\r
\r
__asm__ __volatile__ (\r
+ "movl $1, %%eax \n\t"\r
"lock \n\t"\r
- "incl %2 \n\t"\r
- "movl %2, %%eax "\r
+ "xadd %%eax, %2 \n\t"\r
+ "inc %%eax "\r
: "=a" (Result), // %0\r
"=m" (*Value) // %1\r
: "m" (*Value) // %2\r
\r
Performs an atomic decrement of the 32-bit unsigned integer specified by\r
Value and returns the decremented value. The decrement operation must be\r
- performed using MP safe mechanisms. The state of the return value is not\r
- guaranteed to be MP safe.\r
+ performed using MP safe mechanisms.\r
\r
@param Value A pointer to the 32-bit value to decrement.\r
\r
UINT32 Result;\r
\r
__asm__ __volatile__ (\r
- "lock \n\t"\r
- "decl %2 \n\t"\r
- "movl %2, %%eax "\r
+ "movl $-1, %%eax \n\t"\r
+ "lock \n\t"\r
+ "xadd %%eax, %2 \n\t"\r
+ "dec %%eax "\r
: "=a" (Result), // %0\r
"=m" (*Value) // %1\r
: "m" (*Value) // %2\r
+++ /dev/null
-/** @file\r
- InterlockedDecrement function\r
-\r
- Copyright (c) 2006 - 2016, 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
-**/\r
-\r
-\r
-\r
-\r
-/**\r
- Performs an atomic decrement of an 32-bit unsigned integer.\r
-\r
- Performs an atomic decrement of the 32-bit unsigned integer specified by\r
- Value and returns the decrement value. The decrement operation must be\r
- performed using MP safe mechanisms. The state of the return value is not\r
- guaranteed to be MP safe.\r
-\r
- @param Value A pointer to the 32-bit value to decrement.\r
-\r
- @return The decrement value.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-InternalSyncDecrement (\r
- IN volatile UINT32 *Value\r
- )\r
-{\r
- _asm {\r
- mov eax, Value\r
- lock dec dword ptr [eax]\r
- mov eax, [eax]\r
- }\r
-}\r
;------------------------------------------------------------------------------\r
;\r
-; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2006 - 2018, 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
;------------------------------------------------------------------------------\r
global ASM_PFX(InternalSyncDecrement)\r
ASM_PFX(InternalSyncDecrement):\r
- mov eax, [esp + 4]\r
- lock dec dword [eax]\r
- mov eax, [eax]\r
+ mov ecx, [esp + 4]\r
+ mov eax, 0FFFFFFFFh\r
+ lock xadd dword [ecx], eax\r
+ dec eax\r
ret\r
-\r
+++ /dev/null
-/** @file\r
- InterLockedIncrement function\r
-\r
- Copyright (c) 2006 - 2016, 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
-**/\r
-\r
-\r
-\r
-\r
-/**\r
- Performs an atomic increment of an 32-bit unsigned integer.\r
-\r
- Performs an atomic increment of the 32-bit unsigned integer specified by\r
- Value and returns the incremented value. The increment operation must be\r
- performed using MP safe mechanisms. The state of the return value is not\r
- guaranteed to be MP safe.\r
-\r
- @param Value A pointer to the 32-bit value to increment.\r
-\r
- @return The incremented value.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-InternalSyncIncrement (\r
- IN volatile UINT32 *Value\r
- )\r
-{\r
- _asm {\r
- mov eax, Value\r
- lock inc dword ptr [eax]\r
- mov eax, [eax]\r
- }\r
-}\r
-\r
;------------------------------------------------------------------------------\r
global ASM_PFX(InternalSyncIncrement)\r
ASM_PFX(InternalSyncIncrement):\r
- mov eax, [esp + 4]\r
- lock inc dword [eax]\r
- mov eax, [eax]\r
+ mov ecx, [esp + 4]\r
+ mov eax, 1\r
+ lock xadd dword [ecx], eax\r
+ inc eax\r
ret\r
\r
--- /dev/null
+/** @file\r
+ InterlockedDecrement function\r
+\r
+ Copyright (c) 2006 - 2018, 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
+**/\r
+\r
+/**\r
+ Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.\r
+**/\r
+\r
+long _InterlockedDecrement(\r
+ long * lpAddend\r
+);\r
+\r
+#pragma intrinsic(_InterlockedDecrement)\r
+\r
+/**\r
+ Performs an atomic decrement of an 32-bit unsigned integer.\r
+\r
+ Performs an atomic decrement of the 32-bit unsigned integer specified by\r
+ Value and returns the decrement value. The decrement operation must be\r
+ performed using MP safe mechanisms. The state of the return value is not\r
+ guaranteed to be MP safe.\r
+\r
+ @param Value A pointer to the 32-bit value to decrement.\r
+\r
+ @return The decrement value.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+InternalSyncDecrement (\r
+ IN volatile UINT32 *Value\r
+ )\r
+{\r
+ return _InterlockedDecrement ((long *)(Value));\r
+}\r
+\r
--- /dev/null
+/** @file\r
+ InterLockedIncrement function\r
+\r
+ Copyright (c) 2006 - 2018, 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
+**/\r
+\r
+/**\r
+ Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.\r
+**/\r
+\r
+long _InterlockedIncrement(\r
+ long * lpAddend\r
+);\r
+\r
+#pragma intrinsic(_InterlockedIncrement)\r
+\r
+/**\r
+ Performs an atomic increment of an 32-bit unsigned integer.\r
+\r
+ Performs an atomic increment of the 32-bit unsigned integer specified by\r
+ Value and returns the incremented value. The increment operation must be\r
+ performed using MP safe mechanisms. The state of the return value is not\r
+ guaranteed to be MP safe.\r
+\r
+ @param Value A pointer to the 32-bit value to increment.\r
+\r
+ @return The incremented value.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+InternalSyncIncrement (\r
+ IN volatile UINT32 *Value\r
+ )\r
+{\r
+ return _InterlockedIncrement ((long *)(Value));\r
+}\r
+\r
\r
Performs an atomic increment of the 32-bit unsigned integer specified by\r
Value and returns the incremented value. The increment operation must be\r
- performed using MP safe mechanisms. The state of the return value is not\r
- guaranteed to be MP safe.\r
+ performed using MP safe mechanisms.\r
\r
If Value is NULL, then ASSERT().\r
\r
\r
Performs an atomic decrement of the 32-bit unsigned integer specified by\r
Value and returns the decremented value. The decrement operation must be\r
- performed using MP safe mechanisms. The state of the return value is not\r
- guaranteed to be MP safe.\r
+ performed using MP safe mechanisms.\r
\r
If Value is NULL, then ASSERT().\r
\r
\r
Performs an atomic increment of the 32-bit unsigned integer specified by\r
Value and returns the incremented value. The increment operation must be\r
- performed using MP safe mechanisms. The state of the return value is not\r
- guaranteed to be MP safe.\r
+ performed using MP safe mechanisms.\r
\r
If Value is NULL, then ASSERT().\r
\r
\r
Performs an atomic decrement of the 32-bit unsigned integer specified by\r
Value and returns the decremented value. The decrement operation must be\r
- performed using MP safe mechanisms. The state of the return value is not\r
- guaranteed to be MP safe.\r
+ performed using MP safe mechanisms.\r
\r
If Value is NULL, then ASSERT().\r
\r
\r
Performs an atomic increment of the 32-bit unsigned integer specified by\r
Value and returns the incremented value. The increment operation must be\r
- performed using MP safe mechanisms. The state of the return value is not\r
- guaranteed to be MP safe.\r
+ performed using MP safe mechanisms.\r
\r
If Value is NULL, then ASSERT().\r
\r
\r
Performs an atomic decrement of the 32-bit unsigned integer specified by\r
Value and returns the decremented value. The decrement operation must be\r
- performed using MP safe mechanisms. The state of the return value is not\r
- guaranteed to be MP safe.\r
+ performed using MP safe mechanisms.\r
\r
If Value is NULL, then ASSERT().\r
\r
\r
\r
\r
-\r
/**\r
Performs an atomic increment of an 32-bit unsigned integer.\r
\r
Performs an atomic increment of the 32-bit unsigned integer specified by\r
Value and returns the incremented value. The increment operation must be\r
- performed using MP safe mechanisms. The state of the return value is not\r
- guaranteed to be MP safe.\r
+ performed using MP safe mechanisms.\r
\r
@param Value A pointer to the 32-bit value to increment.\r
\r
UINT32 Result;\r
\r
__asm__ __volatile__ (\r
+ "movl $1, %%eax \n\t"\r
"lock \n\t"\r
- "incl %2 \n\t"\r
- "mov %2, %%eax "\r
+ "xadd %%eax, %2 \n\t"\r
+ "inc %%eax "\r
: "=a" (Result), // %0\r
"=m" (*Value) // %1\r
: "m" (*Value) // %2\r
\r
Performs an atomic decrement of the 32-bit unsigned integer specified by\r
Value and returns the decremented value. The decrement operation must be\r
- performed using MP safe mechanisms. The state of the return value is not\r
- guaranteed to be MP safe.\r
+ performed using MP safe mechanisms.\r
\r
@param Value A pointer to the 32-bit value to decrement.\r
\r
UINT32 Result;\r
\r
__asm__ __volatile__ (\r
- "lock \n\t"\r
- "decl %2 \n\t"\r
- "mov %2, %%eax "\r
+ "movl $-1, %%eax \n\t"\r
+ "lock \n\t"\r
+ "xadd %%eax, %2 \n\t"\r
+ "dec %%eax "\r
: "=a" (Result), // %0\r
"=m" (*Value) // %1\r
: "m" (*Value) // %2\r
+++ /dev/null
-/** @file\r
- InterlockedDecrement function\r
-\r
- Copyright (c) 2006 - 2016, 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
-**/\r
-\r
-/**\r
- Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.\r
-**/\r
-\r
-long _InterlockedDecrement(\r
- long * lpAddend\r
-);\r
-\r
-#pragma intrinsic(_InterlockedDecrement)\r
-\r
-/**\r
- Performs an atomic decrement of an 32-bit unsigned integer.\r
-\r
- Performs an atomic decrement of the 32-bit unsigned integer specified by\r
- Value and returns the decrement value. The decrement operation must be\r
- performed using MP safe mechanisms. The state of the return value is not\r
- guaranteed to be MP safe.\r
-\r
- @param Value A pointer to the 32-bit value to decrement.\r
-\r
- @return The decrement value.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-InternalSyncDecrement (\r
- IN volatile UINT32 *Value\r
- )\r
-{\r
- return _InterlockedDecrement ((long *)(UINTN)(Value));\r
-}\r
-\r
;------------------------------------------------------------------------------\r
;\r
-; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2006 - 2018, 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
;------------------------------------------------------------------------------\r
global ASM_PFX(InternalSyncDecrement)\r
ASM_PFX(InternalSyncDecrement):\r
- lock dec dword [rcx]\r
- mov eax, [rcx]\r
+ mov eax, 0FFFFFFFFh\r
+ lock xadd dword [rcx], eax\r
+ dec eax\r
ret\r
-\r
+++ /dev/null
-/** @file\r
- InterLockedIncrement function\r
-\r
- Copyright (c) 2006 - 2016, 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
-**/\r
-\r
-/**\r
- Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.\r
-**/\r
-\r
-long _InterlockedIncrement(\r
- long * lpAddend\r
-);\r
-\r
-#pragma intrinsic(_InterlockedIncrement)\r
-\r
-/**\r
- Performs an atomic increment of an 32-bit unsigned integer.\r
-\r
- Performs an atomic increment of the 32-bit unsigned integer specified by\r
- Value and returns the incremented value. The increment operation must be\r
- performed using MP safe mechanisms. The state of the return value is not\r
- guaranteed to be MP safe.\r
-\r
- @param Value A pointer to the 32-bit value to increment.\r
-\r
- @return The incremented value.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-InternalSyncIncrement (\r
- IN volatile UINT32 *Value\r
- )\r
-{\r
- return _InterlockedIncrement ((long *)(UINTN)(Value));\r
-}\r
-\r
;------------------------------------------------------------------------------\r
global ASM_PFX(InternalSyncIncrement)\r
ASM_PFX(InternalSyncIncrement):\r
- lock inc dword [rcx]\r
- mov eax, [rcx]\r
+ mov eax, 1\r
+ lock xadd dword [rcx], eax\r
+ inc eax\r
ret\r
\r