diff options
Diffstat (limited to 'MdePkg/Library/BaseCpuLib')
-rw-r--r-- | MdePkg/Library/BaseCpuLib/BaseCpuLib.inf | 3 | ||||
-rw-r--r-- | MdePkg/Library/BaseCpuLib/RiscV/InitializeFpu.S | 22 |
2 files changed, 24 insertions, 1 deletions
diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf index 89f6272..57b6014 100644 --- a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf +++ b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf @@ -62,7 +62,8 @@ AArch64/CpuSleep.asm | MSFT
[Sources.RISCV64]
- RiscV/Cpu.S
+ RiscV/Cpu.S | GCC
+ RiscV/InitializeFpu.S | GCC
[Sources.LOONGARCH64]
LoongArch/CpuFlushTlb.S | GCC
diff --git a/MdePkg/Library/BaseCpuLib/RiscV/InitializeFpu.S b/MdePkg/Library/BaseCpuLib/RiscV/InitializeFpu.S new file mode 100644 index 0000000..dda5caa --- /dev/null +++ b/MdePkg/Library/BaseCpuLib/RiscV/InitializeFpu.S @@ -0,0 +1,22 @@ +// ------------------------------------------------------------------------------
+//
+// Enable FPU for RISC-V
+//
+// Copyright (c) 2024, Canonical Services Ltd.<BR>
+// Copyright (c) 2025, Ventana Micro Systems Inc. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// ------------------------------------------------------------------------------
+#include <Register/RiscV64/RiscVImpl.h>
+
+.global ASM_PFX(InitializeFloatingPointUnits)
+
+ASM_PFX(InitializeFloatingPointUnits):
+ csrr a0, CSR_SSTATUS
+ li a1, MSTATUS_FS
+ or a0, a0, a1
+ csrw CSR_SSTATUS, a0
+ csrw CSR_FCSR, x0
+ li a0, 0
+ ret
|