diff options
author | 2002-09-11 22:39:00 +0000 | |
---|---|---|
committer | 2002-09-11 22:39:00 +0000 | |
commit | 74c3031811e2a07ddc17709b42d25c2f5aafacf5 (patch) | |
tree | 1f80e72b91ec4e918b6e8a6a825fb9c48c97cac3 | |
parent | Include zstty.h, so that the NZSTTY check will be correct. (diff) | |
download | wireguard-openbsd-74c3031811e2a07ddc17709b42d25c2f5aafacf5.tar.xz wireguard-openbsd-74c3031811e2a07ddc17709b42d25c2f5aafacf5.zip |
Some early callers of pmap_growkernel call it before vm_page structures
are initialized. So we can't to PHYS_TO_VM_PAGE becuase there are no
vm_pages. Reintroduce the old pmap_zero_page renamed to pmap_zero_phys
that can zero pages without struct vm_page.
-rw-r--r-- | sys/arch/i386/i386/pmap.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c index 357803d93fe..84e751fc2a7 100644 --- a/sys/arch/i386/i386/pmap.c +++ b/sys/arch/i386/i386/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.62 2002/09/10 18:29:43 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.63 2002/09/11 22:39:00 art Exp $ */ /* $NetBSD: pmap.c,v 1.91 2000/06/02 17:46:37 thorpej Exp $ */ /* @@ -417,6 +417,8 @@ static void pmap_unmap_ptes(struct pmap *); void pmap_pinit(pmap_t); void pmap_release(pmap_t); +void pmap_zero_phys(paddr_t); + /* * p m a p i n l i n e h e l p e r f u n c t i o n s */ @@ -2040,6 +2042,26 @@ pmap_zero_page(struct vm_page *pg) } /* + * pmap_zero_phys: same as pmap_zero_page, but for use before vm_pages are + * initialized. + */ +void +pmap_zero_phys(paddr_t pa) +{ + simple_lock(&pmap_zero_page_lock); +#ifdef DIAGNOSTIC + if (*zero_pte) + panic("pmap_zero_page: lock botch"); +#endif + + *zero_pte = (pa & PG_FRAME) | PG_V | PG_RW; /* map in */ + bzero(zerop, NBPG); /* zero */ + *zero_pte = 0; /* zap! */ + pmap_update_pg((vaddr_t)zerop); /* flush TLB */ + simple_unlock(&pmap_zero_page_lock); +} + +/* * pmap_zero_page_uncached: the same, except uncached. */ @@ -3613,7 +3635,7 @@ pmap_growkernel(maxkvaddr) if (uvm_page_physget(&ptaddr) == FALSE) panic("pmap_growkernel: out of memory"); - pmap_zero_page(PHYS_TO_VM_PAGE(ptaddr)); + pmap_zero_phys(ptaddr); kpm->pm_pdir[PDSLOT_KERN + nkpde] = ptaddr | PG_RW | PG_V; |