Skip to content

Commit

Permalink
fix FPU initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
romancardenas committed Jan 3, 2024
1 parent f3e755e commit b443cf3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions riscv-rt/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,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
Expand Down

0 comments on commit b443cf3

Please sign in to comment.