Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arch/risc-v: Fix save/load FPU macros #9123

Merged
merged 1 commit into from Apr 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 16 additions & 4 deletions arch/risc-v/src/common/riscv_macros.S
Expand Up @@ -105,7 +105,7 @@
li t1, MSTATUS_FS
and t2, t0, t1
li t1, MSTATUS_FS_DIRTY
bne t2, t1, skip_save_fpu
bne t2, t1, 1f
li t1, ~MSTATUS_FS
and t0, t0, t1
li t1, MSTATUS_FS_CLEAN
Expand Down Expand Up @@ -150,7 +150,13 @@
frcsr t0
REGSTORE t0, REG_FCSR(\in)

skip_save_fpu:
1:

/* Restore what we have just destroyed (t0, t1, t2) */

REGLOAD t0, REG_T0(\in)
REGLOAD t1, REG_T1(\in)
REGLOAD t2, REG_T2(\in)

#endif

Expand Down Expand Up @@ -222,7 +228,7 @@ skip_save_fpu:
li t1, MSTATUS_FS
and t2, t0, t1
li t1, MSTATUS_FS_INIT
ble t2, t1, skip_load_fpu
ble t2, t1, 1f

/* Load all floating point registers */

Expand Down Expand Up @@ -264,7 +270,13 @@ skip_save_fpu:
REGLOAD t0, REG_FCSR(\out)
fscsr t0

skip_load_fpu:
1:

/* Restore what we have just destroyed (t0, t1, t2) */

REGLOAD t0, REG_T0(\out)
REGLOAD t1, REG_T1(\out)
REGLOAD t2, REG_T2(\out)

#endif

Expand Down