--- /dev/null
+// Implementation of synchronization functions for ARM architecture (AArch64)\r
+//\r
+// Copyright (c) 2012-2015, ARM Limited. All rights reserved.\r
+// Copyright (c) 2015, Linaro Limited. All rights reserved.\r
+//\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
+.text\r
+.align 3\r
+\r
+GCC_ASM_EXPORT(InternalSyncCompareExchange32)\r
+GCC_ASM_EXPORT(InternalSyncCompareExchange64)\r
+GCC_ASM_EXPORT(InternalSyncIncrement)\r
+GCC_ASM_EXPORT(InternalSyncDecrement)\r
+\r
+/**\r
+ Performs an atomic compare exchange operation on a 32-bit unsigned integer.\r
+\r
+ Performs an atomic compare exchange operation on the 32-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
+ @param Value A pointer to the 32-bit value for the compare exchange\r
+ operation.\r
+ @param CompareValue 32-bit value used in compare operation.\r
+ @param ExchangeValue 32-bit value used in exchange operation.\r
+\r
+ @return The original *Value before exchange.\r
+\r
+**/\r
+//UINT32\r
+//EFIAPI\r
+//InternalSyncCompareExchange32 (\r
+// IN volatile UINT32 *Value,\r
+// IN UINT32 CompareValue,\r
+// IN UINT32 ExchangeValue\r
+// )\r
+ASM_PFX(InternalSyncCompareExchange32):\r
+ dmb sy\r
+\r
+InternalSyncCompareExchange32Again:\r
+ ldxr w3, [x0]\r
+ cmp w3, w1\r
+ bne InternalSyncCompareExchange32Fail\r
+\r
+InternalSyncCompareExchange32Exchange:\r
+ stxr w4, w2, [x0]\r
+ cbnz w4, InternalSyncCompareExchange32Again\r
+\r
+InternalSyncCompareExchange32Fail:\r
+ dmb sy\r
+ mov w0, w3\r
+ ret\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
+// IN volatile UINT64 *Value,\r
+// IN UINT64 CompareValue,\r
+// IN UINT64 ExchangeValue\r
+// )\r
+ASM_PFX(InternalSyncCompareExchange64):\r
+ dmb sy\r
+\r
+InternalSyncCompareExchange64Again:\r
+ ldxr x3, [x0]\r
+ cmp x3, x1\r
+ bne InternalSyncCompareExchange64Fail\r
+\r
+InternalSyncCompareExchange64Exchange:\r
+ stxr w4, x2, [x0]\r
+ cbnz w4, InternalSyncCompareExchange64Again\r
+\r
+InternalSyncCompareExchange64Fail:\r
+ dmb sy\r
+ mov x0, x3\r
+ ret\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
+ASM_PFX(InternalSyncIncrement):\r
+ dmb sy\r
+TryInternalSyncIncrement:\r
+ ldxr w1, [x0]\r
+ add w1, w1, #1\r
+ stxr w2, w1, [x0]\r
+ cbnz w2, TryInternalSyncIncrement\r
+ dmb sy\r
+ ret\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
+ASM_PFX(InternalSyncDecrement):\r
+ dmb sy\r
+TryInternalSyncDecrement:\r
+ ldxr w1, [x0]\r
+ sub w1, w1, #1\r
+ stxr w2, w1, [x0]\r
+ cbnz w2, TryInternalSyncDecrement\r
+ dmb sy\r
+ ret\r
+++ /dev/null
-/** @file\r
- Implementation of synchronization functions. Still needs to be ported\r
-\r
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
- Portions copyright (c) 2008 - 2009, Apple Inc. 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
- Performs an atomic compare exchange operation on a 32-bit unsigned integer.\r
-\r
- Performs an atomic compare exchange operation on the 32-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
- @param Value A pointer to the 32-bit value for the compare exchange\r
- operation.\r
- @param CompareValue 32-bit value used in compare operation.\r
- @param ExchangeValue 32-bit value used in exchange operation.\r
-\r
- @return The original *Value before exchange.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-InternalSyncCompareExchange32 (\r
- IN volatile UINT32 *Value,\r
- IN UINT32 CompareValue,\r
- IN UINT32 ExchangeValue\r
- )\r
-{\r
- return *Value != CompareValue ? *Value :\r
- ((*Value = ExchangeValue), CompareValue);\r
-}\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
- IN volatile UINT64 *Value,\r
- IN UINT64 CompareValue,\r
- IN UINT64 ExchangeValue\r
- )\r
-{\r
- return *Value != CompareValue ? *Value :\r
- ((*Value = ExchangeValue), CompareValue);\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
- return ++*Value;\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
- return --*Value;\r
-}\r
--- /dev/null
+// Implementation of synchronization functions for ARM architecture\r
+//\r
+// Copyright (c) 2012-2015, ARM Limited. All rights reserved.\r
+//\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
+.text\r
+.align 3\r
+\r
+GCC_ASM_EXPORT(InternalSyncCompareExchange32)\r
+GCC_ASM_EXPORT(InternalSyncCompareExchange64)\r
+GCC_ASM_EXPORT(InternalSyncIncrement)\r
+GCC_ASM_EXPORT(InternalSyncDecrement)\r
+\r
+/**\r
+ Performs an atomic compare exchange operation on a 32-bit unsigned integer.\r
+\r
+ Performs an atomic compare exchange operation on the 32-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
+ @param Value A pointer to the 32-bit value for the compare exchange\r
+ operation.\r
+ @param CompareValue 32-bit value used in compare operation.\r
+ @param ExchangeValue 32-bit value used in exchange operation.\r
+\r
+ @return The original *Value before exchange.\r
+\r
+**/\r
+//UINT32\r
+//EFIAPI\r
+//InternalSyncCompareExchange32 (\r
+// IN volatile UINT32 *Value,\r
+// IN UINT32 CompareValue,\r
+// IN UINT32 ExchangeValue\r
+// )\r
+ASM_PFX(InternalSyncCompareExchange32):\r
+ dmb\r
+\r
+InternalSyncCompareExchange32Again:\r
+ ldrex r3, [r0]\r
+ cmp r3, r1\r
+ bne InternalSyncCompareExchange32Fail\r
+\r
+InternalSyncCompareExchange32Exchange:\r
+ strex ip, r2, [r0]\r
+ cmp ip, #0\r
+ bne InternalSyncCompareExchange32Again\r
+\r
+InternalSyncCompareExchange32Fail:\r
+ dmb\r
+ mov r0, r3\r
+ bx lr\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
+// IN volatile UINT64 *Value, // r0\r
+// IN UINT64 CompareValue, // r2-r3\r
+// IN UINT64 ExchangeValue // stack\r
+// )\r
+ASM_PFX(InternalSyncCompareExchange64):\r
+ push { r4-r7 }\r
+ ldrd r4, r5, [sp, #16]\r
+ dmb\r
+\r
+InternalSyncCompareExchange64Again:\r
+ ldrexd r6, r7, [r0]\r
+ cmp r6, r2\r
+ cmpeq r7, r3\r
+ bne InternalSyncCompareExchange64Fail\r
+\r
+InternalSyncCompareExchange64Exchange:\r
+ strexd ip, r4, r5, [r0]\r
+ cmp ip, #0\r
+ bne InternalSyncCompareExchange64Again\r
+\r
+InternalSyncCompareExchange64Fail:\r
+ dmb\r
+ mov r0, r6\r
+ mov r1, r7\r
+ pop { r4-r7 }\r
+ bx lr\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
+ASM_PFX(InternalSyncIncrement):\r
+ dmb\r
+TryInternalSyncIncrement:\r
+ ldrex r1, [r0]\r
+ add r1, r1, #1\r
+ strex r2, r1, [r0]\r
+ cmp r2, #0\r
+ bne TryInternalSyncIncrement\r
+ dmb\r
+ bx lr\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
+ASM_PFX(InternalSyncDecrement):\r
+ dmb\r
+TryInternalSyncDecrement:\r
+ ldrex r1, [r0]\r
+ sub r1, r1, #1\r
+ strex r2, r1, [r0]\r
+ cmp r2, #0\r
+ bne TryInternalSyncDecrement\r
+ dmb\r
+ bx lr\r
--- /dev/null
+// Implementation of synchronization functions for ARM architecture\r
+//\r
+// Copyright (c) 2012-2015, ARM Limited. All rights reserved.\r
+//\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
+ EXPORT InternalSyncCompareExchange32\r
+ EXPORT InternalSyncCompareExchange64\r
+ EXPORT InternalSyncIncrement\r
+ EXPORT InternalSyncDecrement\r
+\r
+ AREA ArmSynchronization, CODE, READONLY\r
+\r
+/**\r
+ Performs an atomic compare exchange operation on a 32-bit unsigned integer.\r
+\r
+ Performs an atomic compare exchange operation on the 32-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
+ @param Value A pointer to the 32-bit value for the compare exchange\r
+ operation.\r
+ @param CompareValue 32-bit value used in compare operation.\r
+ @param ExchangeValue 32-bit value used in exchange operation.\r
+\r
+ @return The original *Value before exchange.\r
+\r
+**/\r
+//UINT32\r
+//EFIAPI\r
+//InternalSyncCompareExchange32 (\r
+// IN volatile UINT32 *Value,\r
+// IN UINT32 CompareValue,\r
+// IN UINT32 ExchangeValue\r
+// )\r
+InternalSyncCompareExchange32\r
+ dmb\r
+\r
+InternalSyncCompareExchange32Again\r
+ ldrex r3, [r0]\r
+ cmp r3, r1\r
+ bne InternalSyncCompareExchange32Fail\r
+\r
+InternalSyncCompareExchange32Exchange\r
+ strex ip, r2, [r0]\r
+ cmp ip, #0\r
+ bne InternalSyncCompareExchange32Again\r
+\r
+InternalSyncCompareExchange32Fail\r
+ dmb\r
+ mov r0, r3\r
+ bx lr\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
+// IN volatile UINT64 *Value, // r0\r
+// IN UINT64 CompareValue, // r2-r3\r
+// IN UINT64 ExchangeValue // stack\r
+// )\r
+InternalSyncCompareExchange64\r
+ push { r4-r7 }\r
+ ldrd r4, r5, [sp, #16]\r
+ dmb\r
+\r
+InternalSyncCompareExchange64Again\r
+ ldrexd r6, r7, [r0]\r
+ cmp r6, r2\r
+ cmpeq r7, r3\r
+ bne InternalSyncCompareExchange64Fail\r
+\r
+InternalSyncCompareExchange64Exchange\r
+ strexd ip, r4, r5, [r0]\r
+ cmp ip, #0\r
+ bne InternalSyncCompareExchange64Again\r
+\r
+InternalSyncCompareExchange64Fail\r
+ dmb\r
+ mov r0, r6\r
+ mov r1, r7\r
+ pop { r4-r7 }\r
+ bx lr\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
+InternalSyncIncrement\r
+ dmb\r
+TryInternalSyncIncrement\r
+ ldrex r1, [r0]\r
+ add r1, r1, #1\r
+ strex r2, r1, [r0]\r
+ cmp r2, #0\r
+ bne TryInternalSyncIncrement\r
+ dmb\r
+ bx lr\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
+InternalSyncDecrement\r
+ dmb\r
+TryInternalSyncDecrement\r
+ ldrex r1, [r0]\r
+ sub r1, r1, #1\r
+ strex r2, r1, [r0]\r
+ cmp r2, #0\r
+ bne TryInternalSyncDecrement\r
+ dmb\r
+ bx lr\r
+\r
+ END\r
+++ /dev/null
-/** @file\r
- Implementation of synchronization functions. Still needs to be ported\r
-\r
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
- Portions copyright (c) 2008 - 2009, Apple Inc. 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
- Performs an atomic compare exchange operation on a 32-bit unsigned integer.\r
-\r
- Performs an atomic compare exchange operation on the 32-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
- @param Value A pointer to the 32-bit value for the compare exchange\r
- operation.\r
- @param CompareValue 32-bit value used in compare operation.\r
- @param ExchangeValue 32-bit value used in exchange operation.\r
-\r
- @return The original *Value before exchange.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-InternalSyncCompareExchange32 (\r
- IN volatile UINT32 *Value,\r
- IN UINT32 CompareValue,\r
- IN UINT32 ExchangeValue\r
- )\r
-{\r
- return *Value != CompareValue ? *Value :\r
- ((*Value = ExchangeValue), CompareValue);\r
-}\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
- IN volatile UINT64 *Value,\r
- IN UINT64 CompareValue,\r
- IN UINT64 ExchangeValue\r
- )\r
-{\r
- return *Value != CompareValue ? *Value :\r
- ((*Value = ExchangeValue), CompareValue);\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
- return ++*Value;\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
- return --*Value;\r
-}\r
\r
[Sources.ARM]\r
Synchronization.c\r
- Arm/Synchronization.c\r
+ Arm/Synchronization.asm | RVCT\r
+ Arm/Synchronization.S | GCC\r
\r
[Sources.AARCH64]\r
Synchronization.c\r
- AArch64/Synchronization.c\r
+ AArch64/Synchronization.S\r
\r
[Packages]\r
MdePkg/MdePkg.dec\r