From e23bb0cb510e648bfc2f80d056f8d426c0a546f9 Mon Sep 17 00:00:00 2001 From: nsmrtks Date: Mon, 21 Jan 2002 17:21:52 +0000 Subject: [PATCH] Fix uvm fault at startup on 040/060. (patch by minoura) --- sys/arch/x68k/x68k/pmap_bootstrap.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/sys/arch/x68k/x68k/pmap_bootstrap.c b/sys/arch/x68k/x68k/pmap_bootstrap.c index c7ff878de3ef..3a211d55e6d5 100644 --- a/sys/arch/x68k/x68k/pmap_bootstrap.c +++ b/sys/arch/x68k/x68k/pmap_bootstrap.c @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.21 2001/01/11 13:18:37 minoura Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.22 2002/01/21 17:21:52 nsmrtks Exp $ */ /* * Copyright (c) 1991, 1993 @@ -42,7 +42,7 @@ #include "opt_m680x0.h" #include -#include /* XXX needed? */ +#include #include #include #include @@ -111,9 +111,6 @@ pmap_bootstrap(nextpa, firstpa) * iiopa internal IO space * PT pages IIOMAPSIZE pages * - * eiiopa page following - * internal IO space - * * [ Sysptsize is the number of pages of PT, and IIOMAPSIZE * is the number of PTEs, hence we need to round * the total to a page boundary with IO maps at the end. ] @@ -142,6 +139,12 @@ pmap_bootstrap(nextpa, firstpa) p0upa = nextpa; nextpa += USPACE; + /* + * Clear all PTEs to zero + */ + for (pte = (pt_entry_t *)kstpa; pte < (pt_entry_t *)p0upa; pte++) + *pte = 0; + /* * Initialize segment table and kernel page table map. * @@ -201,13 +204,6 @@ pmap_bootstrap(nextpa, firstpa) *pte++ = protoste; protoste += (SG4_LEV2SIZE * sizeof(st_entry_t)); } - /* - * Initialize the final level 1 descriptor to map the last - * block of level 2 descriptors. - */ - ste = &((u_int *)kstpa)[SG4_LEV1SIZE-1]; - pte = &((u_int *)kstpa)[kstsize*NPTEPG - SG4_LEV2SIZE]; - *ste = (u_int)pte | SG_U | SG_RW | SG_V; /* * Initialize Sysptmap */ @@ -274,10 +270,10 @@ pmap_bootstrap(nextpa, firstpa) } /* * Validate PTEs for kernel data/bss, dynamic data allocated - * by us so far (nextpa - firstpa bytes), and pages for proc0 + * by us so far (kstpa - firstpa bytes), and pages for proc0 * u-area and page table allocated below (RW). */ - epte = &((u_int *)kptpa)[m68k_btop(nextpa - firstpa)]; + epte = &((u_int *)kptpa)[m68k_btop(kstpa - firstpa)]; protopte = (protopte & ~PG_PROT) | PG_RW; /* * Enable copy-back caching of data pages @@ -422,7 +418,6 @@ pmap_bootstrap(nextpa, firstpa) SG4_LEV2SIZE) / SG4_LEV2SIZE; while (num) kpm->pm_stfree &= ~l2tobm(num--); - kpm->pm_stfree &= ~l2tobm(MAXKL2SIZE-1); for (num = MAXKL2SIZE; num < sizeof(kpm->pm_stfree)*NBBY; num++)