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:
@@ -538,11 +538,11 @@ SmmVariableHandler (
|
||||
}
|
||||
|
||||
//
|
||||
// The MemoryLoadFence() call here is to ensure the previous range/content
|
||||
// checks for the CommBuffer have been completed before the subsequent
|
||||
// consumption of the CommBuffer content.
|
||||
// The VariableSpeculationBarrier() call here is to ensure the previous
|
||||
// range/content checks for the CommBuffer have been completed before the
|
||||
// subsequent consumption of the CommBuffer content.
|
||||
//
|
||||
MemoryLoadFence ();
|
||||
VariableSpeculationBarrier ();
|
||||
if (SmmVariableHeader->NameSize < sizeof (CHAR16) || SmmVariableHeader->Name[SmmVariableHeader->NameSize/sizeof (CHAR16) - 1] != L'\0') {
|
||||
//
|
||||
// Make sure VariableName is A Null-terminated string.
|
||||
@@ -638,11 +638,11 @@ SmmVariableHandler (
|
||||
}
|
||||
|
||||
//
|
||||
// The MemoryLoadFence() call here is to ensure the previous range/content
|
||||
// checks for the CommBuffer have been completed before the subsequent
|
||||
// consumption of the CommBuffer content.
|
||||
// The VariableSpeculationBarrier() call here is to ensure the previous
|
||||
// range/content checks for the CommBuffer have been completed before the
|
||||
// subsequent consumption of the CommBuffer content.
|
||||
//
|
||||
MemoryLoadFence ();
|
||||
VariableSpeculationBarrier ();
|
||||
if (SmmVariableHeader->NameSize < sizeof (CHAR16) || SmmVariableHeader->Name[SmmVariableHeader->NameSize/sizeof (CHAR16) - 1] != L'\0') {
|
||||
//
|
||||
// Make sure VariableName is A Null-terminated string.
|
||||
@@ -779,11 +779,11 @@ SmmVariableHandler (
|
||||
}
|
||||
|
||||
//
|
||||
// The MemoryLoadFence() call here is to ensure the previous range/content
|
||||
// checks for the CommBuffer have been completed before the subsequent
|
||||
// consumption of the CommBuffer content.
|
||||
// The VariableSpeculationBarrier() call here is to ensure the previous
|
||||
// range/content checks for the CommBuffer have been completed before the
|
||||
// subsequent consumption of the CommBuffer content.
|
||||
//
|
||||
MemoryLoadFence ();
|
||||
VariableSpeculationBarrier ();
|
||||
if (CommVariableProperty->NameSize < sizeof (CHAR16) || CommVariableProperty->Name[CommVariableProperty->NameSize/sizeof (CHAR16) - 1] != L'\0') {
|
||||
//
|
||||
// Make sure VariableName is A Null-terminated string.
|
||||
|
Reference in New Issue
Block a user