mirror of https://github.com/acidanthera/audk.git
MdePkg/BaseLib: Add SpeculationBarrier implementation for RiscV64
Implement the SpeculationBarrier with implementations consisting of fence instruction which provides finer-grain memory orderings. Perform Data Barrier in RiscV: fence rw,rw Perform Instruction Barrier in RiscV: fence.i; fence r,r More detail is in Appendix A: RVWMO Explanatory Material in https://github.com/riscv/riscv-isa-manual This API is first introduced in the below commits for IA32 and x64d9f1cac51b
e83d841fdc
and below the commit for ARM and AArch64 implementationc0959b4426
This commit is to add the RiscV64 implementation which will be used by variable service under Variable/RuntimeDxe Cc: Andrei Warkentin <andrei.warkentin@intel.com> Cc: Evan Chai <evan.chai@intel.com> Cc: Sunil V L <sunilvl@ventanamicro.com> Cc: Tuan Phan <tphan@ventanamicro.com> Signed-off-by: Yong Li <yong.li@intel.com> Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
This commit is contained in:
parent
d189de3b0a
commit
ded0b489af
|
@ -404,6 +404,7 @@
|
|||
RiscV64/CpuScratch.S | GCC
|
||||
RiscV64/ReadTimer.S | GCC
|
||||
RiscV64/RiscVMmu.S | GCC
|
||||
RiscV64/SpeculationBarrier.S | GCC
|
||||
|
||||
[Sources.LOONGARCH64]
|
||||
Math64.c
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
##------------------------------------------------------------------------------
|
||||
#
|
||||
# SpeculationBarrier() for RISCV64
|
||||
#
|
||||
# Copyright (c) 2023, Intel Corporation. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
##------------------------------------------------------------------------------
|
||||
|
||||
.text
|
||||
.p2align 2
|
||||
|
||||
ASM_GLOBAL ASM_PFX(SpeculationBarrier)
|
||||
|
||||
|
||||
#/**
|
||||
# Uses as a barrier to stop speculative execution.
|
||||
#
|
||||
# Ensures that no later instruction will execute speculatively, until all prior
|
||||
# instructions have completed.
|
||||
#
|
||||
#**/
|
||||
#VOID
|
||||
#EFIAPI
|
||||
#SpeculationBarrier (
|
||||
# VOID
|
||||
# );
|
||||
#
|
||||
ASM_PFX(SpeculationBarrier):
|
||||
fence rw,rw
|
||||
fence.i
|
||||
fence r,r
|
||||
ret
|
Loading…
Reference in New Issue