[edk2] [PATCH v1 2/5] MdeModulePkg/FaultTolerantWrite: Update to consume SpeculationBarrier

Hao Wu hao.a.wu at intel.com
Thu Dec 20 19:11:03 PST 2018


REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1417

Since BaseLib API AsmLfence() is a x86 arch specific API and should be
avoided using in generic codes, this commit replaces the usage of
AsmLfence() with arch-generic API SpeculationBarrier().

Cc: Ard Biesheuvel <ard.biesheuvel at linaro.org>
Cc: Jiewen Yao <jiewen.yao at intel.com>
Cc: Liming Gao <liming.gao at intel.com>
Cc: Jian J Wang <jian.j.wang at intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu at intel.com>
---
 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c
index 27fcab19b6..481fea3f1f 100644
--- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c
+++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c
@@ -419,11 +419,11 @@ SmmFaultTolerantWriteHandler (
                  );
       if (!EFI_ERROR (Status)) {
         //
-        // The AsmLfence() call here is to ensure the previous range/content
-        // checks for the CommBuffer have been completed before calling into
-        // FtwWrite().
+        // The SpeculationBarrier() call here is to ensure the previous
+        // range/content checks for the CommBuffer have been completed before
+        // calling into FtwWrite().
         //
-        AsmLfence ();
+        SpeculationBarrier ();
         Status = FtwWrite(
                    &mFtwDevice->FtwInstance,
                    SmmFtwWriteHeader->Lba,
-- 
2.12.0.windows.1



More information about the edk2-devel mailing list