MdeModulePkg/Variable: Update to consume SpeculationBarrier

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().

Please note that speculation execution barriers are intended to be
asserted for SMM codes, hence, this commit still preserve an empty
implementation of the speculation execution barrier for the DXE codes.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
This commit is contained in:
Hao Wu
2018-12-21 10:30:22 +08:00
parent 107775734d
commit 49395ea0bc
7 changed files with 38 additions and 32 deletions

View File

@@ -85,13 +85,15 @@ SetVariableCheckHandlerMor (
);
/**
This service is consumed by the variable modules to perform a serializing
operation on all load-from-memory instructions that were issued prior to the
call of this function.
This service is consumed by the variable modules to place a barrier to stop
speculative execution.
Ensures that no later instruction will execute speculatively, until all prior
instructions have completed.
**/
VOID
MemoryLoadFence (
VariableSpeculationBarrier (
VOID
);