Module Name: src Committed By: maxv Date: Sat Jun 1 12:42:28 UTC 2019
Modified Files: src/common/lib/libc/arch/riscv/atomic: Makefile.inc src/sys/arch/riscv/conf: GENERIC Makefile.riscv files.riscv src/sys/arch/riscv/include: cpu.h elf_machdep.h mutex.h param.h pmap.h pte.h vmparam.h src/sys/arch/riscv/riscv: core_machdep.c genassym.cf locore.S pmap_machdep.c src/sys/uvm/pmap: pmap.h Added Files: src/sys/arch/riscv/compile: Makefile Log Message: Misc changes in RISC-V. Start changing the memory layout, too. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/arch/riscv/atomic/Makefile.inc cvs rdiff -u -r0 -r1.1 src/sys/arch/riscv/compile/Makefile cvs rdiff -u -r1.9 -r1.10 src/sys/arch/riscv/conf/GENERIC cvs rdiff -u -r1.3 -r1.4 src/sys/arch/riscv/conf/Makefile.riscv cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/conf/files.riscv cvs rdiff -u -r1.4 -r1.5 src/sys/arch/riscv/include/cpu.h \ src/sys/arch/riscv/include/vmparam.h cvs rdiff -u -r1.6 -r1.7 src/sys/arch/riscv/include/elf_machdep.h cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/include/mutex.h \ src/sys/arch/riscv/include/pmap.h src/sys/arch/riscv/include/pte.h cvs rdiff -u -r1.2 -r1.3 src/sys/arch/riscv/include/param.h cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/riscv/core_machdep.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/riscv/riscv/genassym.cf cvs rdiff -u -r1.7 -r1.8 src/sys/arch/riscv/riscv/locore.S cvs rdiff -u -r1.2 -r1.3 src/sys/arch/riscv/riscv/pmap_machdep.c cvs rdiff -u -r1.11 -r1.12 src/sys/uvm/pmap/pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/common/lib/libc/arch/riscv/atomic/Makefile.inc diff -u src/common/lib/libc/arch/riscv/atomic/Makefile.inc:1.3 src/common/lib/libc/arch/riscv/atomic/Makefile.inc:1.4 --- src/common/lib/libc/arch/riscv/atomic/Makefile.inc:1.3 Wed Apr 17 07:40:34 2019 +++ src/common/lib/libc/arch/riscv/atomic/Makefile.inc Sat Jun 1 12:42:27 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.3 2019/04/17 07:40:34 mrg Exp $ +# $NetBSD: Makefile.inc,v 1.4 2019/06/01 12:42:27 maxv Exp $ .for op in add and cas nand or sub swap xor sizes=32 @@ -27,7 +27,7 @@ SRCS.atomic+= atomic_init_cas.c \ .endif #LIB -.if ${LIB} == "c" +.if defined(LIB) && ${LIB} == "c" SRCS.atomic+= atomic_and_16_nv_cas.c atomic_and_8_nv_cas.c .endif Index: src/sys/arch/riscv/conf/GENERIC diff -u src/sys/arch/riscv/conf/GENERIC:1.9 src/sys/arch/riscv/conf/GENERIC:1.10 --- src/sys/arch/riscv/conf/GENERIC:1.9 Wed Aug 1 20:04:13 2018 +++ src/sys/arch/riscv/conf/GENERIC Sat Jun 1 12:42:27 2019 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.9 2018/08/01 20:04:13 maxv Exp $ +# $NetBSD: GENERIC,v 1.10 2019/06/01 12:42:27 maxv Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/riscv/conf/std.riscv64" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.9 $" +#ident "GENERIC-$Revision: 1.10 $" maxusers 64 # estimated number of users @@ -74,9 +74,7 @@ options DDB_HISTORY_SIZE=512 # enable h include "conf/compat_netbsd70.config" options COMPAT_OSSAUDIO -options COMPAT_NETBSD32 -#options COMPAT_LINUX -#options COMPAT_LINUX32 # req. COMPAT_LINUX and COMPAT_NETBSD32 +#options COMPAT_NETBSD32 #options EXEC_ELF32 # Wedge support Index: src/sys/arch/riscv/conf/Makefile.riscv diff -u src/sys/arch/riscv/conf/Makefile.riscv:1.3 src/sys/arch/riscv/conf/Makefile.riscv:1.4 --- src/sys/arch/riscv/conf/Makefile.riscv:1.3 Sat Sep 22 12:24:03 2018 +++ src/sys/arch/riscv/conf/Makefile.riscv Sat Jun 1 12:42:27 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.riscv,v 1.3 2018/09/22 12:24:03 rin Exp $ +# $NetBSD: Makefile.riscv,v 1.4 2019/06/01 12:42:27 maxv Exp $ # Makefile for NetBSD # @@ -39,7 +39,6 @@ GENASSYM_CONF= ${RISCV}/riscv/genassym.c ## CPPFLAGS+= -D${MACHINE} CFLAGS+= -mcmodel=medany -CFLAGS+= -msoft-float .if !defined(LP64) || ${LP64} == "no" CFLAGS+= -m32 AFLAGS+= -m32 @@ -70,7 +69,7 @@ locore.o: ${RISCV}/riscv/locore.S assym. ## (5) link settings ## .if ${MACHINE_ARCH} == "riscv64" && ${LP64:Uyes} == "yes" -TEXTADDR?= 0xFFFFFFFF80002000 +TEXTADDR?= 0xFFFFFFC000000000 .else TEXTADDR?= 0xC0001000 .endif Index: src/sys/arch/riscv/conf/files.riscv diff -u src/sys/arch/riscv/conf/files.riscv:1.1 src/sys/arch/riscv/conf/files.riscv:1.2 --- src/sys/arch/riscv/conf/files.riscv:1.1 Sat Mar 28 16:13:56 2015 +++ src/sys/arch/riscv/conf/files.riscv Sat Jun 1 12:42:27 2019 @@ -1,4 +1,4 @@ -# $NetBSD: files.riscv,v 1.1 2015/03/28 16:13:56 matt Exp $ +# $NetBSD: files.riscv,v 1.2 2019/06/01 12:42:27 maxv Exp $ # maxpartitions 16 @@ -41,7 +41,7 @@ file dev/md_root.c memory_disk_hooks file kern/subr_disk_mbr.c disk file uvm/pmap/pmap.c -file uvm/pmap/pmap_pv.c +file uvm/pmap/pmap_pvt.c file uvm/pmap/pmap_segtab.c file uvm/pmap/pmap_tlb.c @@ -51,13 +51,6 @@ file arch/riscv/riscv/netbsd32_machdep.c file arch/riscv/riscv/sig32_machdep.c compat_netbsd32 include "compat/netbsd32/files.netbsd32" -# Linux compatibility (COMPAT_LINUX) XXX Highly experimental -#include "compat/ossaudio/files.ossaudio" -#include "compat/linux/files.linux" -#include "compat/linux/arch/riscv/files.linux_riscv" -#file arch/riscv/riscv/linux_trap.c compat_linux -#file arch/riscv/riscv/linux_syscall.c compat_linux - device mainbus { [instance=-1] } attach mainbus at root file arch/riscv/riscv/mainbus.c mainbus Index: src/sys/arch/riscv/include/cpu.h diff -u src/sys/arch/riscv/include/cpu.h:1.4 src/sys/arch/riscv/include/cpu.h:1.5 --- src/sys/arch/riscv/include/cpu.h:1.4 Wed Apr 1 21:55:03 2015 +++ src/sys/arch/riscv/include/cpu.h Sat Jun 1 12:42:28 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.4 2015/04/01 21:55:03 matt Exp $ */ +/* $NetBSD: cpu.h,v 1.5 2019/06/01 12:42:28 maxv Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -68,11 +68,10 @@ struct cpu_info { volatile u_int ci_intr_depth; tlb_asid_t ci_pmap_asid_cur; -#if 0 - union pmap_pdetab *ci_pmap_user_pdetab; + + union pmap_segtab *ci_pmap_user_segtab; #ifdef _LP64 - union pmap_pdetab *ci_pmap_user_pde0tab; -#endif + union pmap_segtab *ci_pmap_user_seg0tab; #endif struct evcnt ci_ev_fpu_saves; Index: src/sys/arch/riscv/include/vmparam.h diff -u src/sys/arch/riscv/include/vmparam.h:1.4 src/sys/arch/riscv/include/vmparam.h:1.5 --- src/sys/arch/riscv/include/vmparam.h:1.4 Thu May 31 22:26:36 2018 +++ src/sys/arch/riscv/include/vmparam.h Sat Jun 1 12:42:28 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.4 2018/05/31 22:26:36 mrg Exp $ */ +/* $NetBSD: vmparam.h,v 1.5 2019/06/01 12:42:28 maxv Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -42,10 +42,6 @@ * Machine dependent VM constants for RISCV. */ -/* - * We use a 8K page on RV64 and 4K on RV32 systems. - * Override PAGE_* definitions to compile-time constants. - */ #define PAGE_SHIFT PGSHIFT #define PAGE_SIZE (1 << PAGE_SHIFT) #define PAGE_MASK (PAGE_SIZE - 1) @@ -107,24 +103,16 @@ #define USRIOSIZE (MAXBSIZE/PAGE_SIZE * 8) #endif -// user/kernel map constants -// These use negative addresses since RISCV addresses are signed. +/* + * User/kernel map constants. + */ #define VM_MIN_ADDRESS ((vaddr_t)0x00000000) -#ifdef _LP64 -#define VM_MAXUSER_ADDRESS ((vaddr_t) 1L << 42) /* 0x0000040000000000 */ -// For 64-bit kernels, we could, in theory, have 8TB (42 (13+29) bits worth) -// of KVA space. We need to divide that between KVA for direct-mapped memory, -// space for I/O devices (someday), the kernel's mapped space. For now, we are -// going to restrict ourselves to use highest 8GB of KVA. The highest 2GB of -// that KVA will be used to direct map memory. -#define VM_MAX_KERNEL_ADDRESS ((vaddr_t) -PAGE_SIZE << 18) - /* 0xFFFFFFFF80000000 */ -#define VM_MIN_KERNEL_ADDRESS ((vaddr_t) -PAGE_SIZE << 20) - /* 0xFFFFFFFE00000000 */ -#else +#ifdef _LP64 /* Sv39 */ +#define VM_MAXUSER_ADDRESS ((vaddr_t)0x0000004000000000 - 16 * PAGE_SIZE) +#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)0xFFFFFFC000000000) +#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xFFFFFFD000000000) /* MIN + 64GB */ +#else /* Sv32 */ #define VM_MAXUSER_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xFFFFFFFF80000000 */ -// We reserve the bottom (nonnegative) address for user, then split the upper -// 2GB into two 1GB, the lower for mapped KVA and the upper for direct-mapped. #define VM_MIN_KERNEL_ADDRESS ((vaddr_t)-0x7fffffff-1)/* 0xFFFFFFFF80000000 */ #define VM_MAX_KERNEL_ADDRESS ((vaddr_t)-0x40000000) /* 0xFFFFFFFFC0000000 */ #endif Index: src/sys/arch/riscv/include/elf_machdep.h diff -u src/sys/arch/riscv/include/elf_machdep.h:1.6 src/sys/arch/riscv/include/elf_machdep.h:1.7 --- src/sys/arch/riscv/include/elf_machdep.h:1.6 Mon Nov 6 03:47:48 2017 +++ src/sys/arch/riscv/include/elf_machdep.h Sat Jun 1 12:42:28 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: elf_machdep.h,v 1.6 2017/11/06 03:47:48 christos Exp $ */ +/* $NetBSD: elf_machdep.h,v 1.7 2019/06/01 12:42:28 maxv Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -46,10 +46,11 @@ case EM_RISCV: \ break; -#define KERN_ELFSIZE 32 #ifdef _LP64 +#define KERN_ELFSIZE 64 #define ARCH_ELFSIZE 64 /* MD native binary size */ #else +#define KERN_ELFSIZE 32 #define ARCH_ELFSIZE 32 /* MD native binary size */ #endif Index: src/sys/arch/riscv/include/mutex.h diff -u src/sys/arch/riscv/include/mutex.h:1.1 src/sys/arch/riscv/include/mutex.h:1.2 --- src/sys/arch/riscv/include/mutex.h:1.1 Fri Sep 19 17:36:26 2014 +++ src/sys/arch/riscv/include/mutex.h Sat Jun 1 12:42:28 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: mutex.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ +/* $NetBSD: mutex.h,v 1.2 2019/06/01 12:42:28 maxv Exp $ */ /*- * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc. @@ -83,7 +83,7 @@ riscv_mutex_spinbit_lock_init(kmutex_t * } static inline bool -riscv_mutex_spinbit_locked_p(kmutex_t *__mtx) +riscv_mutex_spinbit_locked_p(const kmutex_t *__mtx) { return (__mtx->mtx_owner & MTX_LOCK) != 0; } Index: src/sys/arch/riscv/include/pmap.h diff -u src/sys/arch/riscv/include/pmap.h:1.1 src/sys/arch/riscv/include/pmap.h:1.2 --- src/sys/arch/riscv/include/pmap.h:1.1 Fri Sep 19 17:36:26 2014 +++ src/sys/arch/riscv/include/pmap.h Sat Jun 1 12:42:28 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ +/* $NetBSD: pmap.h,v 1.2 2019/06/01 12:42:28 maxv Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -42,12 +42,12 @@ #include <sys/pool.h> #include <sys/evcnt.h> +#include <uvm/uvm_physseg.h> #include <uvm/pmap/vmpagemd.h> #include <riscv/pte.h> -#define PMAP_SEGTABSIZE (__SHIFTOUT(PTE_PPN0, PTE_PPN0) + 1) -#define PMAP_PDETABSIZE (__SHIFTOUT(PTE_PPN0, PTE_PPN0) + 1) +#define PMAP_SEGTABSIZE NPTEPG #define NBSEG (NBPG*NPTEPG) #ifdef _LP64 @@ -76,6 +76,15 @@ #define pmap_phys_address(x) (x) +#ifndef __BSD_PTENTRY_T__ +#define __BSD_PTENTRY_T__ +#ifdef _LP64 +#define PRIxPTE PRIx64 +#else +#define PRIxPTE PRIx32 +#endif +#endif /* __BSD_PTENTRY_T__ */ + #define PMAP_NEED_PROCWR static inline void pmap_procwr(struct proc *p, vaddr_t va, vsize_t len) @@ -96,6 +105,7 @@ pmap_procwr(struct proc *p, vaddr_t va, #define __HAVE_PMAP_MD struct pmap_md { paddr_t md_ptbr; + pd_entry_t *md_pdetab; }; struct vm_page * @@ -112,6 +122,7 @@ bool pmap_md_tlb_check_entry(void *, void pmap_md_pdetab_activate(struct pmap *); void pmap_md_pdetab_init(struct pmap *); +bool pmap_md_ok_to_steal_p(const uvm_physseg_t, size_t); #ifdef __PMAP_PRIVATE static inline void @@ -166,10 +177,10 @@ pmap_md_tlb_asid_max(void) struct vm_page_md { uintptr_t mdpg_dummy[3]; }; -#endif /* !__HVE_VM_PAGE_MD */ - __CTASSERT(sizeof(struct vm_page_md) == sizeof(uintptr_t)*3); +#endif /* !__HAVE_VM_PAGE_MD */ + #endif /* MODULAR || _MODULE */ #endif /* !_RISCV_PMAP_H_ */ Index: src/sys/arch/riscv/include/pte.h diff -u src/sys/arch/riscv/include/pte.h:1.1 src/sys/arch/riscv/include/pte.h:1.2 --- src/sys/arch/riscv/include/pte.h:1.1 Fri Sep 19 17:36:26 2014 +++ src/sys/arch/riscv/include/pte.h Sat Jun 1 12:42:28 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: pte.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */ +/* $NetBSD: pte.h,v 1.2 2019/06/01 12:42:28 maxv Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. * All rights reserved. @@ -239,30 +239,6 @@ pte_set(pt_entry_t *ptep, pt_entry_t pte *ptep = pte; } -static inline pd_entry_t -pte_invalid_pde(void) -{ - return 0; -} - -static inline pd_entry_t -pte_pde_pdetab(paddr_t pa) -{ - return PTE_V | PTE_G | PTE_T | pa; -} - -static inline pd_entry_t -pte_pde_ptpage(paddr_t pa) -{ - return PTE_V | PTE_G | PTE_T | pa; -} - -static inline bool -pte_pde_valid_p(pd_entry_t pde) -{ - return (pde & (PTE_V|PTE_T)) == (PTE_V|PTE_T); -} - static inline paddr_t pte_pde_to_paddr(pd_entry_t pde) { @@ -283,4 +259,11 @@ pte_pde_cas(pd_entry_t *pdep, pd_entry_t return 0; #endif } + +static inline pt_entry_t +pte_value(pt_entry_t pte) +{ + return pte; +} + #endif /* _RISCV_PTE_H_ */ Index: src/sys/arch/riscv/include/param.h diff -u src/sys/arch/riscv/include/param.h:1.2 src/sys/arch/riscv/include/param.h:1.3 --- src/sys/arch/riscv/include/param.h:1.2 Mon Jan 7 22:00:32 2019 +++ src/sys/arch/riscv/include/param.h Sat Jun 1 12:42:28 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.2 2019/01/07 22:00:32 jdolecek Exp $ */ +/* $NetBSD: param.h,v 1.3 2019/06/01 12:42:28 maxv Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -66,11 +66,7 @@ #define NKMEMPAGES_MAX_DEFAULT (2048UL * 1024 * 1024) #define NKMEMPAGES_MIN_DEFAULT (128UL * 1024 * 1024) -#ifdef _LP64 -#define PGSHIFT 13 -#else #define PGSHIFT 12 -#endif #define NBPG (1 << PGSHIFT) #define PGOFSET (NBPG - 1) Index: src/sys/arch/riscv/riscv/core_machdep.c diff -u src/sys/arch/riscv/riscv/core_machdep.c:1.1 src/sys/arch/riscv/riscv/core_machdep.c:1.2 --- src/sys/arch/riscv/riscv/core_machdep.c:1.1 Sat Mar 28 16:13:56 2015 +++ src/sys/arch/riscv/riscv/core_machdep.c Sat Jun 1 12:42:28 2019 @@ -30,7 +30,7 @@ #include <sys/cdefs.h> #ifndef CORENAME -__RCSID("$NetBSD: core_machdep.c,v 1.1 2015/03/28 16:13:56 matt Exp $"); +__RCSID("$NetBSD: core_machdep.c,v 1.2 2019/06/01 12:42:28 maxv Exp $"); #endif #include <sys/param.h> @@ -83,7 +83,7 @@ CORENAME(cpu_coredump)(struct lwp *l, st cpustate.tf.tf_badaddr = tf->tf_badaddr; cpustate.tf.tf_cause = tf->tf_cause; cpustate.tf.tf_sr = tf->tf_sr; - if (fpu_valid_p()) { + if (fpu_valid_p(l)) { cpustate.fpregs = ((struct pcb *)lwp_getpcb(l))->pcb_fpregs; } else { memset(&cpustate.fpregs, 0, sizeof(cpustate.fpregs)); Index: src/sys/arch/riscv/riscv/genassym.cf diff -u src/sys/arch/riscv/riscv/genassym.cf:1.3 src/sys/arch/riscv/riscv/genassym.cf:1.4 --- src/sys/arch/riscv/riscv/genassym.cf:1.3 Tue Mar 31 06:47:47 2015 +++ src/sys/arch/riscv/riscv/genassym.cf Sat Jun 1 12:42:28 2019 @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.3 2015/03/31 06:47:47 matt Exp $ +# $NetBSD: genassym.cf,v 1.4 2019/06/01 12:42:28 maxv Exp $ #- # Copyright (c) 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -194,5 +194,5 @@ define PTE_SX PTE_SX define PTE_SW PTE_SW define PTE_SR PTE_SR -define PM_PDETAB offsetof(struct pmap, pm_pdetab) +define PM_MD_PDETAB offsetof(struct pmap, pm_md.md_pdetab) define PM_MD_PTBR offsetof(struct pmap, pm_md.md_ptbr) Index: src/sys/arch/riscv/riscv/locore.S diff -u src/sys/arch/riscv/riscv/locore.S:1.7 src/sys/arch/riscv/riscv/locore.S:1.8 --- src/sys/arch/riscv/riscv/locore.S:1.7 Mon Feb 5 10:41:12 2018 +++ src/sys/arch/riscv/riscv/locore.S Sat Jun 1 12:42:28 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.7 2018/02/05 10:41:12 maya Exp $ */ +/* $NetBSD: locore.S,v 1.8 2019/06/01 12:42:28 maxv Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. * All rights reserved. @@ -91,7 +91,11 @@ ENTRY_NP(start) REG_S t0, -SZREG(s3) // store in highest first level PDE #endif -#if (VM_MIN_KERNEL_ADDRESS >> XSEGSHIFT) != (VM_MAX_KERNEL_ADDRESS >> XSEGSHIFT) + /* + * XXX XXX XXX: This is completely broken and wrong, we should map only + * the kernel sections, and the direct map should be mapped later in C. + */ +#if 0 && (VM_MIN_KERNEL_ADDRESS >> XSEGSHIFT) != (VM_MAX_KERNEL_ADDRESS >> XSEGSHIFT) #error VM_MIN_KERNEL_ADDRESS not in same first level PDE as VM_MAX_KERNEL_ADDRESS #endif // We allocated the kernel first PTE page so let's insert in the @@ -144,7 +148,7 @@ ENTRY_NP(start) PTR_LA t1, _C_LABEL(kernel_pmap_store) add t2, s2, s11 // PA -> VA - PTR_S t2, PM_PDETAB(t1) // VA of kernel PDETAB + PTR_S t2, PM_MD_PDETAB(t1) // VA of kernel PDETAB PTR_S s2, PM_MD_PTBR(t1) // PA of kernel PDETAB // Now we should ready to start initializing the kernel. Index: src/sys/arch/riscv/riscv/pmap_machdep.c diff -u src/sys/arch/riscv/riscv/pmap_machdep.c:1.2 src/sys/arch/riscv/riscv/pmap_machdep.c:1.3 --- src/sys/arch/riscv/riscv/pmap_machdep.c:1.2 Tue Mar 31 01:14:57 2015 +++ src/sys/arch/riscv/riscv/pmap_machdep.c Sat Jun 1 12:42:28 2019 @@ -31,7 +31,7 @@ #include <sys/cdefs.h> -__RCSID("$NetBSD: pmap_machdep.c,v 1.2 2015/03/31 01:14:57 matt Exp $"); +__RCSID("$NetBSD: pmap_machdep.c,v 1.3 2019/06/01 12:42:28 maxv Exp $"); #include <sys/param.h> @@ -100,7 +100,7 @@ paddr_t pmap_md_direct_mapped_vaddr_to_paddr(vaddr_t va) { KASSERT(VM_MAX_KERNEL_ADDRESS <= va && (intptr_t) va < 0); - const pmap_pdetab_t *ptb = pmap_kernel()->pm_pdetab; + const pmap_pdetab_t *ptb = pmap_kernel()->pm_md.md_pdetab; pd_entry_t pde; #ifdef _LP64 @@ -136,6 +136,12 @@ pmap_md_init(void) } bool +pmap_md_ok_to_steal_p(const uvm_physseg_t bank, size_t npgs) +{ + return true; +} + +bool pmap_md_tlb_check_entry(void *ctx, vaddr_t va, tlb_asid_t asid, pt_entry_t pte) { return false; @@ -150,9 +156,9 @@ pmap_md_pdetab_activate(struct pmap *pma void pmap_md_pdetab_init(struct pmap *pmap) { - pmap->pm_pdetab[NPDEPG-1] = pmap_kernel()->pm_pdetab[NPDEPG-1]; + pmap->pm_md.md_pdetab[NPDEPG-1] = pmap_kernel()->pm_md.md_pdetab[NPDEPG-1]; pmap->pm_md.md_ptbr = - pmap_md_direct_mapped_vaddr_to_paddr((vaddr_t)pmap->pm_pdetab); + pmap_md_direct_mapped_vaddr_to_paddr((vaddr_t)pmap->pm_md.md_pdetab); } // TLB mainenance routines Index: src/sys/uvm/pmap/pmap.h diff -u src/sys/uvm/pmap/pmap.h:1.11 src/sys/uvm/pmap/pmap.h:1.12 --- src/sys/uvm/pmap/pmap.h:1.11 Mon May 20 17:00:57 2019 +++ src/sys/uvm/pmap/pmap.h Sat Jun 1 12:42:28 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.11 2019/05/20 17:00:57 skrll Exp $ */ +/* $NetBSD: pmap.h,v 1.12 2019/06/01 12:42:28 maxv Exp $ */ /* * Copyright (c) 1992, 1993 @@ -134,6 +134,9 @@ struct pmap { struct pmap_statistics pm_stats; /* pmap statistics */ vaddr_t pm_minaddr; vaddr_t pm_maxaddr; +#ifdef __HAVE_PMAP_MD + struct pmap_md pm_md; +#endif struct pmap_asid_info pm_pai[1]; }; Added files: Index: src/sys/arch/riscv/compile/Makefile diff -u /dev/null src/sys/arch/riscv/compile/Makefile:1.1 --- /dev/null Sat Jun 1 12:42:28 2019 +++ src/sys/arch/riscv/compile/Makefile Sat Jun 1 12:42:27 2019 @@ -0,0 +1,3 @@ +# $NetBSD: Makefile,v 1.1 2019/06/01 12:42:27 maxv Exp $ + +.include <bsd.prog.mk>