Use PAGE_SIZE rather than NBPG.

This commit is contained in:
thorpej 2003-04-01 15:02:05 +00:00
parent a24d222067
commit d071d9a8d0
11 changed files with 45 additions and 47 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: isadma_machdep.c,v 1.4 2003/03/23 14:12:26 chris Exp $ */
/* $NetBSD: isadma_machdep.c,v 1.5 2003/04/01 15:03:36 thorpej Exp $ */
#define ISA_DMA_STATS
@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: isadma_machdep.c,v 1.4 2003/03/23 14:12:26 chris Exp $");
__KERNEL_RCSID(0, "$NetBSD: isadma_machdep.c,v 1.5 2003/04/01 15:03:36 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -197,7 +197,7 @@ _isa_bus_dmamap_create(t, size, nsegments, maxsegsz, boundary, flags, dmamp)
* 32-bit DMA, and indicate that here.
*
* ...or, there is an opposite case. The most segments
* a transfer will require is (maxxfer / NBPG) + 1. If
* a transfer will require is (maxxfer / PAGE_SIZE) + 1. If
* the caller can't handle that many segments (e.g. the
* ISA DMA controller), we may have to bounce it as well.
*
@ -636,7 +636,7 @@ _isa_dma_alloc_bouncebuf(t, map, size, flags)
cookie->id_bouncebuflen = round_page(size);
error = _isa_bus_dmamem_alloc(t, cookie->id_bouncebuflen,
NBPG, map->_dm_boundary, cookie->id_bouncesegs,
PAGE_SIZE, map->_dm_boundary, cookie->id_bouncesegs,
map->_dm_segcnt, &cookie->id_nbouncesegs, flags);
if (error)
goto out;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vidcrender.c,v 1.10 2002/10/05 17:16:37 chs Exp $ */
/* $NetBSD: vidcrender.c,v 1.11 2003/04/01 15:03:00 thorpej Exp $ */
/*
* Copyright (c) 1996 Mark Brinicombe
@ -257,7 +257,7 @@ vidcrender_coldinit(vc)
dispsize = videomemory.vidm_size;
transfersize = 16;
} else {
dispsize = bootconfig.vram[0].pages * NBPG;
dispsize = bootconfig.vram[0].pages * PAGE_SIZE;
transfersize = dispsize >> 10;
}
@ -1244,7 +1244,7 @@ vidc_cursor_init(vc)
if (!cursor_data) {
/* Allocate cursor memory first time round */
cursor_data = (char *)uvm_km_zalloc(kernel_map, NBPG);
cursor_data = (char *)uvm_km_zalloc(kernel_map, PAGE_SIZE);
if (!cursor_data)
panic("Cannot allocate memory for hardware cursor");
(void) pmap_extract(pmap_kernel(), (vaddr_t)cursor_data, &pa);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hd64465pcmcia.c,v 1.11 2003/01/01 01:41:34 thorpej Exp $ */
/* $NetBSD: hd64465pcmcia.c,v 1.12 2003/04/01 15:02:05 thorpej Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -830,8 +830,8 @@ __sh_hd64465_map(vaddr_t va, paddr_t pa, size_t sz, u_int32_t flags)
KDASSERT(pte);
*pte |= flags; /* PTEA PCMCIA assistant bit */
sh_tlb_update(0, va, *pte);
pa += NBPG;
va += NBPG;
pa += PAGE_SIZE;
va += PAGE_SIZE;
}
return (0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ioapic.c,v 1.2 2003/03/04 22:43:36 fvdl Exp $ */
/* $NetBSD: ioapic.c,v 1.3 2003/04/01 15:09:55 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -289,7 +289,7 @@ ioapic_attach(struct device *parent, struct device *self, void *aux)
printf("%s: pa 0x%lx", sc->sc_pic.pic_dev.dv_xname, aaa->apic_address);
if (x86_mem_add_mapping(aaa->apic_address, NBPG, 0, &bh) != 0) {
if (x86_mem_add_mapping(aaa->apic_address, PAGE_SIZE, 0, &bh) != 0) {
printf(": map failed\n");
return;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mpbios.c,v 1.3 2003/03/04 23:21:25 fvdl Exp $ */
/* $NetBSD: mpbios.c,v 1.4 2003/04/01 15:09:56 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -243,8 +243,8 @@ mpbios_map (pa, len, handle)
do {
pmap_kenter_pa (va, pgpa, VM_PROT_READ);
va += NBPG;
pgpa += NBPG;
va += PAGE_SIZE;
pgpa += PAGE_SIZE;
} while (pgpa < endpa);
return (const void *)retva;
@ -276,7 +276,7 @@ mpbios_probe(self)
/* see if EBDA exists */
mpbios_page = mpbios_map (0, NBPG, &t);
mpbios_page = mpbios_map (0, PAGE_SIZE, &t);
ebda = *(const u_int16_t *) (&mpbios_page[0x40e]);
ebda <<= 4;

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.c,v 1.1 2003/03/05 23:56:07 fvdl Exp $ */
/* $NetBSD: cpu.c,v 1.2 2003/04/01 15:08:29 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -276,7 +276,7 @@ cpu_attach(parent, self, aux)
pcb->pcb_tss.tss_rsp0 = kstack + USPACE - 16;
pcb->pcb_rbp = pcb->pcb_rsp = kstack + USPACE - 16;
pcb->pcb_tss.tss_ist[0] = kstack + NBPG - 16;
pcb->pcb_tss.tss_ist[0] = kstack + PAGE_SIZE - 16;
pcb->pcb_pmap = pmap_kernel();
pcb->pcb_cr0 = rcr0();
pcb->pcb_cr3 = pcb->pcb_pmap->pm_pdirpa;
@ -614,7 +614,7 @@ mp_cpu_start(struct cpu_info *ci)
pmap_kenter_pa (0, 0, VM_PROT_READ|VM_PROT_WRITE);
memcpy ((u_int8_t *) 0x467, dwordptr, 4);
pmap_kremove (0, NBPG);
pmap_kremove (0, PAGE_SIZE);
#if NLAPIC > 0
/*
@ -629,13 +629,15 @@ mp_cpu_start(struct cpu_info *ci)
if (cpu_feature & CPUID_APIC) {
if ((error = x86_ipi(MP_TRAMPOLINE/NBPG,ci->ci_apicid,
LAPIC_DLMODE_STARTUP)) != 0)
if ((error = x86_ipi(MP_TRAMPOLINE/PAGE_SIZE,
ci->ci_apicid,
LAPIC_DLMODE_STARTUP)) != 0)
return error;
delay(200);
if ((error = x86_ipi(MP_TRAMPOLINE/NBPG,ci->ci_apicid,
LAPIC_DLMODE_STARTUP)) != 0)
if ((error = x86_ipi(MP_TRAMPOLINE/PAGE_SIZE,
ci->ci_apicid,
LAPIC_DLMODE_STARTUP)) != 0)
return error;
delay(200);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.33 2003/03/25 00:09:47 fvdl Exp $ */
/* $NetBSD: machdep.c,v 1.34 2003/04/01 15:08:29 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@ -344,7 +344,7 @@ x86_64_proc0_tss_ldt_init(void)
GSYSSEL(GLDT_SEL, SEL_KPL);
pcb->pcb_cr0 = rcr0();
pcb->pcb_tss.tss_rsp0 = (u_int64_t)lwp0.l_addr + USPACE - 16;
pcb->pcb_tss.tss_ist[0] = (u_int64_t)lwp0.l_addr + NBPG;
pcb->pcb_tss.tss_ist[0] = (u_int64_t)lwp0.l_addr + PAGE_SIZE;
lwp0.l_md.md_regs = (struct trapframe *)pcb->pcb_tss.tss_rsp0 - 1;
lwp0.l_md.md_tss_sel = tss_alloc(pcb);
@ -1211,12 +1211,6 @@ init_x86_64(first_avail)
uvmexp.ncolors = 2;
/*
* A quick sanity check.
*/
if (PAGE_SIZE != NBPG)
panic("init386: PAGE_SIZE != NBPG");
avail_start = PAGE_SIZE; /* BIOS leaves data in low memory */
/* and VM system doesn't work with phys 0 */
#ifdef MULTIPROCESSOR

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.16 2003/03/05 23:56:12 fvdl Exp $ */
/* $NetBSD: pmap.c,v 1.17 2003/04/01 15:08:29 thorpej Exp $ */
/*
*
@ -451,7 +451,7 @@ struct pool pmap_pmap_pool;
#ifdef MULTIPROCESSOR
#define PTESLEW(pte, id) ((pte)+(id)*NPTECL)
#define VASLEW(va,id) ((va)+(id)*NPTECL*NBPG)
#define VASLEW(va,id) ((va)+(id)*NPTECL*PAGE_SIZE)
#else
#define PTESLEW(pte, id) (pte)
#define VASLEW(va,id) (va)
@ -963,7 +963,7 @@ pmap_bootstrap(kva_start)
#if KERNBASE == VM_MIN_KERNEL_ADDRESS
for (kva = VM_MIN_KERNEL_ADDRESS ; kva < virtual_avail ;
#else
kva_end = roundup((vaddr_t)&end, NBPG);
kva_end = roundup((vaddr_t)&end, PAGE_SIZE);
for (kva = KERNBASE; kva < kva_end ;
#endif
kva += PAGE_SIZE) {
@ -1728,12 +1728,13 @@ pmap_free_ptp(struct pmap *pmap, struct vm_page *ptp, vaddr_t va,
opde = pmap_pte_set(&pdes[level - 1][index], 0);
invaladdr = level == 1 ? (vaddr_t)ptes :
(vaddr_t)pdes[level - 2];
pmap_tlb_shootdown(curpcb->pcb_pmap, invaladdr + index * NBPG,
pmap_tlb_shootdown(curpcb->pcb_pmap,
invaladdr + index * PAGE_SIZE,
opde, cpumaskp);
#if defined(MULTIPROCESSOR)
invaladdr = level == 1 ? (vaddr_t)PTE_BASE :
(vaddr_t)normal_pdes[level - 2];
pmap_tlb_shootdown(pmap, invaladdr + index * NBPG, opde,
pmap_tlb_shootdown(pmap, invaladdr + index * PAGE_SIZE, opde,
cpumaskp);
#endif
if (level < PTP_LEVELS - 1) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.10 2003/03/05 23:56:13 fvdl Exp $ */
/* $NetBSD: vm_machdep.c,v 1.11 2003/04/01 15:08:29 thorpej Exp $ */
/*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
@ -143,7 +143,7 @@ cpu_lwp_fork(l1, l2, stack, stacksize, func, arg)
/* Fix up the TSS. */
pcb->pcb_tss.tss_rsp0 = (u_int64_t)l2->l_addr + USPACE - 16;
pcb->pcb_tss.tss_ist[0] = (u_int64_t)l2->l_addr + NBPG - 16;
pcb->pcb_tss.tss_ist[0] = (u_int64_t)l2->l_addr + PAGE_SIZE - 16;
l2->l_md.md_tss_sel = tss_alloc(pcb);

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_exec_aout.c,v 1.51 2003/01/18 08:02:51 thorpej Exp $ */
/* $NetBSD: linux_exec_aout.c,v 1.52 2003/04/01 15:05:11 thorpej Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_exec_aout.c,v 1.51 2003/01/18 08:02:51 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_exec_aout.c,v 1.52 2003/04/01 15:05:11 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -238,7 +238,7 @@ exec_linux_aout_prep_nmagic(p, epp)
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
/* set up command for bss segment */
baddr = roundup(epp->ep_daddr + execp->a_data, NBPG);
baddr = roundup(epp->ep_daddr + execp->a_data, PAGE_SIZE);
bsize = epp->ep_daddr + epp->ep_dsize - baddr;
if (bsize > 0)
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, bsize, baddr,
@ -272,7 +272,7 @@ exec_linux_aout_prep_omagic(p, epp)
LINUX_N_TXTOFF(*execp, OMAGIC), VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
/* set up command for bss segment */
baddr = roundup(epp->ep_daddr + execp->a_data, NBPG);
baddr = roundup(epp->ep_daddr + execp->a_data, PAGE_SIZE);
bsize = epp->ep_daddr + epp->ep_dsize - baddr;
if (bsize > 0)
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, bsize, baddr,
@ -286,7 +286,8 @@ exec_linux_aout_prep_omagic(p, epp)
* Compensate `ep_dsize' for the amount of data covered by the last
* text page.
*/
dsize = epp->ep_dsize + execp->a_text - roundup(execp->a_text, NBPG);
dsize = epp->ep_dsize + execp->a_text - roundup(execp->a_text,
PAGE_SIZE);
epp->ep_dsize = (dsize > 0) ? dsize : 0;
return exec_aout_setup_stack(p, epp);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_uselib.c,v 1.9 2003/01/18 21:21:40 thorpej Exp $ */
/* $NetBSD: linux_uselib.c,v 1.10 2003/04/01 15:05:12 thorpej Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_uselib.c,v 1.9 2003/01/18 21:21:40 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_uselib.c,v 1.10 2003/04/01 15:05:12 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -133,7 +133,7 @@ linux_sys_uselib(l, v, retval)
return ENOEXEC;
magic = LINUX_N_MAGIC(&hdr);
taddr = hdr.a_entry & (~(NBPG - 1));
taddr = hdr.a_entry & (~(PAGE_SIZE - 1));
tsize = hdr.a_text;
daddr = taddr + tsize;
dsize = hdr.a_data + hdr.a_bss;
@ -151,7 +151,7 @@ linux_sys_uselib(l, v, retval)
vp, LINUX_N_TXTOFF(hdr, magic),
VM_PROT_READ|VM_PROT_EXECUTE|VM_PROT_WRITE);
baddr = roundup(daddr + hdr.a_data, NBPG);
baddr = roundup(daddr + hdr.a_data, PAGE_SIZE);
bsize = daddr + dsize - baddr;
if (bsize > 0) {
NEW_VMCMD(&vcset, vmcmd_map_zero, bsize, baddr,