summaryrefslogtreecommitdiffstats
path: root/MdePkg
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
parent7375f3f11a70e3c7295ef7005f6723ced176ad0a (diff)
downloadedk2-4cee954ea8063ab2a911e418d8a9e7a179df212b.tar.gz
edk2-4cee954ea8063ab2a911e418d8a9e7a179df212b.tar.bz2
edk2-4cee954ea8063ab2a911e418d8a9e7a179df212b.zip
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')
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.asm4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.c4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.nasm4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.asm4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.c4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.nasm4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.asm4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.c4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.nasm4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.asm4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.c4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.nasm4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.asm4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.c4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.nasm4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/Synchronization.c16
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/SynchronizationGcc.c16
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/SynchronizationMsc.c16
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.asm4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.c4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.nasm4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.asm4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.c4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.nasm4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.asm4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.c4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.nasm4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.asm4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.c6
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.nasm4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.asm4
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.c6
-rw-r--r--MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.nasm4
33 files changed, 86 insertions, 86 deletions
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.asm b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.asm
index 92a0f49bc0..7362fe9960 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.asm
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.asm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
@@ -30,7 +30,7 @@
; UINT16
; EFIAPI
; InternalSyncCompareExchange16 (
-; IN UINT16 *Value,
+; IN volatile UINT16 *Value,
; IN UINT16 CompareValue,
; IN UINT16 ExchangeValue
; );
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.c b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.c
index 3d5213743e..0c3a4f621b 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.c
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.c
@@ -1,7 +1,7 @@
/** @file
InterlockedCompareExchange16 function
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -36,7 +36,7 @@
UINT16
EFIAPI
InternalSyncCompareExchange16 (
- IN UINT16 *Value,
+ IN volatile UINT16 *Value,
IN UINT16 CompareValue,
IN UINT16 ExchangeValue
)
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.nasm b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.nasm
index 8cabe66ddf..7fbfd7519e 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.nasm
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange16.nasm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
@@ -28,7 +28,7 @@
; UINT16
; EFIAPI
; InternalSyncCompareExchange16 (
-; IN UINT16 *Value,
+; IN volatile UINT16 *Value,
; IN UINT16 CompareValue,
; IN UINT16 ExchangeValue
; );
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.asm b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.asm
index 78ea72c5c4..1a4a611cc9 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.asm
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.asm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -29,7 +29,7 @@
; UINT32
; EFIAPI
; InternalSyncCompareExchange32 (
-; IN UINT32 *Value,
+; IN volatile UINT32 *Value,
; IN UINT32 CompareValue,
; IN UINT32 ExchangeValue
; );
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.c b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.c
index a2c6838970..cf80ddef55 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.c
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.c
@@ -1,7 +1,7 @@
/** @file
InterlockedCompareExchange32 function
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -35,7 +35,7 @@
UINT32
EFIAPI
InternalSyncCompareExchange32 (
- IN UINT32 *Value,
+ IN volatile UINT32 *Value,
IN UINT32 CompareValue,
IN UINT32 ExchangeValue
)
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.nasm b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.nasm
index 539327312b..9064c65916 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.nasm
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.nasm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -27,7 +27,7 @@
; UINT32
; EFIAPI
; InternalSyncCompareExchange32 (
-; IN UINT32 *Value,
+; IN volatile UINT32 *Value,
; IN UINT32 CompareValue,
; IN UINT32 ExchangeValue
; );
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.asm b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.asm
index 0fcbd230ee..e7b02dbf0c 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.asm
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.asm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -29,7 +29,7 @@
; UINT64
; EFIAPI
; InternalSyncCompareExchange64 (
-; IN UINT64 *Value,
+; IN volatile UINT64 *Value,
; IN UINT64 CompareValue,
; IN UINT64 ExchangeValue
; );
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.c b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.c
index 73af6ef91a..0bdbd791ec 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.c
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.c
@@ -1,7 +1,7 @@
/** @file
InterlockedCompareExchange64 function
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -34,7 +34,7 @@
UINT64
EFIAPI
InternalSyncCompareExchange64 (
- IN UINT64 *Value,
+ IN volatile UINT64 *Value,
IN UINT64 CompareValue,
IN UINT64 ExchangeValue
)
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.nasm b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.nasm
index 206de407ae..c5c3e12459 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.nasm
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.nasm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -27,7 +27,7 @@
; UINT64
; EFIAPI
; InternalSyncCompareExchange64 (
-; IN UINT64 *Value,
+; IN volatile UINT64 *Value,
; IN UINT64 CompareValue,
; IN UINT64 ExchangeValue
; );
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.asm b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.asm
index 22cb0b2d38..b5fa44796f 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.asm
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.asm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -29,7 +29,7 @@
; UINT32
; EFIAPI
; InternalSyncDecrement (
-; IN UINT32 *Value
+; IN volatile UINT32 *Value
; );
;------------------------------------------------------------------------------
InternalSyncDecrement PROC
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.c b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.c
index 7f18e0b6b7..354a0e7ab1 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.c
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.c
@@ -1,7 +1,7 @@
/** @file
InterlockedDecrement function
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -31,7 +31,7 @@
UINT32
EFIAPI
InternalSyncDecrement (
- IN UINT32 *Value
+ IN volatile UINT32 *Value
)
{
_asm {
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.nasm b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.nasm
index a7414bee7a..4c46041186 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.nasm
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedDecrement.nasm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -27,7 +27,7 @@
; UINT32
; EFIAPI
; InternalSyncDecrement (
-; IN UINT32 *Value
+; IN volatile UINT32 *Value
; );
;------------------------------------------------------------------------------
global ASM_PFX(InternalSyncDecrement)
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.asm b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.asm
index 51675f600a..61c2533311 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.asm
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.asm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -29,7 +29,7 @@
; UINT32
; EFIAPI
; InternalSyncIncrement (
-; IN UINT32 *Value
+; IN volatile UINT32 *Value
; );
;------------------------------------------------------------------------------
InternalSyncIncrement PROC
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.c b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.c
index cf9f92a021..c61a550119 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.c
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.c
@@ -1,7 +1,7 @@
/** @file
InterLockedIncrement function
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -31,7 +31,7 @@
UINT32
EFIAPI
InternalSyncIncrement (
- IN UINT32 *Value
+ IN volatile UINT32 *Value
)
{
_asm {
diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.nasm b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.nasm
index 24f24f5d9a..3902c73275 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.nasm
+++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedIncrement.nasm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -27,7 +27,7 @@
; UINT32
; EFIAPI
; InternalSyncIncrement (
-; IN UINT32 *Value
+; IN volatile UINT32 *Value
; );
;------------------------------------------------------------------------------
global ASM_PFX(InternalSyncIncrement)
diff --git a/MdePkg/Library/BaseSynchronizationLib/Synchronization.c b/MdePkg/Library/BaseSynchronizationLib/Synchronization.c
index bb0c8e9469..4f2e21bcb3 100644
--- a/MdePkg/Library/BaseSynchronizationLib/Synchronization.c
+++ b/MdePkg/Library/BaseSynchronizationLib/Synchronization.c
@@ -244,7 +244,7 @@ ReleaseSpinLock (
UINT32
EFIAPI
InterlockedIncrement (
- IN UINT32 *Value
+ IN volatile UINT32 *Value
)
{
ASSERT (Value != NULL);
@@ -269,7 +269,7 @@ InterlockedIncrement (
UINT32
EFIAPI
InterlockedDecrement (
- IN UINT32 *Value
+ IN volatile UINT32 *Value
)
{
ASSERT (Value != NULL);
@@ -298,7 +298,7 @@ InterlockedDecrement (
UINT16
EFIAPI
InterlockedCompareExchange16 (
- IN OUT UINT16 *Value,
+ IN OUT volatile UINT16 *Value,
IN UINT16 CompareValue,
IN UINT16 ExchangeValue
)
@@ -329,7 +329,7 @@ InterlockedCompareExchange16 (
UINT32
EFIAPI
InterlockedCompareExchange32 (
- IN OUT UINT32 *Value,
+ IN OUT volatile UINT32 *Value,
IN UINT32 CompareValue,
IN UINT32 ExchangeValue
)
@@ -359,7 +359,7 @@ InterlockedCompareExchange32 (
UINT64
EFIAPI
InterlockedCompareExchange64 (
- IN OUT UINT64 *Value,
+ IN OUT volatile UINT64 *Value,
IN UINT64 CompareValue,
IN UINT64 ExchangeValue
)
@@ -389,7 +389,7 @@ InterlockedCompareExchange64 (
VOID *
EFIAPI
InterlockedCompareExchangePointer (
- IN OUT VOID **Value,
+ IN OUT VOID * volatile *Value,
IN VOID *CompareValue,
IN VOID *ExchangeValue
)
@@ -401,13 +401,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
);
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
);
diff --git a/MdePkg/Library/BaseSynchronizationLib/SynchronizationMsc.c b/MdePkg/Library/BaseSynchronizationLib/SynchronizationMsc.c
index db344b7e64..8bc6d2669e 100644
--- a/MdePkg/Library/BaseSynchronizationLib/SynchronizationMsc.c
+++ b/MdePkg/Library/BaseSynchronizationLib/SynchronizationMsc.c
@@ -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
);
diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.asm b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.asm
index 79266624b1..e8919222e3 100644
--- a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.asm
+++ b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.asm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
@@ -28,7 +28,7 @@
; UINT16
; EFIAPI
; InterlockedCompareExchange16 (
-; IN UINT16 *Value,
+; IN volatile UINT16 *Value,
; IN UINT16 CompareValue,
; IN UINT16 ExchangeValue
; );
diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.c b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.c
index 76aa6fbc0e..8b51ecbc3c 100644
--- a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.c
+++ b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.c
@@ -1,7 +1,7 @@
/** @file
InterlockedCompareExchange16 function
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -44,7 +44,7 @@ __int16 _InterlockedCompareExchange16(
UINT16
EFIAPI
InternalSyncCompareExchange16 (
- IN UINT16 *Value,
+ IN volatile UINT16 *Value,
IN UINT16 CompareValue,
IN UINT16 ExchangeValue
)
diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.nasm b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.nasm
index 1d72d074f6..efe3249f98 100644
--- a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.nasm
+++ b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.nasm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
@@ -29,7 +29,7 @@
; UINT16
; EFIAPI
; InterlockedCompareExchange16 (
-; IN UINT16 *Value,
+; IN volatile UINT16 *Value,
; IN UINT16 CompareValue,
; IN UINT16 ExchangeValue
; );
diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.asm b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.asm
index ee94ff7aef..269a3c7e41 100644
--- a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.asm
+++ b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.asm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -27,7 +27,7 @@
; UINT32
; EFIAPI
; InterlockedCompareExchange32 (
-; IN UINT32 *Value,
+; IN volatile UINT32 *Value,
; IN UINT32 CompareValue,
; IN UINT32 ExchangeValue
; );
diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.c b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.c
index 9f8f3d351f..ef407af9a9 100644
--- a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.c
+++ b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.c
@@ -1,7 +1,7 @@
/** @file
InterlockedCompareExchange32 function
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -44,7 +44,7 @@ long _InterlockedCompareExchange(
UINT32
EFIAPI
InternalSyncCompareExchange32 (
- IN UINT32 *Value,
+ IN volatile UINT32 *Value,
IN UINT32 CompareValue,
IN UINT32 ExchangeValue
)
diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.nasm b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.nasm
index 4c8c8103d9..31142d03c0 100644
--- a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.nasm
+++ b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange32.nasm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -28,7 +28,7 @@
; UINT32
; EFIAPI
; InterlockedCompareExchange32 (
-; IN UINT32 *Value,
+; IN volatile UINT32 *Value,
; IN UINT32 CompareValue,
; IN UINT32 ExchangeValue
; );
diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.asm b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.asm
index b5bcd258a5..80d03fd11a 100644
--- a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.asm
+++ b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.asm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -27,7 +27,7 @@
; UINT64
; EFIAPI
; InterlockedCompareExchange64 (
-; IN UINT64 *Value,
+; IN volatile UINT64 *Value,
; IN UINT64 CompareValue,
; IN UINT64 ExchangeValue
; );
diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.c b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.c
index 56805b3d2d..a8f9fbb594 100644
--- a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.c
+++ b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.c
@@ -1,7 +1,7 @@
/** @file
InterlockedCompareExchange64 function
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -43,7 +43,7 @@ __int64 _InterlockedCompareExchange64(
UINT64
EFIAPI
InternalSyncCompareExchange64 (
- IN UINT64 *Value,
+ IN volatile UINT64 *Value,
IN UINT64 CompareValue,
IN UINT64 ExchangeValue
)
diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.nasm b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.nasm
index 72c350a929..819daed246 100644
--- a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.nasm
+++ b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.nasm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -28,7 +28,7 @@
; UINT64
; EFIAPI
; InterlockedCompareExchange64 (
-; IN UINT64 *Value,
+; IN volatile UINT64 *Value,
; IN UINT64 CompareValue,
; IN UINT64 ExchangeValue
; );
diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.asm b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.asm
index fdea0d4c18..23f03c4a7b 100644
--- a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.asm
+++ b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.asm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -27,7 +27,7 @@
; UINT32
; EFIAPI
; InterlockedDecrement (
-; IN UINT32 *Value
+; IN volatile UINT32 *Value
; );
;------------------------------------------------------------------------------
InternalSyncDecrement PROC
diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.c b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.c
index 65faf014e9..da402cd4c6 100644
--- a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.c
+++ b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.c
@@ -1,7 +1,7 @@
/** @file
InterlockedDecrement function
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -38,9 +38,9 @@ long _InterlockedDecrement(
UINT32
EFIAPI
InternalSyncDecrement (
- IN UINT32 *Value
+ IN volatile UINT32 *Value
)
{
- return _InterlockedDecrement (Value);
+ return _InterlockedDecrement ((long *)(UINTN)(Value));
}
diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.nasm b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.nasm
index e140e44e55..780d9020bb 100644
--- a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.nasm
+++ b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedDecrement.nasm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -28,7 +28,7 @@
; UINT32
; EFIAPI
; InterlockedDecrement (
-; IN UINT32 *Value
+; IN volatile UINT32 *Value
; );
;------------------------------------------------------------------------------
global ASM_PFX(InternalSyncDecrement)
diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.asm b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.asm
index 65abcf7310..44f264f97d 100644
--- a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.asm
+++ b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.asm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -27,7 +27,7 @@
; UINT32
; EFIAPI
; InterlockedIncrement (
-; IN UINT32 *Value
+; IN volatile UINT32 *Value
; );
;------------------------------------------------------------------------------
InternalSyncIncrement PROC
diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.c b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.c
index c0deb60c54..bbd1384602 100644
--- a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.c
+++ b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.c
@@ -1,7 +1,7 @@
/** @file
InterLockedIncrement function
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -38,9 +38,9 @@ long _InterlockedIncrement(
UINT32
EFIAPI
InternalSyncIncrement (
- IN UINT32 *Value
+ IN volatile UINT32 *Value
)
{
- return _InterlockedIncrement (Value);
+ return _InterlockedIncrement ((long *)(UINTN)(Value));
}
diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.nasm b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.nasm
index 59d90be386..e1c70a448d 100644
--- a/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.nasm
+++ b/MdePkg/Library/BaseSynchronizationLib/X64/InterlockedIncrement.nasm
@@ -1,6 +1,6 @@
;------------------------------------------------------------------------------
;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -28,7 +28,7 @@
; UINT32
; EFIAPI
; InterlockedIncrement (
-; IN UINT32 *Value
+; IN volatile UINT32 *Value
; );
;------------------------------------------------------------------------------
global ASM_PFX(InternalSyncIncrement)