Jelajahi Sumber

fix FPU initialization

Román Cárdenas 1 tahun lalu
induk
melakukan
1241212e12
1 mengubah file dengan 8 tambahan dan 4 penghapusan
  1. 8 4
      riscv-rt/src/asm.rs

+ 8 - 4
riscv-rt/src/asm.rs

@@ -184,12 +184,16 @@ cfg_global_asm!(
 // INITIALIZE FLOATING POINT UNIT
 #[cfg(any(riscvf, riscvd))]
 cfg_global_asm!(
+    "
+    li t0, 0x4000 // bit 14 is FS most significant bit
+    li t2, 0x2000 // bit 13 is FS least significant bit
+    ",
     #[cfg(feature = "s-mode")]
-    "csrrc x0, sstatus, 0x4000
-    csrrs x0, sstatus, 0x2000",
+    "csrrc x0, sstatus, t0
+    csrrs x0, sstatus, t2",
     #[cfg(not(feature = "s-mode"))]
-    "csrrc x0, mstatus, 0x4000
-    csrrs x0, mstatus, 0x2000",
+    "csrrc x0, mstatus, t0
+    csrrs x0, mstatus, t2",
     "fscsr x0",
 );
 // ZERO OUT FLOATING POINT REGISTERS