Skip to content

Commit b443cf3

Browse files
committed
fix FPU initialization
1 parent f3e755e commit b443cf3

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
@@ -164,12 +164,16 @@ cfg_global_asm!(
164164
// INITIALIZE FLOATING POINT UNIT
165165
#[cfg(any(riscvf, riscvd))]
166166
cfg_global_asm!(
167+
"
168+
li t0, 0x4000 // bit 14 is FS most significant bit
169+
li t2, 0x2000 // bit 13 is FS least significant bit
170+
",
167171
#[cfg(feature = "s-mode")]
168-
"csrrc x0, sstatus, 0x4000
169-
csrrs x0, sstatus, 0x2000",
172+
"csrrc x0, sstatus, t0
173+
csrrs x0, sstatus, t2",
170174
#[cfg(not(feature = "s-mode"))]
171-
"csrrc x0, mstatus, 0x4000
172-
csrrs x0, mstatus, 0x2000",
175+
"csrrc x0, mstatus, t0
176+
csrrs x0, mstatus, t2",
173177
"fscsr x0",
174178
);
175179
// ZERO OUT FLOATING POINT REGISTERS

0 commit comments

Comments
 (0)