Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm Support directmapped systems with >1GB that sta...
details: https://anonhg.NetBSD.org/src/rev/3c2e76f6d9e0
branches: trunk
changeset: 338589:3c2e76f6d9e0
user: matt <matt%NetBSD.org@localhost>
date: Sat May 30 23:59:33 2015 +0000
description:
Support directmapped systems with >1GB that start memory at 0x80000000.
diffstat:
sys/arch/arm/arm32/arm32_kvminit.c | 21 +++++++++++++++++----
sys/arch/arm/arm32/pmap.c | 7 ++++---
sys/arch/arm/include/arm32/pmap.h | 3 ++-
3 files changed, 23 insertions(+), 8 deletions(-)
diffs (115 lines):
diff -r 22916ce5a91f -r 3c2e76f6d9e0 sys/arch/arm/arm32/arm32_kvminit.c
--- a/sys/arch/arm/arm32/arm32_kvminit.c Sat May 30 23:17:37 2015 +0000
+++ b/sys/arch/arm/arm32/arm32_kvminit.c Sat May 30 23:59:33 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm32_kvminit.c,v 1.33 2015/05/04 00:44:12 matt Exp $ */
+/* $NetBSD: arm32_kvminit.c,v 1.34 2015/05/30 23:59:33 matt Exp $ */
/*
* Copyright (c) 2002, 2003, 2005 Genetec Corporation. All rights reserved.
@@ -124,7 +124,7 @@
#include "opt_multiprocessor.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arm32_kvminit.c,v 1.33 2015/05/04 00:44:12 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_kvminit.c,v 1.34 2015/05/30 23:59:33 matt Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -195,6 +195,7 @@
if (physical_end == 0) {
physical_end = -PAGE_SIZE;
memsize -= PAGE_SIZE;
+ bmi->bmi_end -= PAGE_SIZE;
#ifdef VERBOSE_INIT_ARM
printf("%s: memsize shrunk by a page to avoid ending at 4GB\n",
__func__);
@@ -441,8 +442,10 @@
* from TTBR0 to map some of the physical memory. But try to use as
* much high memory space as possible.
*/
- if (kernel_vm_base - KERNEL_BASE < physical_size) {
- pmap_directbase = kernel_vm_base - physical_size;
+ pmap_directlimit = kernel_vm_base;
+ if (kernel_vm_base - KERNEL_BASE < physical_size
+ && kernel_vm_base - physical_size >= physical_start) {
+ pmap_directbase -= KERNEL_BASE_VOFFSET;
printf("%s: changing pmap_directbase to %#lx\n", __func__,
pmap_directbase);
}
@@ -838,6 +841,9 @@
&& cur_pv.pv_cache == PTE_CACHE) {
cur_pv.pv_size = bmi->bmi_end - cur_pv.pv_pa;
} else {
+ KASSERTMSG(cur_pv.pv_va + cur_pv.pv_size <= kernel_vm_base,
+ "%#lx >= %#lx", cur_pv.pv_va + cur_pv.pv_size,
+ kernel_vm_base);
#ifdef VERBOSE_INIT_ARM
printf("%s: mapping chunk VA %#lx..%#lx "
"(PA %#lx, prot %d, cache %d)\n",
@@ -854,6 +860,13 @@
}
}
+ // The amount we can direct is limited by the start of the
+ // virtual part of the kernel address space. Don't overrun
+ // into it.
+ if (mapallmem_p && cur_pv.pv_va + cur_pv.pv_size > kernel_vm_base) {
+ cur_pv.pv_size = kernel_vm_base - cur_pv.pv_va;
+ }
+
/*
* Now we map the final chunk.
*/
diff -r 22916ce5a91f -r 3c2e76f6d9e0 sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Sat May 30 23:17:37 2015 +0000
+++ b/sys/arch/arm/arm32/pmap.c Sat May 30 23:59:33 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.322 2015/05/13 15:33:47 skrll Exp $ */
+/* $NetBSD: pmap.c,v 1.323 2015/05/30 23:59:33 matt Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
@@ -216,7 +216,7 @@
#include <arm/locore.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.322 2015/05/13 15:33:47 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.323 2015/05/30 23:59:33 matt Exp $");
//#define PMAP_DEBUG
#ifdef PMAP_DEBUG
@@ -517,6 +517,7 @@
* Start of direct-mapped memory
*/
vaddr_t pmap_directbase = KERNEL_BASE;
+vaddr_t pmap_directlimit;
#endif
/*
@@ -7859,7 +7860,7 @@
if (physical_start <= pa && pa < physical_end) {
#ifdef ARM_MMU_EXTENDED
const vaddr_t newva = pmap_directbase + pa - physical_start;
- if (newva >= KERNEL_BASE) {
+ if (newva >= KERNEL_BASE && newva < pmap_directlimit) {
va = newva;
ok = true;
}
diff -r 22916ce5a91f -r 3c2e76f6d9e0 sys/arch/arm/include/arm32/pmap.h
--- a/sys/arch/arm/include/arm32/pmap.h Sat May 30 23:17:37 2015 +0000
+++ b/sys/arch/arm/include/arm32/pmap.h Sat May 30 23:59:33 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.139 2015/05/12 07:07:16 skrll Exp $ */
+/* $NetBSD: pmap.h,v 1.140 2015/05/30 23:59:33 matt Exp $ */
/*
* Copyright (c) 2002, 2003 Wasabi Systems, Inc.
@@ -431,6 +431,7 @@
* Starting VA of direct mapped memory (usually KERNEL_BASE).
*/
extern vaddr_t pmap_directbase;
+extern vaddr_t pmap_directlimit;
#endif
/*
Home |
Main Index |
Thread Index |
Old Index