Module Name: src
Committed By: skrll
Date: Thu Oct 7 07:13:35 UTC 2021
Modified Files:
src/sys/arch/riscv/riscv: pmap_machdep.c riscv_machdep.c syscall.c
trap.c
Log Message:
Hacky build fixes
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/riscv/riscv/pmap_machdep.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/riscv/riscv/riscv_machdep.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/riscv/riscv/syscall.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/riscv/riscv/trap.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/pmap_machdep.c
diff -u src/sys/arch/riscv/riscv/pmap_machdep.c:1.8 src/sys/arch/riscv/riscv/pmap_machdep.c:1.9
--- src/sys/arch/riscv/riscv/pmap_machdep.c:1.8 Sat Oct 2 14:28:05 2021
+++ src/sys/arch/riscv/riscv/pmap_machdep.c Thu Oct 7 07:13:35 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap_machdep.c,v 1.8 2021/10/02 14:28:05 skrll Exp $ */
+/* $NetBSD: pmap_machdep.c,v 1.9 2021/10/07 07:13:35 skrll Exp $ */
/*
* Copyright (c) 2014, 2019, 2021 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
-__RCSID("$NetBSD: pmap_machdep.c,v 1.8 2021/10/02 14:28:05 skrll Exp $");
+__RCSID("$NetBSD: pmap_machdep.c,v 1.9 2021/10/07 07:13:35 skrll Exp $");
#include <sys/param.h>
@@ -57,22 +57,30 @@ pmap_bootstrap(void)
void
pmap_zero_page(paddr_t pa)
{
+#ifdef _LP64
#ifdef PMAP_DIRECT_MAP
memset((void *)PMAP_DIRECT_MAP(pa), 0, PAGE_SIZE);
#else
#error "no direct map"
#endif
+#else
+ KASSERT(false);
+#endif
}
void
pmap_copy_page(paddr_t src, paddr_t dst)
{
+#ifdef _LP64
#ifdef PMAP_DIRECT_MAP
memcpy((void *)PMAP_DIRECT_MAP(dst), (const void *)PMAP_DIRECT_MAP(src),
PAGE_SIZE);
#else
#error "no direct map"
#endif
+#else
+ KASSERT(false);
+#endif
}
struct vm_page *
@@ -113,10 +121,15 @@ paddr_t
pmap_md_direct_mapped_vaddr_to_paddr(vaddr_t va)
{
#ifdef _LP64
+#ifdef PMAP_DIRECT_MAP
return PMAP_DIRECT_UNMAP(va);
#else
#error "no direct map"
#endif
+#else
+ KASSERT(false);
+ return 0;
+#endif
}
vaddr_t
Index: src/sys/arch/riscv/riscv/riscv_machdep.c
diff -u src/sys/arch/riscv/riscv/riscv_machdep.c:1.14 src/sys/arch/riscv/riscv/riscv_machdep.c:1.15
--- src/sys/arch/riscv/riscv/riscv_machdep.c:1.14 Sat May 1 06:53:08 2021
+++ src/sys/arch/riscv/riscv/riscv_machdep.c Thu Oct 7 07:13:35 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: riscv_machdep.c,v 1.14 2021/05/01 06:53:08 skrll Exp $ */
+/* $NetBSD: riscv_machdep.c,v 1.15 2021/10/07 07:13:35 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.14 2021/05/01 06:53:08 skrll Exp $");
+__RCSID("$NetBSD: riscv_machdep.c,v 1.15 2021/10/07 07:13:35 skrll Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -157,7 +157,9 @@ startlwp(void *arg)
// We've worked hard to make sure struct reg and __gregset_t are the same.
// Ditto for struct fpreg and fregset_t.
+#ifdef _LP64
CTASSERT(sizeof(struct reg) == sizeof(__gregset_t));
+#endif
CTASSERT(sizeof(struct fpreg) == sizeof(__fregset_t));
void
Index: src/sys/arch/riscv/riscv/syscall.c
diff -u src/sys/arch/riscv/riscv/syscall.c:1.2 src/sys/arch/riscv/riscv/syscall.c:1.3
--- src/sys/arch/riscv/riscv/syscall.c:1.2 Sat Mar 14 16:12:16 2020
+++ src/sys/arch/riscv/riscv/syscall.c Thu Oct 7 07:13:35 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: syscall.c,v 1.2 2020/03/14 16:12:16 skrll Exp $ */
+/* $NetBSD: syscall.c,v 1.3 2021/10/07 07:13:35 skrll Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.2 2020/03/14 16:12:16 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.3 2021/10/07 07:13:35 skrll Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@@ -81,7 +81,6 @@ EMULNAME(syscall)(struct trapframe *tf)
register_t retval[2];
const struct sysent *callp;
int code, error;
- size_t i;
#ifdef _LP64
const bool pk32_p = (p->p_flag & PK_32) != 0;
register_t copyargs[EMULNAME(SYS_MAXSYSARGS)];
@@ -110,8 +109,8 @@ EMULNAME(syscall)(struct trapframe *tf)
else
callp += code;
- const size_t nargs = callp->sy_narg;
#ifdef _LP64
+ const size_t nargs = callp->sy_narg;
/*
* If there are no 64bit arguments, we still need "sanitize" the
* 32-bit arguments in case they try to slip through a 64-bit pointer.
@@ -141,7 +140,7 @@ EMULNAME(syscall)(struct trapframe *tf)
* encounter a 64 bit argument, we grab two adjacent 32bit
* values and synthesize the 64bit argument.
*/
- for (i = 0; i < nargs + narg64; ) {
+ for (size_t i = 0; i < nargs + narg64; ) {
register_t arg = *args32++;
if (__predict_true((arg64mask & 1) == 0)) {
/*
Index: src/sys/arch/riscv/riscv/trap.c
diff -u src/sys/arch/riscv/riscv/trap.c:1.15 src/sys/arch/riscv/riscv/trap.c:1.16
--- src/sys/arch/riscv/riscv/trap.c:1.15 Sun Dec 20 16:38:26 2020
+++ src/sys/arch/riscv/riscv/trap.c Thu Oct 7 07:13:35 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.15 2020/12/20 16:38:26 skrll Exp $ */
+/* $NetBSD: trap.c,v 1.16 2021/10/07 07:13:35 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.15 2020/12/20 16:38:26 skrll Exp $");
+__RCSID("$NetBSD: trap.c,v 1.16 2021/10/07 07:13:35 skrll Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -379,6 +379,7 @@ cpu_trap(struct trapframe *tf, register_
if (__predict_true(fault_mask & FAULT_TRAP_MASK)) {
#ifndef _LP64
+#if 0
// This fault may be cause the kernel's page table got a new
// page table page and this pmap's page table doesn't know
// about it. See
@@ -389,6 +390,7 @@ cpu_trap(struct trapframe *tf, register_
return;
}
#endif
+#endif
ok = trap_pagefault(tf, epc, status, cause, addr,
usertrap_p, &ksi);
} else if (fault_mask & INSTRUCTION_TRAP_MASK) {