From 4cee954ea8063ab2a911e418d8a9e7a179df212b Mon Sep 17 00:00:00 2001 From: Michael Kinney Date: Wed, 16 Nov 2016 14:37:15 -0800 Subject: 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 Cc: Laszlo Ersek Cc: Andrew Fish Cc: Jeff Fan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kinney Reviewed-by: Laszlo Ersek Reviewed-by: Liming Gao --- .../Library/BaseSynchronizationLib/SynchronizationGcc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c') 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 ); -- cgit v1.2.3