Skip to content

Commit 1241212

Browse files
committed
fix FPU initialization
1 parent 8baa254 commit 1241212

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

riscv-rt/src/asm.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,16 @@ cfg_global_asm!(
184184
// INITIALIZE FLOATING POINT UNIT
185185
#[cfg(any(riscvf, riscvd))]
186186
cfg_global_asm!(
187+
"
188+
li t0, 0x4000 // bit 14 is FS most significant bit
189+
li t2, 0x2000 // bit 13 is FS least significant bit
190+
",
187191
#[cfg(feature = "s-mode")]
188-
"csrrc x0, sstatus, 0x4000
189-
csrrs x0, sstatus, 0x2000",
192+
"csrrc x0, sstatus, t0
193+
csrrs x0, sstatus, t2",
190194
#[cfg(not(feature = "s-mode"))]
191-
"csrrc x0, mstatus, 0x4000
192-
csrrs x0, mstatus, 0x2000",
195+
"csrrc x0, mstatus, t0
196+
csrrs x0, mstatus, t2",
193197
"fscsr x0",
194198
);
195199
// ZERO OUT FLOATING POINT REGISTERS

0 commit comments

Comments
 (0)