[PATCH] lib: sbi: Fix FP state enable in sbi_fp_save
whensun
theodoruswensanfebruanto025 at gmail.com
Fri Aug 28 14:31:04 PDT 2026
sbi_fp_save() currently sets mstatus.VS before executing floating-point
store instructions. VS controls vector state and does not enable
floating-point instructions.
Set mstatus.FS instead, matching sbi_fp_restore(), so floating-point
state can be saved when FS was previously Off.
Fixes: 718e1d194f5a ("lib: sbi: Add floating-point context save/restore support.")
Signed-off-by: whensun <theodoruswensanfebruanto025 at gmail.com>
---
lib/sbi/sbi_fp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/sbi/sbi_fp.c b/lib/sbi/sbi_fp.c
index c8941252..38fb7a01 100644
--- a/lib/sbi/sbi_fp.c
+++ b/lib/sbi/sbi_fp.c
@@ -20,7 +20,7 @@ void sbi_fp_save(struct sbi_fp_context *dst)
if (!dst)
return;
- mstatus_orig = csr_read_set(CSR_MSTATUS, MSTATUS_VS);
+ mstatus_orig = csr_read_set(CSR_MSTATUS, MSTATUS_FS);
asm volatile(
#if defined(__riscv_d)
--
2.43.0
More information about the opensbi
mailing list