Page MenuHomeFreeBSD

D23338.id67232.diff
No OneTemporary

D23338.id67232.diff

Index: sys/riscv/riscv/machdep.c
===================================================================
--- sys/riscv/riscv/machdep.c
+++ sys/riscv/riscv/machdep.c
@@ -368,11 +368,16 @@
tf = td->td_frame;
/*
- * Make sure the processor mode has not been tampered with and
- * interrupts have not been disabled.
- * Supervisor interrupts in user mode are always enabled.
+ * Permit changes to the USTATUS bits of SSTATUS.
+ *
+ * Ignore writes to read-only bits (SD, XS).
+ *
+ * Ignore writes to the FS field as set_fpcontext() will set
+ * it explicitly.
*/
- if ((mcp->mc_gpregs.gp_sstatus & SSTATUS_SPP) != 0)
+ if (((mcp->mc_gpregs.gp_sstatus ^ tf->tf_sstatus) &
+ ~(SSTATUS64_SD | SSTATUS_XS_MASK | SSTATUS_FS_MASK | SSTATUS_UPIE |
+ SSTATUS_UIE)) != 0)
return (EINVAL);
memcpy(tf->tf_t, mcp->mc_gpregs.gp_t, sizeof(tf->tf_t));
@@ -426,7 +431,12 @@
{
#ifdef FPE
struct pcb *curpcb;
+#endif
+ td->td_frame->tf_sstatus &= ~SSTATUS_FS_MASK;
+ td->td_frame->tf_sstatus |= SSTATUS_FS_OFF;
+
+#ifdef FPE
critical_enter();
if ((mcp->mc_flags & _MC_FP_VALID) != 0) {
@@ -436,6 +446,7 @@
sizeof(mcp->mc_fpregs));
curpcb->pcb_fcsr = mcp->mc_fpregs.fp_fcsr;
curpcb->pcb_fpflags = mcp->mc_fpregs.fp_flags & PCB_FP_USERMASK;
+ td->td_frame->tf_sstatus |= SSTATUS_FS_CLEAN;
}
critical_exit();

File Metadata

Mime Type
text/plain
Expires
Sun, Apr 19, 11:49 AM (31 m, 38 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31767035
Default Alt Text
D23338.id67232.diff (1 KB)

Event Timeline