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>
This commit is contained in:
Michael Kinney
2016-11-16 14:37:15 -08:00
parent 7375f3f11a
commit 4cee954ea8
33 changed files with 86 additions and 86 deletions

View File

@@ -262,7 +262,7 @@ ReleaseSpinLock (
UINT32
EFIAPI
InterlockedIncrement (
IN UINT32 *Value
IN volatile UINT32 *Value
)
{
ASSERT (Value != NULL);
@@ -287,7 +287,7 @@ InterlockedIncrement (
UINT32
EFIAPI
InterlockedDecrement (
IN UINT32 *Value
IN volatile UINT32 *Value
)
{
ASSERT (Value != NULL);
@@ -316,7 +316,7 @@ InterlockedDecrement (
UINT16
EFIAPI
InterlockedCompareExchange16 (
IN OUT UINT16 *Value,
IN OUT volatile UINT16 *Value,
IN UINT16 CompareValue,
IN UINT16 ExchangeValue
)
@@ -347,7 +347,7 @@ InterlockedCompareExchange16 (
UINT32
EFIAPI
InterlockedCompareExchange32 (
IN OUT UINT32 *Value,
IN OUT volatile UINT32 *Value,
IN UINT32 CompareValue,
IN UINT32 ExchangeValue
)
@@ -377,7 +377,7 @@ InterlockedCompareExchange32 (
UINT64
EFIAPI
InterlockedCompareExchange64 (
IN OUT UINT64 *Value,
IN OUT volatile UINT64 *Value,
IN UINT64 CompareValue,
IN UINT64 ExchangeValue
)
@@ -407,7 +407,7 @@ InterlockedCompareExchange64 (
VOID *
EFIAPI
InterlockedCompareExchangePointer (
IN OUT VOID **Value,
IN OUT VOID * volatile *Value,
IN VOID *CompareValue,
IN VOID *ExchangeValue
)
@@ -419,13 +419,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
);