-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The OpenSSL library uses floating point registers. The is no guarantee that a prior firmware stage has enabled the FPU. Provide a library BaseRiscVFpuLib to * Enable the FPU and set it to state 'dirty'. * Clear the fcsr CSR. Signed-off-by: Heinrich Schuchardt <[email protected]>
- Loading branch information
1 parent
28dd588
commit f8c7385
Showing
8 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,7 @@ | |
PeCoffGetEntryPointLib | ||
RiscVSbiLib | ||
RiscVMmuLib | ||
RiscVFpuLib | ||
CacheMaintenanceLib | ||
|
||
[Sources] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** @file | ||
Copyright (c) 2024, Canonical Services Ltd<BR> | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#ifndef BASE_RISCV_FPU_LIB_H_ | ||
#define BASE_RISCV_FPU_LIB_H_ | ||
|
||
/** | ||
Initialize floating point unit | ||
**/ | ||
EFI_STATUS | ||
EFIAPI | ||
RiscVInitializeFpu ( | ||
VOID | ||
); | ||
|
||
#endif /* BASE_RISCV_FPU_LIB_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
## @file | ||
# RISC-V FPU library. | ||
# | ||
# Copyright (c) 2024, Canonical Services Ltd | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
# | ||
## | ||
|
||
[Defines] | ||
INF_VERSION = 0x0001001b | ||
BASE_NAME = BaseRiscVFpuLib | ||
FILE_GUID = e600fe4d-8595-40f3-90a0-5f043ce155c2 | ||
MODULE_TYPE = BASE | ||
VERSION_STRING = 1.0 | ||
LIBRARY_CLASS = RiscVFpuLib | ||
|
||
[Sources] | ||
RiscVFpuCore.S | ||
|
||
[Packages] | ||
MdePkg/MdePkg.dec | ||
UefiCpuPkg/UefiCpuPkg.dec | ||
|
||
[LibraryClasses] | ||
BaseLib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** @file | ||
* | ||
* Copyright (c) 2024, Canonical Services Ltd | ||
* | ||
* SPDX-License-Identifier: BSD-2-Clause-Patent | ||
* | ||
**/ | ||
|
||
#include <Library/BaseRiscVFpuLib.h> | ||
#include <Register/RiscV64/RiscVImpl.h> | ||
|
||
// | ||
// Initialize floating point unit | ||
// | ||
ASM_FUNC (RiscVInitializeFpu) | ||
csrr a0, CSR_SSTATUS | ||
li a1, MSTATUS_FS | ||
or a0, a0, a1 | ||
csrw CSR_SSTATUS, a0 | ||
csrw CSR_FCSR, x0 | ||
li a0, 0 | ||
ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters