[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] xen/riscv: disable fpu



Disable FPU to detect illegal usage of floating point in kernel
space.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
---
 xen/arch/riscv/setup.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 593bb471a4..b7cd438a1d 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -36,6 +36,11 @@ static void __init init_bss(void)
     }
 }
 
+static void __init disable_fpu(void)
+{
+    csr_write(CSR_SSTATUS, SSTATUS_FS);
+}
+
 void __init noreturn start_xen(void)
 {
     /*
@@ -52,6 +57,8 @@ void __init noreturn start_xen(void)
 
     init_bss();
 
+    disable_fpu();
+
     early_printk("Hello from C env\n");
 
     trap_init();
-- 
2.39.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.