From f97e917c0e540211f254bf36dcb9e74821e5cb3b Mon Sep 17 00:00:00 2001 From: Artur Grabowski Date: Thu, 27 Jan 2000 17:37:16 +0000 Subject: use {round,trunc}_page instead of manually doing the same thing --- sys/arch/sparc/sparc/pmap.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/sys/arch/sparc/sparc/pmap.c b/sys/arch/sparc/sparc/pmap.c index 47cdde1d2b7..ad0b690889e 100644 --- a/sys/arch/sparc/sparc/pmap.c +++ b/sys/arch/sparc/sparc/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.68 2000/01/27 17:00:02 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.69 2000/01/27 17:37:15 art Exp $ */ /* $NetBSD: pmap.c,v 1.118 1998/05/19 19:00:18 thorpej Exp $ */ /* @@ -254,7 +254,7 @@ pgt_page_alloc(sz, flags, mtype) if ((cpuinfo.flags & CPUFLG_CACHEPAGETABLES) == 0) { pcache_flush(p, (caddr_t)VA2PA(p), sz); - kvm_uncache(p, sz/NBPG); + kvm_uncache(p, atop(sz)); } return (p); } @@ -2822,7 +2822,7 @@ pmap_bootstrap4_4c(nctx, nregion, nsegment) * for pmap_zero_page and pmap_copy_page, and some pages * for dumpsys(), all with no associated physical memory. */ - p = (caddr_t)(((u_int)p + NBPG - 1) & ~PGOFSET); + p = (caddr_t)round_page((vaddr_t)p); avail_start = (paddr_t)p - KERNBASE; i = (int)p; @@ -3101,7 +3101,7 @@ pmap_bootstrap4m(void) * the next whole page) and continuing through the number * of available pages are free. */ - p = (caddr_t)(((u_int)p + NBPG - 1) & ~PGOFSET); + p = (caddr_t)round_page((vaddr_t)p); /* * Reserve memory for MMU pagetables. Some of these have severe @@ -3147,7 +3147,7 @@ pmap_bootstrap4m(void) p - (caddr_t) kernel_pagtable_store); /* Round to next page and mark end of stolen pages */ - p = (caddr_t)(((u_int)p + NBPG - 1) & ~PGOFSET); + p = (caddr_t)round_page((vaddr_t)p); pagetables_end = (vaddr_t)p; avail_start = (paddr_t)p - KERNBASE; @@ -3398,11 +3398,6 @@ pmap_init() vsize_t size; vaddr_t addr; -#ifdef DEBUG - if (PAGE_SIZE != NBPG) - panic("pmap_init: CLSIZE!=1"); -#endif - npages = 0; for (n = 0; n < vm_nphysseg; n++) npages += vm_physmem[n].end - vm_physmem[n].start; @@ -4571,7 +4566,7 @@ pmap_changeprot4_4c(pm, va, prot, wired) write_user_windows(); /* paranoia */ - va &= ~(NBPG-1); + va = trunc_page(va); if (pm == pmap_kernel()) newprot = prot & VM_PROT_WRITE ? PG_S|PG_W : PG_S; else @@ -4890,7 +4885,7 @@ pmap_changeprot4m(pm, va, prot, wired) write_user_windows(); /* paranoia */ - va &= ~(NBPG-1); + va = trunc_page(va); if (pm == pmap_kernel()) newprot = prot & VM_PROT_WRITE ? PPROT_N_RWX : PPROT_N_RX; else -- cgit v1.2.3