Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/riscv Miscellaneous updates to reflect riscv-privil...
details: https://anonhg.NetBSD.org/src/rev/64d4cecab468
branches: trunk
changeset: 956691:64d4cecab468
user: skrll <skrll%NetBSD.org@localhost>
date: Wed Nov 04 20:04:01 2020 +0000
description:
Miscellaneous updates to reflect riscv-privileged-20190608.pdf
Some from zmcgrew@
diffstat:
sys/arch/riscv/include/sysreg.h | 12 ++++++------
sys/arch/riscv/riscv/genassym.cf | 12 ++++++++++--
sys/arch/riscv/riscv/locore.S | 11 +----------
sys/arch/riscv/riscv/riscv_machdep.c | 6 ++++--
sys/arch/riscv/riscv/trap.c | 6 +++---
sys/arch/riscv/riscv/vm_machdep.c | 14 ++++++--------
6 files changed, 30 insertions(+), 31 deletions(-)
diffs (183 lines):
diff -r 43b0e76ebd53 -r 64d4cecab468 sys/arch/riscv/include/sysreg.h
--- a/sys/arch/riscv/include/sysreg.h Wed Nov 04 19:27:53 2020 +0000
+++ b/sys/arch/riscv/include/sysreg.h Wed Nov 04 20:04:01 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysreg.h,v 1.9 2020/11/04 06:56:56 skrll Exp $ */
+/* $NetBSD: sysreg.h,v 1.10 2020/11/04 20:05:47 skrll Exp $ */
/*
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -167,12 +167,12 @@
#define SIE_IM (SIE_SEI|SIE_UEIE|SIE_STIE|SIE_UTIE|SIE_SSIE|SIE_USIE)
#ifdef _LP64
-#define SR_USER (SR_UIE | SR_U64 | SR_S64 | SR_IM)
-#define SR_USER32 (SR_USER & ~SR_U64)
-#define SR_KERNEL (SR_S | SR_UIE | SR_U64 | SR_S64)
+#define SR_USER (SR_UIE)
+#define SR_USER32 (SR_USER)
+#define SR_KERNEL (SR_SIE | SR_UIE)
#else
-#define SR_USER (SR_UIE||SR_IM)
-#define SR_KERNEL (SR_S|SR_UIE)
+#define SR_USER (SR_UIE)
+#define SR_KERNEL (SR_SIE | SR_UIE)
#endif
static inline uint32_t
diff -r 43b0e76ebd53 -r 64d4cecab468 sys/arch/riscv/riscv/genassym.cf
--- a/sys/arch/riscv/riscv/genassym.cf Wed Nov 04 19:27:53 2020 +0000
+++ b/sys/arch/riscv/riscv/genassym.cf Wed Nov 04 20:04:01 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.9 2020/11/04 07:51:08 skrll Exp $
+# $NetBSD: genassym.cf,v 1.10 2020/11/04 20:05:47 skrll Exp $
#-
# Copyright (c) 2014 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -62,6 +62,14 @@
define CAUSE_SYSCALL CAUSE_SYSCALL
+ifdef _LP64
+define SATP_MODE_MASK SATP_MODE
+define SATP_MODE_SV39 __SHIFTIN(SATP_MODE_SV39, SATP_MODE)
+define SATP_MODE_SV48 __SHIFTIN(SATP_MODE_SV48, SATP_MODE)
+else
+define SATP_MODE_SV32 __SHIFTIN(SATP_MODE_SV32, SATP_MODE)
+endif
+
define IPL_HIGH IPL_HIGH
define IPL_DDB IPL_DDB
define IPL_SCHED IPL_SCHED
@@ -108,7 +116,7 @@
define TF_GP offsetof(struct trapframe, tf_reg[_X_GP])
define TF_PC offsetof(struct trapframe, tf_pc)
define TF_CAUSE offsetof(struct trapframe, tf_cause)
-define TF_TVA L offsetof(struct trapframe, tf_tval)
+define TF_TVAL offsetof(struct trapframe, tf_tval)
define TF_SR offsetof(struct trapframe, tf_sr)
define L_CPU offsetof(struct lwp, l_cpu)
diff -r 43b0e76ebd53 -r 64d4cecab468 sys/arch/riscv/riscv/locore.S
--- a/sys/arch/riscv/riscv/locore.S Wed Nov 04 19:27:53 2020 +0000
+++ b/sys/arch/riscv/riscv/locore.S Wed Nov 04 20:04:01 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.S,v 1.15 2020/11/04 07:09:46 skrll Exp $ */
+/* $NetBSD: locore.S,v 1.16 2020/11/04 20:05:47 skrll Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -39,15 +39,6 @@
// We get loaded and starting running at or near 0, not where we
// should be. We need to construct an initial PDETAB
-#ifdef _LP64
- li t0, SR_U64|SR_S64
- li t1, SR_IM|SR_SIE
- csrs sstatus, t0
-#else
- li t1, SR_IM|SR_U64|SR_S64|SR_EI
-#endif
- csrc sstatus, t1
-
li s11, VM_MAX_KERNEL_ADDRESS
li s10, PAGE_SIZE
li s9, USPACE
diff -r 43b0e76ebd53 -r 64d4cecab468 sys/arch/riscv/riscv/riscv_machdep.c
--- a/sys/arch/riscv/riscv/riscv_machdep.c Wed Nov 04 19:27:53 2020 +0000
+++ b/sys/arch/riscv/riscv/riscv_machdep.c Wed Nov 04 20:04:01 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: riscv_machdep.c,v 1.12 2020/11/04 07:09:46 skrll Exp $ */
+/* $NetBSD: riscv_machdep.c,v 1.13 2020/11/04 20:05:47 skrll Exp $ */
/*-
* Copyright (c) 2014, 2019 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
#include "opt_modular.h"
-__RCSID("$NetBSD: riscv_machdep.c,v 1.12 2020/11/04 07:09:46 skrll Exp $");
+__RCSID("$NetBSD: riscv_machdep.c,v 1.13 2020/11/04 20:05:47 skrll Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -124,7 +124,9 @@
tf->tf_a0 = 0;
tf->tf_a1 = 1;
+#ifdef FPE
tf->tf_sr &= ~SR_EF; /* Disable FP as we can't be them. */
+#endif
}
void
diff -r 43b0e76ebd53 -r 64d4cecab468 sys/arch/riscv/riscv/trap.c
--- a/sys/arch/riscv/riscv/trap.c Wed Nov 04 19:27:53 2020 +0000
+++ b/sys/arch/riscv/riscv/trap.c Wed Nov 04 20:04:01 2020 +0000
@@ -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 @@
{
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;
diff -r 43b0e76ebd53 -r 64d4cecab468 sys/arch/riscv/riscv/vm_machdep.c
--- a/sys/arch/riscv/riscv/vm_machdep.c Wed Nov 04 19:27:53 2020 +0000
+++ b/sys/arch/riscv/riscv/vm_machdep.c Wed Nov 04 20:04:01 2020 +0000
@@ -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 @@
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 @@
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);
}
/*
Home |
Main Index |
Thread Index |
Old Index