Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/aarch64 Make __md_palloc pmap agnostic (think sys/u...
details: https://anonhg.NetBSD.org/src/rev/6cd815c7b845
branches: trunk
changeset: 938909:6cd815c7b845
user: skrll <skrll%NetBSD.org@localhost>
date: Sat Sep 19 13:33:08 2020 +0000
description:
Make __md_palloc pmap agnostic (think sys/uvm/pmap)
diffstat:
sys/arch/aarch64/aarch64/pmap.c | 6 +++---
sys/arch/aarch64/include/asan.h | 27 ++++++++++++++++++++++-----
sys/arch/aarch64/include/pmap.h | 4 +---
3 files changed, 26 insertions(+), 11 deletions(-)
diffs (88 lines):
diff -r 971e720fea85 -r 6cd815c7b845 sys/arch/aarch64/aarch64/pmap.c
--- a/sys/arch/aarch64/aarch64/pmap.c Sat Sep 19 07:30:32 2020 +0000
+++ b/sys/arch/aarch64/aarch64/pmap.c Sat Sep 19 13:33:08 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.89 2020/09/14 10:06:35 ryo Exp $ */
+/* $NetBSD: pmap.c,v 1.90 2020/09/19 13:33:08 skrll Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.89 2020/09/14 10:06:35 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.90 2020/09/19 13:33:08 skrll Exp $");
#include "opt_arm_debug.h"
#include "opt_ddb.h"
@@ -598,7 +598,7 @@
atomic_inc_uint(&pm->pm_refcnt);
}
-paddr_t
+static paddr_t
pmap_alloc_pdp(struct pmap *pm, struct vm_page **pgp, int flags, bool waitok)
{
paddr_t pa;
diff -r 971e720fea85 -r 6cd815c7b845 sys/arch/aarch64/include/asan.h
--- a/sys/arch/aarch64/include/asan.h Sat Sep 19 07:30:32 2020 +0000
+++ b/sys/arch/aarch64/include/asan.h Sat Sep 19 13:33:08 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: asan.h,v 1.11 2020/09/10 14:10:46 maxv Exp $ */
+/* $NetBSD: asan.h,v 1.12 2020/09/19 13:33:08 skrll Exp $ */
/*
* Copyright (c) 2018-2020 Maxime Villard, m00nbsd.net
@@ -68,12 +68,29 @@
{
paddr_t pa;
- if (__predict_false(__md_early))
+ if (__predict_false(__md_early)) {
pa = (paddr_t)pmapboot_pagealloc();
- else
- pa = pmap_alloc_pdp(pmap_kernel(), NULL, 0, false);
+ return pa;
+ }
- /* The page is zeroed. */
+ vaddr_t va;
+ if (!uvm.page_init_done) {
+ va = uvm_pageboot_alloc(PAGE_SIZE);
+ pa = AARCH64_KVA_TO_PA(va);
+ } else {
+ struct vm_page *pg;
+retry:
+ pg = uvm_pagealloc(NULL, 0, NULL, 0);
+ if (pg == NULL) {
+ uvm_wait(__func__);
+ goto retry;
+ }
+
+ pa = VM_PAGE_TO_PHYS(pg);
+ va = AARCH64_PA_TO_KVA(pa);
+ }
+
+ __builtin_memset((void *)va, 0, PAGE_SIZE);
return pa;
}
diff -r 971e720fea85 -r 6cd815c7b845 sys/arch/aarch64/include/pmap.h
--- a/sys/arch/aarch64/include/pmap.h Sat Sep 19 07:30:32 2020 +0000
+++ b/sys/arch/aarch64/include/pmap.h Sat Sep 19 13:33:08 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.42 2020/08/12 13:36:36 skrll Exp $ */
+/* $NetBSD: pmap.h,v 1.43 2020/09/19 13:33:08 skrll Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -205,8 +205,6 @@
vaddr_t pmap_devmap_phystov(paddr_t);
paddr_t pmap_devmap_vtophys(paddr_t);
-paddr_t pmap_alloc_pdp(struct pmap *, struct vm_page **, int, bool);
-
#define L1_TRUNC_BLOCK(x) ((x) & L1_FRAME)
#define L1_ROUND_BLOCK(x) L1_TRUNC_BLOCK((x) + L1_SIZE - 1)
#define L2_TRUNC_BLOCK(x) ((x) & L2_FRAME)
Home |
Main Index |
Thread Index |
Old Index