aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2021-09-20 15:13:12 -0700
committerAndrew Waterman <andrew@sifive.com>2021-09-20 15:13:12 -0700
commitb7ee9734776123c34a8c0d37fa981169521614ad (patch)
tree8b62712ba17f56669fd07dddd0fcd86127fb15b8
parent7ae86fb97b792586493255f935f2f12ff068b13f (diff)
downloadriscv-pk-b7ee9734776123c34a8c0d37fa981169521614ad.zip
riscv-pk-b7ee9734776123c34a8c0d37fa981169521614ad.tar.gz
riscv-pk-b7ee9734776123c34a8c0d37fa981169521614ad.tar.bz2
Fix fcsr save slot address calculation
h/t @jrtc27
-rw-r--r--machine/minit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/machine/minit.c b/machine/minit.c
index 16cd912..8e3bdb9 100644
--- a/machine/minit.c
+++ b/machine/minit.c
@@ -243,7 +243,7 @@ void enter_supervisor_mode(void (*fn)(uintptr_t), uintptr_t arg0, uintptr_t arg1
write_csr(mstatus, mstatus);
write_csr(mscratch, MACHINE_STACK_TOP() - MENTRY_FRAME_SIZE);
#ifndef __riscv_flen
- uintptr_t *p_fcsr = (uintptr_t*)MACHINE_STACK_TOP() - MENTRY_FRAME_SIZE; // the x0's save slot
+ uintptr_t *p_fcsr = (uintptr_t*)(MACHINE_STACK_TOP() - MENTRY_FRAME_SIZE); // the x0's save slot
*p_fcsr = 0;
#endif
write_csr(mepc, fn);