58 lines
1.3 KiB
Diff
58 lines
1.3 KiB
Diff
From eeb898078a9c5a97b4684bb1182a63c203d9b11e Mon Sep 17 00:00:00 2001
|
|
From: Jason Montleon <jason@montleon.com>
|
|
Date: Tue, 25 Jun 2024 23:11:38 -0400
|
|
Subject: [PATCH 5/7] Implement __riscv_flush_icache
|
|
|
|
Signed-off-by: Jason Montleon <jason@montleon.com>
|
|
---
|
|
lib/Makefile | 1 +
|
|
lib/riscv64/cache.S | 10 ++++++++++
|
|
lib/riscv64/edk2asm.h | 6 ++++++
|
|
3 files changed, 17 insertions(+)
|
|
create mode 100644 lib/riscv64/cache.S
|
|
create mode 100644 lib/riscv64/edk2asm.h
|
|
|
|
diff --git a/lib/Makefile b/lib/Makefile
|
|
index 0b79246..2846167 100644
|
|
--- a/lib/Makefile
|
|
+++ b/lib/Makefile
|
|
@@ -32,6 +32,7 @@ DEFINES += -DMDE_CPU_ARM
|
|
endif
|
|
ifeq ($(ARCH),riscv64)
|
|
DEFINES += -DMDE_CPU_RISCV64
|
|
+LIBFILES += $(ARCH)/cache.o
|
|
endif
|
|
|
|
LDFLAGS = -nostdlib -znocombreloc
|
|
diff --git a/lib/riscv64/cache.S b/lib/riscv64/cache.S
|
|
new file mode 100644
|
|
index 0000000..b31d6d7
|
|
--- /dev/null
|
|
+++ b/lib/riscv64/cache.S
|
|
@@ -0,0 +1,10 @@
|
|
+#include "edk2asm.h"
|
|
+
|
|
+ .file "cache.S"
|
|
+ .text
|
|
+
|
|
+GCC_ASM_EXPORT(__riscv_flush_icache)
|
|
+
|
|
+ASM_PFX(__riscv_flush_icache):
|
|
+ fence.i
|
|
+ ret
|
|
diff --git a/lib/riscv64/edk2asm.h b/lib/riscv64/edk2asm.h
|
|
new file mode 100644
|
|
index 0000000..9515eaf
|
|
--- /dev/null
|
|
+++ b/lib/riscv64/edk2asm.h
|
|
@@ -0,0 +1,6 @@
|
|
+
|
|
+#define ASM_PFX(x) x
|
|
+#define GCC_ASM_EXPORT(x) \
|
|
+ .globl x ; \
|
|
+ .type x, %function
|
|
+
|
|
--
|
|
2.44.0
|
|
|