summaryrefslogtreecommitdiff
path: root/MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c
diff options
context:
space:
mode:
authorMichael Kinney <michael.d.kinney@intel.com>2016-11-16 14:37:15 -0800
committerMichael Kinney <michael.d.kinney@intel.com>2016-11-17 17:08:19 -0800
commit4cee954ea8063ab2a911e418d8a9e7a179df212b (patch)
treef395e9d91aab3f27240832c53d81a66b6598dab8 /MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c
parent7375f3f11a70e3c7295ef7005f6723ced176ad0a (diff)
downloadedk2-platforms-4cee954ea8063ab2a911e418d8a9e7a179df212b.tar.xz
MdePkg/BaseSynchronizationLib: Add volatile Interlocked*() APIs
The SpinLock functions in the SynchronicationLib use volatile parameters to keep compiler from optimizing these functions too much. The volatile keyword is missing from the Interlocked*() functions in this same library instance. Update the library instance to consistently use volatile on all functions in the SynchronizationLib class. Cc: Liming Gao <liming.gao@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Andrew Fish <afish@apple.com> Cc: Jeff Fan <jeff.fan@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kinney <michael.d.kinney@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c')
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c b/MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c
index 4b8c8e59c8..98c9648632 100644
--- a/MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c
+++ b/MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c
@@ -260,7 +260,7 @@ ReleaseSpinLock (
UINT32
EFIAPI
InterlockedIncrement (
- IN UINT32 *Value
+ IN volatile UINT32 *Value
)
{
ASSERT (Value != NULL);
@@ -285,7 +285,7 @@ InterlockedIncrement (
UINT32
EFIAPI
InterlockedDecrement (
- IN UINT32 *Value
+ IN volatile UINT32 *Value
)
{
ASSERT (Value != NULL);
@@ -314,7 +314,7 @@ InterlockedDecrement (
UINT16
EFIAPI
InterlockedCompareExchange16 (
- IN OUT UINT16 *Value,
+ IN OUT volatile UINT16 *Value,
IN UINT16 CompareValue,
IN UINT16 ExchangeValue
)
@@ -345,7 +345,7 @@ InterlockedCompareExchange16 (
UINT32
EFIAPI
InterlockedCompareExchange32 (
- IN OUT UINT32 *Value,
+ IN OUT volatile UINT32 *Value,
IN UINT32 CompareValue,
IN UINT32 ExchangeValue
)
@@ -375,7 +375,7 @@ InterlockedCompareExchange32 (
UINT64
EFIAPI
InterlockedCompareExchange64 (
- IN OUT UINT64 *Value,
+ IN OUT volatile UINT64 *Value,
IN UINT64 CompareValue,
IN UINT64 ExchangeValue
)
@@ -405,7 +405,7 @@ InterlockedCompareExchange64 (
VOID *
EFIAPI
InterlockedCompareExchangePointer (
- IN OUT VOID **Value,
+ IN OUT VOID * volatile *Value,
IN VOID *CompareValue,
IN VOID *ExchangeValue
)
@@ -417,13 +417,13 @@ InterlockedCompareExchangePointer (
switch (SizeOfValue) {
case sizeof (UINT32):
return (VOID*)(UINTN)InterlockedCompareExchange32 (
- (UINT32*)Value,
+ (volatile UINT32 *)Value,
(UINT32)(UINTN)CompareValue,
(UINT32)(UINTN)ExchangeValue
);
case sizeof (UINT64):
return (VOID*)(UINTN)InterlockedCompareExchange64 (
- (UINT64*)Value,
+ (volatile UINT64 *)Value,
(UINT64)(UINTN)CompareValue,
(UINT64)(UINTN)ExchangeValue
);