summaryrefslogtreecommitdiffstats
path: root/MdePkg/Include
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2018-09-07 17:26:14 +0800
committerRuiyu Ni <ruiyu.ni@intel.com>2018-09-25 10:02:53 +0800
commit17634d026f968c404b039a8d8431b6389dd396ea (patch)
tree765dfedfdd01cba576b4065560fa02ceb0547e9f /MdePkg/Include
parentca3e4f8ab82485edff2cfa7eeb87f71b4be38966 (diff)
downloadedk2-17634d026f968c404b039a8d8431b6389dd396ea.tar.gz
edk2-17634d026f968c404b039a8d8431b6389dd396ea.tar.bz2
edk2-17634d026f968c404b039a8d8431b6389dd396ea.zip
MdePkg/SynchronizationLib: fix Interlocked[De|In]crement return value
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1197 Today's InterlockedIncrement()/InterlockedDecrement() guarantees to perform atomic increment/decrement but doesn't guarantee the return value equals to the new value. The patch fixes the behavior to use "XADD" instruction to guarantee the return value equals to the new value. The patch calls intrinsic functions for MSVC tool chain, calls the NASM implementation for INTEL tool chain and calls GCC inline assembly implementation (GccInline.c) for GCC tool chain. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com>
Diffstat (limited to 'MdePkg/Include')
-rw-r--r--MdePkg/Include/Library/SynchronizationLib.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/MdePkg/Include/Library/SynchronizationLib.h b/MdePkg/Include/Library/SynchronizationLib.h
index da69f6ff5e..ce3bce04f5 100644
--- a/MdePkg/Include/Library/SynchronizationLib.h
+++ b/MdePkg/Include/Library/SynchronizationLib.h
@@ -144,8 +144,7 @@ ReleaseSpinLock (
Performs an atomic increment of the 32-bit unsigned integer specified by
Value and returns the incremented value. The increment operation must be
- performed using MP safe mechanisms. The state of the return value is not
- guaranteed to be MP safe.
+ performed using MP safe mechanisms.
If Value is NULL, then ASSERT().
@@ -166,8 +165,7 @@ InterlockedIncrement (
Performs an atomic decrement of the 32-bit unsigned integer specified by
Value and returns the decremented value. The decrement operation must be
- performed using MP safe mechanisms. The state of the return value is not
- guaranteed to be MP safe.
+ performed using MP safe mechanisms.
If Value is NULL, then ASSERT().