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:
@@ -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
|
||||
; );
|
||||
|
@@ -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
|
||||
)
|
||||
|
@@ -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
|
||||
; );
|
||||
|
@@ -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
|
||||
; );
|
||||
|
@@ -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
|
||||
)
|
||||
|
@@ -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
|
||||
; );
|
||||
|
@@ -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
|
||||
; );
|
||||
|
@@ -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
|
||||
)
|
||||
|
@@ -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
|
||||
; );
|
||||
|
@@ -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
|
||||
|
@@ -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));
|
||||
}
|
||||
|
||||
|
@@ -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)
|
||||
|
@@ -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
|
||||
|
@@ -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));
|
||||
}
|
||||
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user