Cc: Abner Chang <[email protected]>
Cc: Michael D Kinney <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Zhiguang Liu <[email protected]>
Cc: Leif Lindholm <[email protected]>
Signed-off-by: Daniel Schaefer <[email protected]>
---
 MdePkg/Library/BaseLib/BaseLib.inf           |  1 +
 MdePkg/Library/BaseLib/RiscV64/MemoryFence.S | 33 ++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/MdePkg/Library/BaseLib/BaseLib.inf 
b/MdePkg/Library/BaseLib/BaseLib.inf
index b76f3af380ea..b7ab5f632366 100644
--- a/MdePkg/Library/BaseLib/BaseLib.inf
+++ b/MdePkg/Library/BaseLib/BaseLib.inf
@@ -399,6 +399,7 @@
   RiscV64/DisableInterrupts.c

   RiscV64/EnableInterrupts.c

   RiscV64/CpuPause.c

+  RiscV64/MemoryFence.S             | GCC

   RiscV64/RiscVSetJumpLongJump.S    | GCC

   RiscV64/RiscVCpuBreakpoint.S      | GCC

   RiscV64/RiscVCpuPause.S           | GCC

diff --git a/MdePkg/Library/BaseLib/RiscV64/MemoryFence.S 
b/MdePkg/Library/BaseLib/RiscV64/MemoryFence.S
new file mode 100644
index 000000000000..283df9356a9a
--- /dev/null
+++ b/MdePkg/Library/BaseLib/RiscV64/MemoryFence.S
@@ -0,0 +1,33 @@
+##------------------------------------------------------------------------------

+#

+# MemoryFence() for RiscV64

+

+# Copyright (c) 2021, Hewlett Packard Enterprise Development. All rights 
reserved.

+#

+# SPDX-License-Identifier: BSD-2-Clause-Patent

+#

+##------------------------------------------------------------------------------

+

+.text

+.p2align 2

+

+ASM_GLOBAL ASM_PFX(MemoryFence)

+

+

+#/**

+#  Used to serialize load and store operations.

+#

+#  All loads and stores that proceed calls to this function are guaranteed to 
be

+#  globally visible when this function returns.

+#

+#**/

+#VOID

+#EFIAPI

+#MemoryFence (

+#  VOID

+#  );

+#

+ASM_PFX(MemoryFence):

+    // Fence on all memory and I/O

+    fence

+    ret

-- 
2.30.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75139): https://edk2.groups.io/g/devel/message/75139
Mute This Topic: https://groups.io/mt/82851071/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to