Module Name: src
Committed By: skrll
Date: Wed Nov 4 20:04:01 UTC 2020
Modified Files:
src/sys/arch/riscv/riscv: trap.c vm_machdep.c
Log Message:
Miscellaneous updates to reflect riscv-privileged-20190608.pdf
Some from zmcgrew@
To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/riscv/riscv/trap.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/riscv/riscv/vm_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/riscv/riscv/trap.c
diff -u src/sys/arch/riscv/riscv/trap.c:1.12 src/sys/arch/riscv/riscv/trap.c:1.13
--- src/sys/arch/riscv/riscv/trap.c:1.12 Wed Nov 4 07:09:46 2020
+++ src/sys/arch/riscv/riscv/trap.c Wed Nov 4 20:04:01 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.12 2020/11/04 07:09:46 skrll Exp $ */
+/* $NetBSD: trap.c,v 1.13 2020/11/04 20:04:01 skrll Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
#define __PMAP_PRIVATE
#define __UFETCHSTORE_PRIVATE
-__RCSID("$NetBSD: trap.c,v 1.12 2020/11/04 07:09:46 skrll Exp $");
+__RCSID("$NetBSD: trap.c,v 1.13 2020/11/04 20:04:01 skrll Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -372,7 +372,7 @@ cpu_trap(struct trapframe *tf, register_
{
const u_int fault_mask = 1U << cause;
const intptr_t addr = tval;
- const bool usertrap_p = (status & SR_PS) == 0;
+ const bool usertrap_p = (status & SR_SPP) == 0;
bool ok = true;
ksiginfo_t ksi;
Index: src/sys/arch/riscv/riscv/vm_machdep.c
diff -u src/sys/arch/riscv/riscv/vm_machdep.c:1.3 src/sys/arch/riscv/riscv/vm_machdep.c:1.4
--- src/sys/arch/riscv/riscv/vm_machdep.c:1.3 Sat Mar 14 16:12:16 2020
+++ src/sys/arch/riscv/riscv/vm_machdep.c Wed Nov 4 20:04:01 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_machdep.c,v 1.3 2020/03/14 16:12:16 skrll Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.4 2020/11/04 20:04:01 skrll Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.3 2020/03/14 16:12:16 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.4 2020/11/04 20:04:01 skrll Exp $");
#define _PMAP_PRIVATE
@@ -91,7 +91,9 @@ cpu_lwp_fork(struct lwp *l1, struct lwp
vaddr_t ua2 = uvm_lwp_getuarea(l2);
tf = (struct trapframe *)(ua2 + USPACE) - 1;
*tf = *l1->l_md.md_utf;
+#ifdef FPE
tf->tf_sr &= ~SR_EF; /* floating point must be disabled */
+#endif
/* If specified, set a different user stack for a child. */
if (stack != NULL) {
@@ -114,12 +116,8 @@ cpu_lwp_fork(struct lwp *l1, struct lwp
tf->tf_s0 = (intptr_t)func; /* S0 */
tf->tf_s1 = (intptr_t)arg; /* S1 */
tf->tf_ra = (intptr_t)cpu_lwp_trampoline; /* RA */
- l2->l_md.md_ktf = tf; /* SP */
- KASSERT(tf->tf_sr & SR_S);
-#ifdef _LP64
- KASSERT(tf->tf_sr & SR_S64);
-#endif
- KASSERT(tf->tf_sr & SR_EI);
+ l2->l_md.md_ktf = tf; /* SP */
+ KASSERT(tf->tf_sr & SR_SIE);
}
/*