public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Michael Kinney <michael.d.kinney@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>,
	Laszlo Ersek <lersek@redhat.com>, Andrew Fish <afish@apple.com>,
	Jeff Fan <jeff.fan@intel.com>
Subject: [Patch v2 1/3] MdePkg/Include: Add volatile to SynchronizationLib parameters
Date: Thu, 17 Nov 2016 11:34:40 -0800	[thread overview]
Message-ID: <1479411282-10996-2-git-send-email-michael.d.kinney@intel.com> (raw)
In-Reply-To: <1479411282-10996-1-git-send-email-michael.d.kinney@intel.com>

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 class.  Update the library class
to consistently use volatile on all functions in this 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>
---
 MdePkg/Include/Library/SynchronizationLib.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/MdePkg/Include/Library/SynchronizationLib.h b/MdePkg/Include/Library/SynchronizationLib.h
index 7b97683..6cf3d71 100644
--- a/MdePkg/Include/Library/SynchronizationLib.h
+++ b/MdePkg/Include/Library/SynchronizationLib.h
@@ -1,7 +1,7 @@
 /** @file
   Provides synchronization functions.
 
-Copyright (c) 2006 - 2012, 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
@@ -157,7 +157,7 @@ ReleaseSpinLock (
 UINT32
 EFIAPI
 InterlockedIncrement (
-  IN      UINT32                    *Value
+  IN      volatile UINT32           *Value
   );
 
 
@@ -179,7 +179,7 @@ InterlockedIncrement (
 UINT32
 EFIAPI
 InterlockedDecrement (
-  IN      UINT32                    *Value
+  IN      volatile UINT32           *Value
   );
 
 
@@ -204,7 +204,7 @@ InterlockedDecrement (
 UINT16
 EFIAPI
 InterlockedCompareExchange16 (
-  IN OUT  UINT16                    *Value,
+  IN OUT  volatile UINT16           *Value,
   IN      UINT16                    CompareValue,
   IN      UINT16                    ExchangeValue
   );
@@ -231,7 +231,7 @@ InterlockedCompareExchange16 (
 UINT32
 EFIAPI
 InterlockedCompareExchange32 (
-  IN OUT  UINT32                    *Value,
+  IN OUT  volatile UINT32           *Value,
   IN      UINT32                    CompareValue,
   IN      UINT32                    ExchangeValue
   );
@@ -258,7 +258,7 @@ InterlockedCompareExchange32 (
 UINT64
 EFIAPI
 InterlockedCompareExchange64 (
-  IN OUT  UINT64                    *Value,
+  IN OUT  volatile UINT64           *Value,
   IN      UINT64                    CompareValue,
   IN      UINT64                    ExchangeValue
   );
@@ -285,7 +285,7 @@ InterlockedCompareExchange64 (
 VOID *
 EFIAPI
 InterlockedCompareExchangePointer (
-  IN OUT  VOID                      **Value,
+  IN OUT  VOID                      * volatile *Value,
   IN      VOID                      *CompareValue,
   IN      VOID                      *ExchangeValue
   );
-- 
2.6.3.windows.1



  reply	other threads:[~2016-11-17 19:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-17 19:34 [Patch v2 0/3] MdePkg/BaseSynchronizationLib: Add volatile Michael Kinney
2016-11-17 19:34 ` Michael Kinney [this message]
2016-11-17 19:34 ` [Patch v2 2/3] MdePkg/BaseSynchronizationLib: Add volatile Interlocked*() APIs Michael Kinney
2016-11-17 19:34 ` [Patch v2 3/3] MdePkg/BaseSynchronizationLib: Fix function names in function headers Michael Kinney
2016-11-17 19:48 ` [Patch v2 0/3] MdePkg/BaseSynchronizationLib: Add volatile Laszlo Ersek
2016-11-18  0:55 ` Gao, Liming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1479411282-10996-2-git-send-email-michael.d.kinney@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox