Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/riscv/riscv Hacky build fixes



details:   https://anonhg.NetBSD.org/src/rev/9150f20b1410
branches:  trunk
changeset: 1024002:9150f20b1410
user:      skrll <skrll%NetBSD.org@localhost>
date:      Thu Oct 07 07:13:35 2021 +0000

description:
Hacky build fixes

diffstat:

 sys/arch/riscv/riscv/pmap_machdep.c  |  17 +++++++++++++++--
 sys/arch/riscv/riscv/riscv_machdep.c |   6 ++++--
 sys/arch/riscv/riscv/syscall.c       |   9 ++++-----
 sys/arch/riscv/riscv/trap.c          |   6 ++++--
 4 files changed, 27 insertions(+), 11 deletions(-)

diffs (172 lines):

diff -r 96d0233153b6 -r 9150f20b1410 sys/arch/riscv/riscv/pmap_machdep.c
--- a/sys/arch/riscv/riscv/pmap_machdep.c       Thu Oct 07 06:44:18 2021 +0000
+++ b/sys/arch/riscv/riscv/pmap_machdep.c       Thu Oct 07 07:13:35 2021 +0000
@@ -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 @@
 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 @@
 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
diff -r 96d0233153b6 -r 9150f20b1410 sys/arch/riscv/riscv/riscv_machdep.c
--- a/sys/arch/riscv/riscv/riscv_machdep.c      Thu Oct 07 06:44:18 2021 +0000
+++ b/sys/arch/riscv/riscv/riscv_machdep.c      Thu Oct 07 07:13:35 2021 +0000
@@ -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 @@
 // 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
diff -r 96d0233153b6 -r 9150f20b1410 sys/arch/riscv/riscv/syscall.c
--- a/sys/arch/riscv/riscv/syscall.c    Thu Oct 07 06:44:18 2021 +0000
+++ b/sys/arch/riscv/riscv/syscall.c    Thu Oct 07 07:13:35 2021 +0000
@@ -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 @@
        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 @@
        else
                callp += code;
 
+#ifdef _LP64
        const size_t nargs = callp->sy_narg;
-#ifdef _LP64
        /*
         * 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 @@
                 * 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)) {
                                /*
diff -r 96d0233153b6 -r 9150f20b1410 sys/arch/riscv/riscv/trap.c
--- a/sys/arch/riscv/riscv/trap.c       Thu Oct 07 06:44:18 2021 +0000
+++ b/sys/arch/riscv/riscv/trap.c       Thu Oct 07 07:13:35 2021 +0000
@@ -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 @@
 
        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 @@
                        return;
                }
 #endif
+#endif
                ok = trap_pagefault(tf, epc, status, cause, addr,
                    usertrap_p, &ksi);
        } else if (fault_mask & INSTRUCTION_TRAP_MASK) {



Home | Main Index | Thread Index | Old Index