Browse Source

Fix fcsr save slot address calculation

h/t @jrtc27
pull/256/head
Andrew Waterman 5 years ago
parent
commit
b7ee973477
  1. 2
      machine/minit.c

2
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);

Loading…
Cancel
Save