Use PcdSpeculationBarrierType in the x86 implementation
of SpeculationBarrier() to select between AsmLfence(),
AsmCpuid(), and no operation.
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Brian J. Johnson <brian.johnson@hpe.com>
gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength ## SOMETIMES_CONSUMES\r
gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength ## SOMETIMES_CONSUMES\r
gEfiMdePkgTokenSpaceGuid.PcdControlFlowEnforcementPropertyMask ## SOMETIMES_CONSUMES\r
+ gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType ## SOMETIMES_CONSUMES\r
\r
[FeaturePcd]\r
gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList ## CONSUMES\r
/** @file\r
SpeculationBarrier() function for IA32 and x64.\r
\r
- Copyright (C) 2018, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (C) 2018 - 2019, Intel Corporation. All rights reserved.<BR>\r
\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
VOID\r
)\r
{\r
- AsmLfence ();\r
+ if (PcdGet8 (PcdSpeculationBarrierType) == 0x01) {\r
+ AsmLfence ();\r
+ } else if (PcdGet8 (PcdSpeculationBarrierType) == 0x02) {\r
+ AsmCpuid (0x01, NULL, NULL, NULL, NULL);\r
+ }\r
}\r