diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-05-05 21:26:48 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-05-05 21:26:48 +0000 |
commit | ca8a4ccfe938b07fa473a582784074e5f93813cd (patch) | |
tree | e9075d1e6c63ae7e0fd9c950fcdebcfb637b3405 | |
parent | 368552036fe6029364e1abc2351955db681286fc (diff) |
Remove the (vaddr_t) casts inside the round_page and trunc_page macros.
We might want to use them on types that are bigger than vaddr_t.
Fix all callers that pass pointers without casts.
33 files changed, 130 insertions, 124 deletions
diff --git a/sys/arch/amiga/amiga/pmap.c b/sys/arch/amiga/amiga/pmap.c index 831ce5e1ea7..afb0675235b 100644 --- a/sys/arch/amiga/amiga/pmap.c +++ b/sys/arch/amiga/amiga/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.27 2001/04/20 11:01:55 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.28 2001/05/05 21:26:34 art Exp $ */ /* $NetBSD: pmap.c,v 1.68 1999/06/19 19:44:09 is Exp $ */ /*- @@ -814,7 +814,7 @@ pmap_free_pv(pv) { struct pv_page *pvp; - pvp = (struct pv_page *)trunc_page(pv); + pvp = (struct pv_page *)trunc_page((vaddr_t)pv); switch (++pvp->pvp_pgi.pgi_nfree) { case 1: TAILQ_INSERT_TAIL(&pv_page_freelist, pvp, pvp_pgi.pgi_list); @@ -1326,7 +1326,7 @@ pmap_enter(pmap, va, pa, prot, wired, access_type) * is a valid mapping in the page. */ if (pmap != pmap_kernel()) - pmap_ptpage_addref(trunc_page(pte)); + pmap_ptpage_addref(trunc_page((vaddr_t)pte)); /* * Enter on the PV list if part of our managed memory @@ -1486,7 +1486,7 @@ validate: #ifdef DEBUG if ((pmapdebug & PDB_WIRING) && pmap != pmap_kernel()) { va -= PAGE_SIZE; - pmap_check_wiring("enter", trunc_page(pmap_pte(pmap, va))); + pmap_check_wiring("enter", trunc_page((vaddr_t)pmap_pte(pmap, va))); } #endif } @@ -2025,7 +2025,7 @@ pmap_remove_mapping(pmap, va, pte, flags) * the PT page. */ if (pmap != pmap_kernel()) { - vaddr_t ptpva = trunc_page(pte); + vaddr_t ptpva = trunc_page((vaddr_t)pte); int refs = pmap_ptpage_delref(ptpva); #ifdef DEBUG if (pmapdebug & PDB_WIRING) @@ -2165,7 +2165,7 @@ pmap_remove_mapping(pmap, va, pte, flags) ptpmap->pm_stab, ptpmap->pm_sref - 1); if ((pmapdebug & PDB_PARANOIA) && - ptpmap->pm_stab != (st_entry_t *)trunc_page(ste)) + ptpmap->pm_stab != (st_entry_t *)trunc_page((vaddr_t)ste)) panic("remove: bogus ste"); #endif if (--(ptpmap->pm_sref) == 0) { diff --git a/sys/arch/amiga/dev/sfas.c b/sys/arch/amiga/dev/sfas.c index 29dbf130231..425fd06e570 100644 --- a/sys/arch/amiga/dev/sfas.c +++ b/sys/arch/amiga/dev/sfas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sfas.c,v 1.8 2001/01/25 03:50:46 todd Exp $ */ +/* $OpenBSD: sfas.c,v 1.9 2001/05/05 21:26:35 art Exp $ */ /* $NetBSD: sfas.c,v 1.12 1996/10/13 03:07:33 christos Exp $ */ /* @@ -388,7 +388,7 @@ sfas_scsicmd(struct scsi_xfer *xs) sva = (vm_offset_t)xs->data & PG_FRAME; pendp->vm_link_data.offset = (vm_offset_t)xs->data & PGOFSET; - pendp->vm_link_data.pages = round_page(xs->data+xs->datalen- + pendp->vm_link_data.pages = round_page((vaddr_t)xs->data+xs->datalen- sva)/NBPG; for(n=0; n<pendp->vm_link_data.pages; n++) diff --git a/sys/arch/hp300/hp300/pmap.c b/sys/arch/hp300/hp300/pmap.c index 2d2ad43cfff..a3cea120a46 100644 --- a/sys/arch/hp300/hp300/pmap.c +++ b/sys/arch/hp300/hp300/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.17 2001/05/05 02:41:24 millert Exp $ */ +/* $OpenBSD: pmap.c,v 1.18 2001/05/05 21:26:35 art Exp $ */ /* $NetBSD: pmap.c,v 1.75 1999/06/15 22:18:07 thorpej Exp $ */ /*- @@ -675,7 +675,7 @@ pmap_free_pv(pv) { struct pv_page *pvp; - pvp = (struct pv_page *) trunc_page(pv); + pvp = (struct pv_page *) trunc_page((vaddr_t)pv); switch (++pvp->pvp_pgi.pgi_nfree) { case 1: TAILQ_INSERT_TAIL(&pv_page_freelist, pvp, pvp_pgi.pgi_list); @@ -732,7 +732,7 @@ pmap_collect_pv() continue; s = splimp(); for (ppv = ph; (pv = ppv->pv_next) != 0; ) { - pvp = (struct pv_page *) trunc_page(pv); + pvp = (struct pv_page *) trunc_page((vaddr_t)pv); if (pvp->pvp_pgi.pgi_nfree == -1) { pvp = pv_page_freelist.tqh_first; if (--pvp->pvp_pgi.pgi_nfree == 0) { @@ -1338,13 +1338,14 @@ pmap_enter(pmap, va, pa, prot, wired, access_type) * on this PT page. PT pages are wired down as long as there * is a valid mapping in the page. */ - if (pmap != pmap_kernel()) + if (pmap != pmap_kernel()) { #ifdef UVM pmap_ptpage_addref(trunc_page(pte)); #else (void) vm_map_pageable(pt_map, trunc_page(pte), - round_page(pte+1), FALSE); + round_page(pte+1), FALSE); #endif + } /* * Enter on the PV list if part of our managed memory @@ -1534,7 +1535,7 @@ validate: #endif #ifdef DEBUG if ((pmapdebug & PDB_WIRING) && pmap != pmap_kernel()) - pmap_check_wiring("enter", trunc_page(pte)); + pmap_check_wiring("enter", trunc_page((vaddr_t)pte)); #endif } @@ -2199,7 +2200,7 @@ pmap_remove_mapping(pmap, va, pte, flags) */ #ifdef UVM if (pmap != pmap_kernel()) { - vaddr_t ptpva = trunc_page(pte); + vaddr_t ptpva = trunc_page((vaddr_t)pte); int refs = pmap_ptpage_delref(ptpva); #ifdef DEBUG if (pmapdebug & PDB_WIRING) @@ -2345,7 +2346,7 @@ pmap_remove_mapping(pmap, va, pte, flags) ptpmap->pm_stab, ptpmap->pm_sref - 1)); #ifdef DEBUG if ((pmapdebug & PDB_PARANOIA) && - ptpmap->pm_stab != (st_entry_t *)trunc_page(ste)) + ptpmap->pm_stab != (st_entry_t *)trunc_page((vaddr_t)ste)) panic("remove: bogus ste"); #endif if (--(ptpmap->pm_sref) == 0) { diff --git a/sys/arch/hp300/hp300/trap.c b/sys/arch/hp300/hp300/trap.c index 0f27f56d589..f7f5a9254dd 100644 --- a/sys/arch/hp300/hp300/trap.c +++ b/sys/arch/hp300/hp300/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.19 2001/05/05 20:56:34 art Exp $ */ +/* $OpenBSD: trap.c,v 1.20 2001/05/05 21:26:35 art Exp $ */ /* $NetBSD: trap.c,v 1.57 1998/02/16 20:58:31 thorpej Exp $ */ /* @@ -829,7 +829,7 @@ writeback(fp, docachepush) */ if (docachepush) { pmap_enter(pmap_kernel(), (vm_offset_t)vmmap, - trunc_page(f->f_fa), VM_PROT_WRITE, TRUE, + trunc_page((vaddr_t)f->f_fa), VM_PROT_WRITE, TRUE, VM_PROT_WRITE); fa = (u_int)&vmmap[(f->f_fa & PGOFSET) & ~0xF]; bcopy((caddr_t)&f->f_pd0, (caddr_t)fa, 16); diff --git a/sys/arch/hppa/hppa/pmap.c b/sys/arch/hppa/hppa/pmap.c index 43eb0797175..110489e8fdb 100644 --- a/sys/arch/hppa/hppa/pmap.c +++ b/sys/arch/hppa/hppa/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.42 2001/04/29 20:58:55 mickey Exp $ */ +/* $OpenBSD: pmap.c,v 1.43 2001/05/05 21:26:36 art Exp $ */ /* * Copyright (c) 1998-2001 Michael Shalayeff @@ -409,7 +409,7 @@ pmap_free_pv(struct pv_entry *pv) printf("pmap_free_pv(%p)\n", pv); #endif - pvp = (struct pv_page *) trunc_page(pv); + pvp = (struct pv_page *) trunc_page((vaddr_t)pv); switch (++pvp->pvp_nfree) { case 1: TAILQ_INSERT_TAIL(&pv_page_freelist, pvp, pvp_list); diff --git a/sys/arch/hppa/hppa/vm_machdep.c b/sys/arch/hppa/hppa/vm_machdep.c index 2868d70b005..88af2a7e48a 100644 --- a/sys/arch/hppa/hppa/vm_machdep.c +++ b/sys/arch/hppa/hppa/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.19 2001/03/29 00:17:00 mickey Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.20 2001/05/05 21:26:36 art Exp $ */ /* * Copyright (c) 1999-2000 Michael Shalayeff @@ -373,7 +373,7 @@ vunmapbuf(bp, len) if ((bp->b_flags & B_PHYS) == 0) panic("vunmapbuf"); #endif - addr = trunc_page(bp->b_data); + addr = trunc_page((vaddr_t)bp->b_data); off = (vaddr_t)bp->b_data - addr; len = round_page(off + len); uvm_km_free_wakeup(phys_map, addr, len); diff --git a/sys/arch/i386/i386/pmap.old.c b/sys/arch/i386/i386/pmap.old.c index c3fb2af5575..48ce1fc730b 100644 --- a/sys/arch/i386/i386/pmap.old.c +++ b/sys/arch/i386/i386/pmap.old.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.old.c,v 1.37 2001/03/22 20:44:59 niklas Exp $ */ +/* $OpenBSD: pmap.old.c,v 1.38 2001/05/05 21:26:36 art Exp $ */ /* $NetBSD: pmap.c,v 1.36 1996/05/03 19:42:22 christos Exp $ */ /* @@ -413,7 +413,7 @@ pmap_free_pv(pv) { register struct pv_page *pvp; - pvp = (struct pv_page *) trunc_page(pv); + pvp = (struct pv_page *) trunc_page((vaddr_t)pv); switch (++pvp->pvp_pgi.pgi_nfree) { case 1: TAILQ_INSERT_TAIL(&pv_page_freelist, pvp, pvp_pgi.pgi_list); @@ -470,7 +470,7 @@ pmap_collect_pv() continue; s = splimp(); for (ppv = ph; (pv = ppv->pv_next) != 0; ) { - pvp = (struct pv_page *) trunc_page(pv); + pvp = (struct pv_page *) trunc_page((vaddr_t)pv); if (pvp->pvp_pgi.pgi_nfree == -1) { pvp = pv_page_freelist.tqh_first; if (--pvp->pvp_pgi.pgi_nfree == 0) { @@ -1176,7 +1176,7 @@ pmap_enter(pmap, va, pa, prot, wired, access_type) /* our guess about the vm_map was good! fault it in. */ vmap = &curproc->p_vmspace->vm_map; - v = trunc_page(vtopte(va)); + v = trunc_page((vaddr_t)vtopte(va)); #ifdef DEBUG printf("faulting in a pt page map %x va %x\n", vmap, v); #endif @@ -1815,7 +1815,7 @@ pmap_prefault(map, v, l) for (pv = v; pv < v + l ; pv += ~PD_MASK + 1) { if (!pmap_pde_v(pmap_pde(map->pmap, pv))) { - pv2 = trunc_page(vtopte(pv)); + pv2 = trunc_page((vaddr_t)vtopte(pv)); #if defined(UVM) uvm_fault(map, pv2, 0, VM_PROT_READ); #else diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c index 91a50eb16c4..d0d12d0759e 100644 --- a/sys/arch/i386/i386/trap.c +++ b/sys/arch/i386/i386/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.38 2001/05/05 20:56:38 art Exp $ */ +/* $OpenBSD: trap.c,v 1.39 2001/05/05 21:26:37 art Exp $ */ /* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */ /*- @@ -493,7 +493,7 @@ trap(frame) #ifndef PMAP_NEW /* check if page table is mapped, if not, fault it first */ if ((PTD[pdei(va)] & PG_V) == 0) { - v = trunc_page(vtopte(va)); + v = trunc_page((vaddr_t)vtopte(va)); #if defined(UVM) rv = uvm_fault(map, v, 0, ftype); #else diff --git a/sys/arch/i386/i386/vm_machdep.c b/sys/arch/i386/i386/vm_machdep.c index ee5c433ad33..bcbda38c1f3 100644 --- a/sys/arch/i386/i386/vm_machdep.c +++ b/sys/arch/i386/i386/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.23 2001/03/23 18:41:01 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.24 2001/05/05 21:26:37 art Exp $ */ /* $NetBSD: vm_machdep.c,v 1.61 1996/05/03 19:42:35 christos Exp $ */ /*- @@ -427,7 +427,7 @@ vmapbuf(bp, len) if ((bp->b_flags & B_PHYS) == 0) panic("vmapbuf"); - faddr = trunc_page(bp->b_saveaddr = bp->b_data); + faddr = trunc_page((vaddr_t)(bp->b_saveaddr = bp->b_data)); off = (vm_offset_t)bp->b_data - faddr; len = round_page(off + len); #if defined(UVM) @@ -487,7 +487,7 @@ vunmapbuf(bp, len) if ((bp->b_flags & B_PHYS) == 0) panic("vunmapbuf"); - addr = trunc_page(bp->b_data); + addr = trunc_page((vaddr_t)bp->b_data); off = (vm_offset_t)bp->b_data - addr; len = round_page(off + len); #if defined(UVM) diff --git a/sys/arch/m68k/m68k/mappedcopy.c b/sys/arch/m68k/m68k/mappedcopy.c index 420170fff2d..0dfa6e56056 100644 --- a/sys/arch/m68k/m68k/mappedcopy.c +++ b/sys/arch/m68k/m68k/mappedcopy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mappedcopy.c,v 1.2 1999/09/03 18:01:04 art Exp $ */ +/* $OpenBSD: mappedcopy.c,v 1.3 2001/05/05 21:26:37 art Exp $ */ /* $NetBSD: mappedcopy.c,v 1.1 1997/02/02 06:54:10 thorpej Exp $ */ /* @@ -107,7 +107,7 @@ mappedcopyin(fromp, top, count) /* * Map in the page and bcopy data in from it */ - upa = pmap_extract(upmap, trunc_page(fromp)); + upa = pmap_extract(upmap, trunc_page((vaddr_t)fromp)); if (upa == 0) panic("mappedcopyin: null page frame"); len = min(count, (PAGE_SIZE - off)); @@ -158,7 +158,7 @@ mappedcopyout(fromp, top, count) /* * Map in the page and bcopy data out to it */ - upa = pmap_extract(upmap, trunc_page(top)); + upa = pmap_extract(upmap, trunc_page((vaddr_t)top)); if (upa == 0) panic("mappedcopyout: null page frame"); len = min(count, (PAGE_SIZE - off)); diff --git a/sys/arch/mac68k/mac68k/pmap.c b/sys/arch/mac68k/mac68k/pmap.c index b28c0676acc..275ef201b7c 100644 --- a/sys/arch/mac68k/mac68k/pmap.c +++ b/sys/arch/mac68k/mac68k/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.16 1999/09/03 18:01:14 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.17 2001/05/05 21:26:38 art Exp $ */ /* $NetBSD: pmap.c,v 1.28 1996/10/21 05:42:27 scottr Exp $ */ /* @@ -539,7 +539,7 @@ pmap_free_pv(pv) { register struct pv_page *pvp; - pvp = (struct pv_page *) trunc_page(pv); + pvp = (struct pv_page *) trunc_page((vaddr_t)pv); switch (++pvp->pvp_pgi.pgi_nfree) { case 1: TAILQ_INSERT_TAIL(&pv_page_freelist, pvp, pvp_pgi.pgi_list); @@ -588,7 +588,7 @@ pmap_collect_pv() continue; s = splimp(); for (ppv = ph; (pv = ppv->pv_next) != 0; ) { - pvp = (struct pv_page *) trunc_page(pv); + pvp = (struct pv_page *) trunc_page((vaddr_t)pv); if (pvp->pvp_pgi.pgi_nfree == -1) { pvp = pv_page_freelist.tqh_first; if (--pvp->pvp_pgi.pgi_nfree == 0) { @@ -1172,8 +1172,8 @@ pmap_enter(pmap, va, pa, prot, wired, access_type) * is a valid mapping in the page. */ if (pmap != pmap_kernel()) - (void) vm_map_pageable(pt_map, trunc_page(pte), - round_page(pte+1), FALSE); + (void) vm_map_pageable(pt_map, trunc_page((vaddr_t)pte), + round_page((vaddr_t)(pte+1)), FALSE); /* * Enter on the PV list if part of our managed memory @@ -1294,7 +1294,7 @@ validate: TBIS(va); #ifdef DEBUG if ((pmapdebug & PDB_WIRING) && pmap != pmap_kernel()) - pmap_check_wiring("enter", trunc_page(pmap_pte(pmap, va))); + pmap_check_wiring("enter", trunc_page((vaddr_t)pmap_pte(pmap, va))); #endif } @@ -1722,11 +1722,11 @@ pmap_remove_mapping(pmap, va, pte, flags) * PT page. */ if (pmap != pmap_kernel()) { - (void) vm_map_pageable(pt_map, trunc_page(pte), - round_page(pte+1), TRUE); + (void) vm_map_pageable(pt_map, trunc_page((vaddr_t)pte), + round_page((vaddr_t)(pte+1)), TRUE); #ifdef DEBUG if (pmapdebug & PDB_WIRING) - pmap_check_wiring("remove", trunc_page(pte)); + pmap_check_wiring("remove", (vaddr_t)trunc_page(pte)); #endif } /* @@ -1815,7 +1815,7 @@ pmap_remove_mapping(pmap, va, pte, flags) printf("remove: stab %p, refcnt %d\n", ptpmap->pm_stab, ptpmap->pm_sref - 1); if ((pmapdebug & PDB_PARANOIA) && - ptpmap->pm_stab != (st_entry_t *)trunc_page(ste)) + ptpmap->pm_stab != (st_entry_t *)trunc_page((vaddr_t)ste)) panic("remove: bogus ste"); #endif if (--(ptpmap->pm_sref) == 0) { diff --git a/sys/arch/mac68k/mac68k/trap.c b/sys/arch/mac68k/mac68k/trap.c index 31ac320e38b..b628b9be853 100644 --- a/sys/arch/mac68k/mac68k/trap.c +++ b/sys/arch/mac68k/mac68k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.19 2001/05/05 20:56:42 art Exp $ */ +/* $OpenBSD: trap.c,v 1.20 2001/05/05 21:26:38 art Exp $ */ /* $NetBSD: trap.c,v 1.46 1997/04/07 22:54:44 scottr Exp $ */ /* @@ -710,7 +710,7 @@ writeback(fp, docachepush) */ if (docachepush) { pmap_enter(pmap_kernel(), (vm_offset_t)vmmap, - trunc_page(f->f_fa), VM_PROT_WRITE, TRUE, + trunc_page((vaddr_t)f->f_fa), VM_PROT_WRITE, TRUE, VM_PROT_WRITE); fa = (u_int)&vmmap[(f->f_fa & PGOFSET) & ~0xF]; bcopy((caddr_t)&f->f_pd0, (caddr_t)fa, 16); diff --git a/sys/arch/mvme68k/mvme68k/pmap.c b/sys/arch/mvme68k/mvme68k/pmap.c index 50141bc6b00..9160d60394c 100644 --- a/sys/arch/mvme68k/mvme68k/pmap.c +++ b/sys/arch/mvme68k/mvme68k/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.17 2001/04/05 20:39:40 deraadt Exp $ */ +/* $OpenBSD: pmap.c,v 1.18 2001/05/05 21:26:38 art Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -677,7 +677,7 @@ pmap_free_pv(pv) register struct pv_page *pvp; register int i; - pvp = (struct pv_page *) trunc_page(pv); + pvp = (struct pv_page *) trunc_page((vaddr_t)pv); switch (++pvp->pvp_pgi.pgi_nfree) { case 1: TAILQ_INSERT_TAIL(&pv_page_freelist, pvp, pvp_pgi.pgi_list); @@ -724,7 +724,7 @@ pmap_collect_pv() continue; s = splimp(); for (ppv = ph; (pv = ppv->pv_next) != 0; ) { - pvp = (struct pv_page *) trunc_page(pv); + pvp = (struct pv_page *) trunc_page((vaddr_t)pv); if (pvp->pvp_pgi.pgi_nfree == -1) { pvp = pv_page_freelist.tqh_first; if (--pvp->pvp_pgi.pgi_nfree == 0) { @@ -1286,8 +1286,8 @@ pmap_enter(pmap, va, pa, prot, wired, access_type) * is a valid mapping in the page. */ if (pmap != pmap_kernel()) - (void) vm_map_pageable(pt_map, trunc_page(pte), - round_page(pte+1), FALSE); + (void) vm_map_pageable(pt_map, trunc_page((vaddr_t)pte), + round_page((vaddr_t)(pte+1)), FALSE); /* * Enter on the PV list if part of our managed memory @@ -1408,7 +1408,7 @@ validate: TBIS(va); #ifdef DEBUG if ((pmapdebug & PDB_WIRING) && pmap != pmap_kernel()) - pmap_check_wiring("enter", trunc_page(pmap_pte(pmap, va))); + pmap_check_wiring("enter", trunc_page((vaddr_t)pmap_pte(pmap, va))); #endif } @@ -2024,11 +2024,11 @@ pmap_remove_mapping(pmap, va, pte, flags) * PT page. */ if (pmap != pmap_kernel()) { - (void) vm_map_pageable(pt_map, trunc_page(pte), - round_page(pte+1), TRUE); + (void) vm_map_pageable(pt_map, trunc_page((vaddr_t)pte), + round_page((vaddr_t)(pte+1)), TRUE); #ifdef DEBUG if (pmapdebug & PDB_WIRING) - pmap_check_wiring("remove", trunc_page(pte)); + pmap_check_wiring("remove", trunc_page((vaddr_t)pte)); #endif } /* @@ -2117,7 +2117,7 @@ pmap_remove_mapping(pmap, va, pte, flags) printf("remove: stab %x, refcnt %d\n", ptpmap->pm_stab, ptpmap->pm_sref - 1); if ((pmapdebug & PDB_PARANOIA) && - ptpmap->pm_stab != (st_entry_t *)trunc_page(ste)) + ptpmap->pm_stab != (st_entry_t *)trunc_page((vaddr_t)ste)) panic("remove: bogus ste"); #endif if (--(ptpmap->pm_sref) == 0) { diff --git a/sys/arch/mvme68k/mvme68k/trap.c b/sys/arch/mvme68k/mvme68k/trap.c index 7897c940a36..9363eb9353d 100644 --- a/sys/arch/mvme68k/mvme68k/trap.c +++ b/sys/arch/mvme68k/mvme68k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.28 2001/05/05 20:56:45 art Exp $ */ +/* $OpenBSD: trap.c,v 1.29 2001/05/05 21:26:39 art Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -724,7 +724,7 @@ int docachepush; */ if (docachepush) { pmap_enter(pmap_kernel(), (vm_offset_t)vmmap, - trunc_page(f->f_fa), VM_PROT_WRITE, TRUE, VM_PROT_WRITE); + trunc_page((vaddr_t)f->f_fa), VM_PROT_WRITE, TRUE, VM_PROT_WRITE); fa = (u_int)&vmmap[(f->f_fa & PGOFSET) & ~0xF]; bcopy((caddr_t)&f->f_pd0, (caddr_t)fa, 16); DCFL(pmap_extract(pmap_kernel(), (vm_offset_t)fa)); diff --git a/sys/arch/mvme88k/mvme88k/vm_machdep.c b/sys/arch/mvme88k/mvme88k/vm_machdep.c index e89a67773d9..c4271f736cd 100644 --- a/sys/arch/mvme88k/mvme88k/vm_machdep.c +++ b/sys/arch/mvme88k/mvme88k/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.22 2001/05/05 20:56:47 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.23 2001/05/05 21:26:39 art Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. @@ -251,7 +251,7 @@ vmapbuf(bp, len) panic("vmapbuf"); #endif - addr = (caddr_t)trunc_page(bp->b_saveaddr = bp->b_data); + addr = (caddr_t)trunc_page((vaddr_t)(bp->b_saveaddr = bp->b_data)); off = (vm_offset_t)bp->b_saveaddr & PGOFSET; len = round_page(off + len); pmap = vm_map_pmap(&bp->b_proc->p_vmspace->vm_map); @@ -306,7 +306,7 @@ vunmapbuf(bp, len) panic("vunmapbuf"); #endif - addr = trunc_page(bp->b_data); + addr = trunc_page((vaddr_t)bp->b_data); off = (vm_offset_t)bp->b_data & PGOFSET; len = round_page(off + len); #if defined(UVM) @@ -434,7 +434,7 @@ mapiospace(caddr_t pa, int len) int off = (u_long)pa & PGOFSET; extern vm_offset_t phys_map_vaddr1; - pa = (caddr_t)trunc_page(pa); + pa = (caddr_t)trunc_page((paddr_t)pa); pmap_enter(kernel_pmap, phys_map_vaddr1, (vm_offset_t)pa, VM_PROT_READ|VM_PROT_WRITE, 1, 0); diff --git a/sys/arch/pmax/pmax/vm_machdep.c b/sys/arch/pmax/pmax/vm_machdep.c index dfc7b97508e..f270b0a004f 100644 --- a/sys/arch/pmax/pmax/vm_machdep.c +++ b/sys/arch/pmax/pmax/vm_machdep.c @@ -304,7 +304,7 @@ vmapbuf(bp, len) if ((bp->b_flags & B_PHYS) == 0) panic("vmapbuf"); p = bp->b_proc; - faddr = trunc_page(bp->b_saveaddr = bp->b_data); + faddr = trunc_page((vaddr_t)(bp->b_saveaddr = bp->b_data)); off = (vm_offset_t)bp->b_data - faddr; len = round_page(off + len); taddr = kmem_alloc_wait(phys_map, len); @@ -335,7 +335,7 @@ vunmapbuf(bp, len) if ((bp->b_flags & B_PHYS) == 0) panic("vunmapbuf"); - addr = trunc_page(bp->b_data); + addr = trunc_page((vaddr_t)bp->b_data); off = (vm_offset_t)bp->b_data - addr; len = round_page(off + len); kmem_free_wakeup(phys_map, addr, len); diff --git a/sys/arch/powerpc/powerpc/pmap.c b/sys/arch/powerpc/powerpc/pmap.c index c2cf84bc7c3..b5cb6103a66 100644 --- a/sys/arch/powerpc/powerpc/pmap.c +++ b/sys/arch/powerpc/powerpc/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.27 2001/04/18 06:26:12 drahn Exp $ */ +/* $OpenBSD: pmap.c,v 1.28 2001/05/05 21:26:40 art Exp $ */ /* $NetBSD: pmap.c,v 1.1 1996/09/30 16:34:52 ws Exp $ */ /* @@ -1069,7 +1069,7 @@ pmap_free_pv(pv) { struct pv_page *pvp; - pvp = (struct pv_page *)trunc_page(pv); + pvp = (struct pv_page *)trunc_page((vaddr_t)pv); switch (++pvp->pvp_pgi.pgi_nfree) { case 1: LIST_INSERT_HEAD(&pv_page_freelist, pvp, pvp_pgi.pgi_list); @@ -1143,7 +1143,7 @@ pofree(po, freepage) { struct po_page *pop; - pop = (struct po_page *)trunc_page(po); + pop = (struct po_page *)trunc_page((vaddr_t)po); switch (++pop->pop_pgi.pgi_nfree) { case NPOPPG: if (!freepage) diff --git a/sys/arch/powerpc/powerpc/vm_machdep.c b/sys/arch/powerpc/powerpc/vm_machdep.c index 6fb4ed7058f..1e2d82d5d2e 100644 --- a/sys/arch/powerpc/powerpc/vm_machdep.c +++ b/sys/arch/powerpc/powerpc/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.14 2001/04/03 20:27:26 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.15 2001/05/05 21:26:40 art Exp $ */ /* $NetBSD: vm_machdep.c,v 1.1 1996/09/30 16:34:57 ws Exp $ */ /* @@ -237,7 +237,7 @@ vmapbuf(bp, len) if (!(bp->b_flags & B_PHYS)) panic("vmapbuf"); #endif - faddr = trunc_page(bp->b_saveaddr = bp->b_data); + faddr = trunc_page((vaddr_t)(bp->b_saveaddr = bp->b_data)); off = (vm_offset_t)bp->b_data - faddr; len = round_page(off + len); #ifdef UVM @@ -269,7 +269,7 @@ vunmapbuf(bp, len) if (!(bp->b_flags & B_PHYS)) panic("vunmapbuf"); #endif - addr = trunc_page(bp->b_data); + addr = trunc_page((vaddr_t)bp->b_data); off = (vm_offset_t)bp->b_data - addr; len = round_page(off + len); #ifdef UVM diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c index 6b68142e839..5328206389a 100644 --- a/sys/arch/sparc/sparc/machdep.c +++ b/sys/arch/sparc/sparc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.54 2001/05/05 20:56:52 art Exp $ */ +/* $OpenBSD: machdep.c,v 1.55 2001/05/05 21:26:41 art Exp $ */ /* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */ /* @@ -1067,7 +1067,7 @@ mapdev(phys, virt, offset, size) ret = (void *)(v | (((u_long)phys->rr_paddr + offset) & PGOFSET)); /* note: preserve page offset */ - pa = trunc_page(phys->rr_paddr + offset); + pa = trunc_page((vaddr_t)phys->rr_paddr + offset); pmtype = PMAP_IOENC(phys->rr_iospace); do { diff --git a/sys/arch/vax/vax/pmap.c b/sys/arch/vax/vax/pmap.c index 43f4f758abd..80eb65aa8af 100644 --- a/sys/arch/vax/vax/pmap.c +++ b/sys/arch/vax/vax/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.13 2001/04/10 06:59:13 niklas Exp $ */ +/* $OpenBSD: pmap.c,v 1.14 2001/05/05 21:26:41 art Exp $ */ /* $NetBSD: pmap.c,v 1.74 1999/11/13 21:32:25 matt Exp $ */ /* * Copyright (c) 1994, 1998, 1999 Ludd, University of Lule}, Sweden. @@ -717,7 +717,7 @@ if (startpmapdebug) panic("pmap_enter: bad index %d", index); #endif if (pmap->pm_refcnt[index] == 0) { - vaddr_t ptaddr = trunc_page(&patch[i]); + vaddr_t ptaddr = trunc_page((vaddr_t)&patch[i]); paddr_t phys; struct vm_page *pg; #ifdef DEBUG diff --git a/sys/arch/vax/vax/trap.c b/sys/arch/vax/vax/trap.c index db589030997..a6be28ca91e 100644 --- a/sys/arch/vax/vax/trap.c +++ b/sys/arch/vax/vax/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.13 2000/11/10 18:15:43 art Exp $ */ +/* $OpenBSD: trap.c,v 1.14 2001/05/05 21:26:41 art Exp $ */ /* $NetBSD: trap.c,v 1.47 1999/08/21 19:26:20 matt Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -180,7 +180,7 @@ if(faultdebug)printf("trap accflt type %lx, code %lx, pc %lx, psl %lx\n", * because we must check for PTE pages anyway we don't * bother doing it here. */ - addr = trunc_page(frame->code); + addr = trunc_page((vaddr_t)frame->code); if ((umode == 0) && (frame->code < 0)) map = kernel_map; else diff --git a/sys/arch/vax/vax/uvax.c b/sys/arch/vax/vax/uvax.c index 592daa5c584..6aaaeba9501 100644 --- a/sys/arch/vax/vax/uvax.c +++ b/sys/arch/vax/vax/uvax.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvax.c,v 1.4 1999/01/11 05:12:08 millert Exp $ */ +/* $OpenBSD: uvax.c,v 1.5 2001/05/05 21:26:42 art Exp $ */ /* $NetBSD: uvax.c,v 1.4 1997/02/19 10:04:27 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -93,7 +93,7 @@ uvax_phys2virt(phys) for (p = dep_call->cpu_map; p->um_base != 0; p++) { if (p->um_base > phys || p->um_end < phys) continue; - virt = p->um_virt + (phys - trunc_page(p->um_base)); + virt = p->um_virt + (phys - trunc_page((vaddr_t)p->um_base)); break; } diff --git a/sys/arch/vax/vax/vm_machdep.c b/sys/arch/vax/vax/vm_machdep.c index e93dd48fec0..cc0fa99ecb8 100644 --- a/sys/arch/vax/vax/vm_machdep.c +++ b/sys/arch/vax/vax/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.19 2001/02/11 06:34:37 hugh Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.20 2001/05/05 21:26:42 art Exp $ */ /* $NetBSD: vm_machdep.c,v 1.67 2000/06/29 07:14:34 mrg Exp $ */ /* @@ -341,7 +341,7 @@ vmapbuf(bp, len) if ((bp->b_flags & B_PHYS) == 0) panic("vmapbuf"); p = bp->b_proc; - faddr = trunc_page((vaddr_t)bp->b_saveaddr = bp->b_data); + faddr = trunc_page((vaddr_t)(bp->b_saveaddr = bp->b_data)); off = (vaddr_t)bp->b_data - faddr; len = round_page(off + len); taddr = uvm_km_valloc_wait(phys_map, len); diff --git a/sys/compat/sunos/sunos_misc.c b/sys/compat/sunos/sunos_misc.c index a8a0f267900..dbef9174ff2 100644 --- a/sys/compat/sunos/sunos_misc.c +++ b/sys/compat/sunos/sunos_misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sunos_misc.c,v 1.25 2001/01/26 05:30:18 marc Exp $ */ +/* $OpenBSD: sunos_misc.c,v 1.26 2001/05/05 21:26:42 art Exp $ */ /* $NetBSD: sunos_misc.c,v 1.65 1996/04/22 01:44:31 christos Exp $ */ /* @@ -480,8 +480,8 @@ sunos_sys_mmap(p, v, retval) if ((SCARG(&ouap, flags) & MAP_FIXED) == 0 && SCARG(&ouap, addr) != 0 && - SCARG(&ouap, addr) < (void *)round_page(p->p_vmspace->vm_daddr+MAXDSIZ)) - SCARG(&ouap, addr) = (void *)round_page(p->p_vmspace->vm_daddr+MAXDSIZ); + SCARG(&ouap, addr) < (void *)round_page((vaddr_t)p->p_vmspace->vm_daddr+MAXDSIZ)) + SCARG(&ouap, addr) = (void *)round_page((vaddr_t)p->p_vmspace->vm_daddr+MAXDSIZ); SCARG(&ouap, len) = SCARG(uap, len); SCARG(&ouap, prot) = SCARG(uap, prot); diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c index 848e60871be..5f4a57c5d86 100644 --- a/sys/compat/svr4/svr4_misc.c +++ b/sys/compat/svr4/svr4_misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: svr4_misc.c,v 1.29 2001/01/23 05:48:04 csapuntz Exp $ */ +/* $OpenBSD: svr4_misc.c,v 1.30 2001/05/05 21:26:43 art Exp $ */ /* $NetBSD: svr4_misc.c,v 1.42 1996/12/06 03:22:34 christos Exp $ */ /* @@ -368,7 +368,7 @@ svr4_sys_mmap(p, v, retval) SCARG(&mm, addr) = SCARG(uap, addr); SCARG(&mm, pos) = SCARG(uap, pos); - rp = (void *) round_page(p->p_vmspace->vm_daddr + MAXDSIZ); + rp = (void *) round_page((vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ); if ((SCARG(&mm, flags) & MAP_FIXED) == 0 && SCARG(&mm, addr) != 0 && SCARG(&mm, addr) < rp) SCARG(&mm, addr) = rp; @@ -402,7 +402,7 @@ svr4_sys_mmap64(p, v, retval) SCARG(&mm, addr) = SCARG(uap, addr); SCARG(&mm, pos) = SCARG(uap, pos); - rp = (void *) round_page(p->p_vmspace->vm_daddr + MAXDSIZ); + rp = (void *) round_page((vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ); if ((SCARG(&mm, flags) & MAP_FIXED) == 0 && SCARG(&mm, addr) != 0 && SCARG(&mm, addr) < rp) SCARG(&mm, addr) = rp; @@ -666,7 +666,7 @@ svr4_sys_break(p, v, retval) register int diff; old = (vaddr_t) vm->vm_daddr; - new = round_page(SCARG(uap, nsize)); + new = round_page((vaddr_t)SCARG(uap, nsize)); diff = new - old; DPRINTF(("break(1): old %lx new %lx diff %x\n", old, new, diff)); diff --git a/sys/compat/ultrix/ultrix_misc.c b/sys/compat/ultrix/ultrix_misc.c index b19812cabb0..5afb61b3363 100644 --- a/sys/compat/ultrix/ultrix_misc.c +++ b/sys/compat/ultrix/ultrix_misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ultrix_misc.c,v 1.16 2000/12/28 22:38:18 miod Exp $ */ +/* $OpenBSD: ultrix_misc.c,v 1.17 2001/05/05 21:26:44 art Exp $ */ /* $NetBSD: ultrix_misc.c,v 1.23 1996/04/07 17:23:04 jonathan Exp $ */ /* @@ -332,8 +332,8 @@ ultrix_sys_mmap(p, v, retval) if ((SCARG(&ouap, flags) & MAP_FIXED) == 0 && SCARG(&ouap, addr) != 0 && - SCARG(&ouap, addr) < (void *)round_page(p->p_vmspace->vm_daddr+MAXDSIZ)) - SCARG(&ouap, addr) = (void *)round_page(p->p_vmspace->vm_daddr+MAXDSIZ); + SCARG(&ouap, addr) < (void *)round_page((vaddr_t)p->p_vmspace->vm_daddr+MAXDSIZ)) + SCARG(&ouap, addr) = (void *)round_page((vaddr_t)p->p_vmspace->vm_daddr+MAXDSIZ); SCARG(&ouap, len) = SCARG(uap, len); SCARG(&ouap, prot) = SCARG(uap, prot); diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index 8ed48c24843..b1232d4253f 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysv_shm.c,v 1.15 2001/05/05 20:57:00 art Exp $ */ +/* $OpenBSD: sysv_shm.c,v 1.16 2001/05/05 21:26:44 art Exp $ */ /* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */ /* @@ -264,7 +264,8 @@ sys_shmat(p, v, retval) } else { /* This is just a hint to vm_mmap() about where to put it. */ attach_va = - round_page(p->p_vmspace->vm_taddr + MAXTSIZ + MAXDSIZ); + round_page((vaddr_t)p->p_vmspace->vm_taddr + MAXTSIZ + + MAXDSIZ); } shm_handle = shmseg->shm_internal; #ifdef UVM diff --git a/sys/uvm/uvm_glue.c b/sys/uvm/uvm_glue.c index 64727047753..2908673394f 100644 --- a/sys/uvm/uvm_glue.c +++ b/sys/uvm/uvm_glue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_glue.c,v 1.11 2001/04/03 15:28:06 aaron Exp $ */ +/* $OpenBSD: uvm_glue.c,v 1.12 2001/05/05 21:26:45 art Exp $ */ /* $NetBSD: uvm_glue.c,v 1.23 1999/05/28 20:49:51 thorpej Exp $ */ /* @@ -122,8 +122,8 @@ uvm_kernacc(addr, len, rw) vaddr_t saddr, eaddr; vm_prot_t prot = rw == B_READ ? VM_PROT_READ : VM_PROT_WRITE; - saddr = trunc_page(addr); - eaddr = round_page(addr+len); + saddr = trunc_page((vaddr_t)addr); + eaddr = round_page((vaddr_t)addr+len); vm_map_lock_read(kernel_map); rv = uvm_map_checkprot(kernel_map, saddr, eaddr, prot); vm_map_unlock_read(kernel_map); @@ -170,7 +170,7 @@ uvm_useracc(addr, len, rw) #endif rv = uvm_map_checkprot(&curproc->p_vmspace->vm_map, - trunc_page(addr), round_page(addr+len), prot); + trunc_page((vaddr_t)addr), round_page((vaddr_t)addr+len), prot); return(rv); } @@ -198,8 +198,8 @@ uvm_chgkprot(addr, len, rw) vaddr_t sva, eva; prot = rw == B_READ ? VM_PROT_READ : VM_PROT_READ|VM_PROT_WRITE; - eva = round_page(addr + len); - for (sva = trunc_page(addr); sva < eva; sva += PAGE_SIZE) { + eva = round_page((vaddr_t)addr + len); + for (sva = trunc_page((vaddr_t)addr); sva < eva; sva += PAGE_SIZE) { /* * Extract physical address for the page. * We use a cheezy hack to differentiate physical @@ -229,8 +229,8 @@ uvm_vslock(p, addr, len, access_type) vm_prot_t access_type; { - uvm_fault_wire(&p->p_vmspace->vm_map, trunc_page(addr), - round_page(addr+len), access_type); + uvm_fault_wire(&p->p_vmspace->vm_map, trunc_page((vaddr_t)addr), + round_page((vaddr_t)addr+len), access_type); } /* @@ -246,8 +246,8 @@ uvm_vsunlock(p, addr, len) caddr_t addr; size_t len; { - uvm_fault_unwire(&p->p_vmspace->vm_map, trunc_page(addr), - round_page(addr+len)); + uvm_fault_unwire(&p->p_vmspace->vm_map, trunc_page((vaddr_t)addr), + round_page((vaddr_t)addr+len)); } /* diff --git a/sys/uvm/uvm_mmap.c b/sys/uvm/uvm_mmap.c index 56e23b78352..3aa87738299 100644 --- a/sys/uvm/uvm_mmap.c +++ b/sys/uvm/uvm_mmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_mmap.c,v 1.10 2001/03/22 03:05:56 smart Exp $ */ +/* $OpenBSD: uvm_mmap.c,v 1.11 2001/05/05 21:26:46 art Exp $ */ /* $NetBSD: uvm_mmap.c,v 1.23 1999/06/16 17:25:39 minoura Exp $ */ /* @@ -383,8 +383,8 @@ sys_mmap(p, v, retval) * not fixed: make sure we skip over the largest possible heap. * we will refine our guess later (e.g. to account for VAC, etc) */ - if (addr < round_page(p->p_vmspace->vm_daddr + MAXDSIZ)) - addr = round_page(p->p_vmspace->vm_daddr + MAXDSIZ); + if (addr < round_page((vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ)) + addr = round_page((vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ); } /* diff --git a/sys/uvm/uvm_unix.c b/sys/uvm/uvm_unix.c index 44ac0c01018..eef8c966119 100644 --- a/sys/uvm/uvm_unix.c +++ b/sys/uvm/uvm_unix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_unix.c,v 1.9 2001/05/05 20:57:03 art Exp $ */ +/* $OpenBSD: uvm_unix.c,v 1.10 2001/05/05 21:26:46 art Exp $ */ /* $NetBSD: uvm_unix.c,v 1.8 1999/03/25 18:48:56 mrg Exp $ */ /* @@ -83,7 +83,7 @@ sys_obreak(p, v, retval) long diff; old = (vaddr_t)vm->vm_daddr; - new = round_page(SCARG(uap, nsize)); + new = round_page((vaddr_t)SCARG(uap, nsize)); if ((new - old) > p->p_rlimit[RLIMIT_DATA].rlim_cur) return(ENOMEM); diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index 431518c8bc5..d2227b6ea70 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_glue.c,v 1.36 2001/04/02 21:43:12 niklas Exp $ */ +/* $OpenBSD: vm_glue.c,v 1.37 2001/05/05 21:26:46 art Exp $ */ /* $NetBSD: vm_glue.c,v 1.55.4.1 1996/06/13 17:25:45 cgd Exp $ */ /* @@ -94,8 +94,8 @@ kernacc(addr, len, rw) vm_offset_t saddr, eaddr; vm_prot_t prot = rw == B_READ ? VM_PROT_READ : VM_PROT_WRITE; - saddr = trunc_page(addr); - eaddr = round_page(addr+len); + saddr = trunc_page((vaddr_t)addr); + eaddr = round_page((vaddr_t)addr+len); rv = vm_map_check_protection(kernel_map, saddr, eaddr, prot); /* * XXX there are still some things (e.g. the buffer cache) that @@ -132,7 +132,7 @@ useracc(addr, len, rw) #endif rv = vm_map_check_protection(&curproc->p_vmspace->vm_map, - trunc_page(addr), round_page(addr+len), prot); + trunc_page((vaddr_t)addr), round_page((vaddr_t)addr+len), prot); return (rv == TRUE); } @@ -158,8 +158,8 @@ chgkprot(addr, len, rw) vm_offset_t pa, sva, eva; prot = rw == B_READ ? VM_PROT_READ : VM_PROT_READ|VM_PROT_WRITE; - eva = round_page(addr + len); - for (sva = trunc_page(addr); sva < eva; sva += PAGE_SIZE) { + eva = round_page((vaddr_t)addr + len); + for (sva = trunc_page((vaddr_t)addr); sva < eva; sva += PAGE_SIZE) { /* * Extract physical address for the page. * We use a cheezy hack to differentiate physical @@ -182,8 +182,9 @@ vslock(addr, len) #ifdef __i386__ pmap_prefault(&curproc->p_vmspace->vm_map, (vm_offset_t)addr, len); #endif - return (vm_map_pageable(&curproc->p_vmspace->vm_map, trunc_page(addr), - round_page(addr+len), FALSE)); + return (vm_map_pageable(&curproc->p_vmspace->vm_map, + trunc_page((vaddr_t)addr), + round_page((vaddr_t)addr+len), FALSE)); } int @@ -191,8 +192,9 @@ vsunlock(addr, len) caddr_t addr; u_int len; { - return (vm_map_pageable(&curproc->p_vmspace->vm_map, trunc_page(addr), - round_page(addr+len), TRUE)); + return (vm_map_pageable(&curproc->p_vmspace->vm_map, + trunc_page((vaddr_t)addr), + round_page((vaddr_t)addr+len), TRUE)); } /* diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 3332ee20183..57aac2da609 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_mmap.c,v 1.16 2001/03/09 15:11:47 art Exp $ */ +/* $OpenBSD: vm_mmap.c,v 1.17 2001/05/05 21:26:47 art Exp $ */ /* $NetBSD: vm_mmap.c,v 1.47 1996/03/16 23:15:23 christos Exp $ */ /* @@ -201,8 +201,8 @@ sys_mmap(p, v, retval) * There should really be a pmap call to determine a reasonable * location. (To avoid VA cache alias problems, for example!) */ - else if (addr < round_page(p->p_vmspace->vm_daddr + MAXDSIZ)) - addr = round_page(p->p_vmspace->vm_daddr + MAXDSIZ); + else if (addr < round_page((vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ)) + addr = round_page((vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ); if ((flags & MAP_ANON) == 0) { /* diff --git a/sys/vm/vm_param.h b/sys/vm/vm_param.h index 60882c1ae67..e7abee33d53 100644 --- a/sys/vm/vm_param.h +++ b/sys/vm/vm_param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_param.h,v 1.20 2000/06/14 16:51:55 provos Exp $ */ +/* $OpenBSD: vm_param.h,v 1.21 2001/05/05 21:26:47 art Exp $ */ /* $NetBSD: vm_param.h,v 1.12 1995/03/26 20:39:16 jtc Exp $ */ /* @@ -188,11 +188,13 @@ struct _ps_strings { * for either addresses or counts (i.e., 1 byte rounds to 1 page). */ #define round_page(x) \ - ((vaddr_t)((((vaddr_t)(x)) + PAGE_MASK) & ~PAGE_MASK)) + (((x) + PAGE_MASK) & ~PAGE_MASK) #define trunc_page(x) \ - ((vaddr_t)(((vaddr_t)(x)) & ~PAGE_MASK)) + ((x) & ~PAGE_MASK) +#if !defined(UVM) #define num_pages(x) \ ((vaddr_t)((((vaddr_t)(x)) + PAGE_MASK) >> PAGE_SHIFT)) +#endif #else /* out-of-kernel versions of round_page and trunc_page */ |