Use PAGE_SIZE rather than NBPG.

This commit is contained in:
thorpej 2003-04-01 20:48:27 +00:00
parent 14491f27dd
commit b4fe782331
13 changed files with 66 additions and 66 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ie_gsc.c,v 1.7 2002/10/02 05:17:50 thorpej Exp $ */
/* $NetBSD: if_ie_gsc.c,v 1.8 2003/04/01 20:48:27 thorpej Exp $ */
/* $OpenBSD: if_ie_gsc.c,v 1.6 2001/01/12 22:57:04 mickey Exp $ */
@ -46,6 +46,8 @@
#include <sys/socket.h>
#include <sys/sockio.h>
#include <uvm/uvm_extern.h>
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_ether.h>
@ -436,7 +438,7 @@ ie_gsc_attach(parent, self, aux)
* chip in i82586 mode, we're restricted to 24-bit
* physical addresses.
*/
if (bus_dmamem_alloc(gsc->iemt, sc->sc_msize, NBPG, 0,
if (bus_dmamem_alloc(gsc->iemt, sc->sc_msize, PAGE_SIZE, 0,
&seg, 1, &rseg, BUS_DMA_NOWAIT | BUS_DMA_24BIT)) {
printf (": cannot allocate %d bytes of DMA memory\n",
sc->sc_msize);

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.8 2002/12/14 05:23:19 tsutsui Exp $ */
/* $NetBSD: machdep.c,v 1.9 2003/04/01 20:48:27 thorpej Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -497,8 +497,8 @@ hppa_init(start)
ptlball();
fcacheall();
totalphysmem = PAGE0->imm_max_mem / NBPG;
resvmem = resvmem / NBPG;
totalphysmem = PAGE0->imm_max_mem / PAGE_SIZE;
resvmem = resvmem / PAGE_SIZE;
/* calculate HPT size */
/* for (hptsize = 256; hptsize < totalphysmem; hptsize *= 2); */
@ -927,7 +927,7 @@ cpu_startup()
* This page is handed to pmap_enter() therefore
* it has to be in the normal kernel VA range.
*/
vmmap = uvm_km_valloc_wait(kernel_map, NBPG);
vmmap = uvm_km_valloc_wait(kernel_map, PAGE_SIZE);
/*
* Set up buffers, so they can be used to read disk labels.
@ -1372,7 +1372,7 @@ hp700_pagezero_unmap(int was_mapped_before)
if (!was_mapped_before) {
s = splhigh();
pmap_kremove(0, NBPG);
pmap_kremove(0, PAGE_SIZE);
pagezero_mapped = 0;
splx(s);
}
@ -1615,7 +1615,7 @@ cpu_dump()
/*
* Dump the kernel's image to the swap partition.
*/
#define BYTES_PER_DUMP NBPG
#define BYTES_PER_DUMP PAGE_SIZE
void
dumpsys()

View File

@ -1,4 +1,4 @@
/* $NetBSD: mainbus.c,v 1.9 2003/01/01 01:35:43 thorpej Exp $ */
/* $NetBSD: mainbus.c,v 1.10 2003/04/01 20:48:27 thorpej Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -224,7 +224,7 @@ mbus_add_mapping(bus_addr_t bpa, bus_size_t size, int flags,
* Enter another single-page mapping.
*/
pmap_kenter_pa(bpa, bpa, VM_PROT_ALL);
bpa += NBPG;
bpa += PAGE_SIZE;
frames--;
}
@ -282,8 +282,8 @@ mbus_remove_mapping(bus_space_handle_t bsh, bus_size_t size, bus_addr_t *bpap)
/*
* Remove another single-page mapping.
*/
pmap_kremove(bpa, NBPG);
bpa += NBPG;
pmap_kremove(bpa, PAGE_SIZE);
bpa += PAGE_SIZE;
frames--;
}
@ -382,8 +382,8 @@ mbus_alloc(void *v, bus_addr_t rstart, bus_addr_t rend, bus_size_t size,
/*
* Force the allocated region to be page-aligned.
*/
if (align < NBPG)
align = NBPG;
if (align < PAGE_SIZE)
align = PAGE_SIZE;
size = hppa_round_page(size);
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.5 2002/08/25 20:19:59 fredette Exp $ */
/* $NetBSD: pmap.c,v 1.6 2003/04/01 20:50:12 thorpej Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -151,7 +151,6 @@
/*
* CAVEATS:
*
* PAGE_SIZE must equal NBPG
* Needs more work for MP support
* page maps are stored as linear linked lists, some
* improvement may be achieved should we use smth else
@ -795,10 +794,7 @@ pmap_bootstrap(vstart, vend)
uvm_setpagesize();
pages_per_vm_page = PAGE_SIZE / NBPG;
/* XXX for now */
if (pages_per_vm_page != 1)
panic("HPPA page != VM page");
pages_per_vm_page = 1; /* XXX This should die */
kern_prot[VM_PROT_NONE | VM_PROT_NONE | VM_PROT_NONE] =TLB_AR_NA;
kern_prot[VM_PROT_READ | VM_PROT_NONE | VM_PROT_NONE] =TLB_AR_KR;

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.6 2002/12/21 16:23:58 manu Exp $ */
/* $NetBSD: trap.c,v 1.7 2003/04/01 20:50:12 thorpej Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -441,7 +441,7 @@ do { \
uspace_size = USPACE;
#endif
SANITY(p == NULL ||
((tf->tf_sp >= (u_int)(p->p_addr) + NBPG &&
((tf->tf_sp >= (u_int)(p->p_addr) + PAGE_SIZE &&
tf->tf_sp < (u_int)(p->p_addr) + uspace_size)));
}
} else {
@ -741,7 +741,7 @@ trap(type, frame)
*/
if (va >= (vaddr_t)vm->vm_maxsaddr + vm->vm_ssize) {
if (ret == 0) {
vsize_t nss = btoc(va - USRSTACK + NBPG);
vsize_t nss = btoc(va - USRSTACK + PAGE_SIZE);
if (nss > vm->vm_ssize)
vm->vm_ssize = nss;
} else if (ret == EACCES)

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.2 2002/07/01 16:10:03 fredette Exp $ */
/* $NetBSD: vm_machdep.c,v 1.3 2003/04/01 20:50:12 thorpej Exp $ */
/* $OpenBSD: vm_machdep.c,v 1.25 2001/09/19 20:50:56 mickey Exp $ */
@ -166,7 +166,7 @@ cpu_fork(p1, p2, stack, stacksize, func, arg)
register_t sp, osp;
#ifdef DIAGNOSTIC
if (round_page(sizeof(struct user)) > NBPG)
if (round_page(sizeof(struct user)) > PAGE_SIZE)
panic("USPACE too small for user");
#endif
@ -177,7 +177,7 @@ cpu_fork(p1, p2, stack, stacksize, func, arg)
pcbp = &p2->p_addr->u_pcb;
bcopy(&p1->p_addr->u_pcb, pcbp, sizeof(*pcbp));
sp = (register_t)p2->p_addr + NBPG;
sp = (register_t)p2->p_addr + PAGE_SIZE;
p2->p_md.md_regs = tf = (struct trapframe *)sp;
sp += sizeof(struct trapframe);
bcopy(p1->p_md.md_regs, tf, sizeof(*tf));

View File

@ -1,9 +1,12 @@
/* $NetBSD: vesa_raster8.c,v 1.6 2003/02/26 22:21:19 fvdl Exp $ */
/* $NetBSD: vesa_raster8.c,v 1.7 2003/04/01 20:52:35 thorpej Exp $ */
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/malloc.h>
#include <uvm/uvm_extern.h>
#include <machine/frame.h>
#include <machine/kvm86.h>
#include <machine/bus.h>
@ -120,7 +123,7 @@ vb8test(sc)
printf("vbecall: res=%d, ax=%x\n", res, tf.tf_eax);
return;
}
savbufsiz = roundup(tf.tf_ebx * 64, NBPG) / NBPG;
savbufsiz = roundup(tf.tf_ebx * 64, PAGE_SIZE) / PAGE_SIZE;
printf("savbuf: %d pg\n", savbufsiz);
for (i = 0; i < savbufsiz; i++)

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.c,v 1.12 2003/03/03 22:14:15 fvdl Exp $ */
/* $NetBSD: cpu.c,v 1.13 2003/04/01 20:54:23 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -749,7 +749,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
/*
@ -764,13 +764,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: kvm86.c,v 1.5 2003/01/20 18:43:18 drochner Exp $ */
/* $NetBSD: kvm86.c,v 1.6 2003/04/01 20:54:23 thorpej Exp $ */
/*
* Copyright (c) 2002
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kvm86.c,v 1.5 2003/01/20 18:43:18 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: kvm86.c,v 1.6 2003/04/01 20:54:23 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -45,7 +45,7 @@ extern int kvm86_call(struct trapframe *);
extern void kvm86_ret(struct trapframe *, int);
struct kvm86_data {
#define PGTABLE_SIZE ((1024 + 64) * 1024 / NBPG)
#define PGTABLE_SIZE ((1024 + 64) * 1024 / PAGE_SIZE)
pt_entry_t pgtbl[PGTABLE_SIZE]; /* must be aliged */
struct segment_descriptor sd;
@ -79,16 +79,16 @@ kvm86_init()
struct pcb *pcb;
int i;
vmdsize = round_page(sizeof(struct kvm86_data)) + NBPG;
vmdsize = round_page(sizeof(struct kvm86_data)) + PAGE_SIZE;
buf = malloc(vmdsize, M_DEVBUF, M_NOWAIT);
if ((u_long)buf & (NBPG - 1)) {
if ((u_long)buf & (PAGE_SIZE - 1)) {
printf("struct kvm86_data unaligned\n");
return;
}
memset(buf, 0, vmdsize);
/* first page is stack */
vmd = (struct kvm86_data *)(buf + NBPG);
vmd = (struct kvm86_data *)(buf + PAGE_SIZE);
pcb = &vmd->pcb;
/*
@ -112,11 +112,11 @@ kvm86_init()
/* prepare VM for BIOS calls */
kvm86_mapbios(vmd);
bioscallscratchpage = malloc(NBPG, M_DEVBUF, M_NOWAIT);
bioscallscratchpage = malloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT);
kvm86_map(vmd, vtophys((vaddr_t)bioscallscratchpage),
BIOSCALLSCRATCHPAGE_VMVA);
bioscallvmd = vmd;
bioscalltmpva = uvm_km_valloc(kernel_map, NBPG);
bioscalltmpva = uvm_km_valloc(kernel_map, PAGE_SIZE);
}
/*
@ -166,7 +166,7 @@ kvm86_mapbios(vmd)
kvm86_map(vmd, 0, 0);
/* map ISA hole */
for (pa = 0xa0000; pa < 0x100000; pa += NBPG)
for (pa = 0xa0000; pa < 0x100000; pa += PAGE_SIZE)
kvm86_map(vmd, pa, pa);
}
@ -179,8 +179,8 @@ kvm86_bios_addpage(vmva)
if (bioscallvmd->pgtbl[vmva >> 12]) /* allocated? */
return (0);
mem = malloc(NBPG, M_DEVBUF, M_NOWAIT);
if ((u_long)mem & (NBPG - 1)) {
mem = malloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT);
if ((u_long)mem & (PAGE_SIZE - 1)) {
printf("kvm86_bios_addpage: unaligned");
return (0);
}
@ -210,15 +210,15 @@ kvm86_bios_read(vmva, buf, len)
todo = len;
while (todo > 0) {
now = min(todo, NBPG - (vmva & (NBPG - 1)));
now = min(todo, PAGE_SIZE - (vmva & (PAGE_SIZE - 1)));
if (!bioscallvmd->pgtbl[vmva >> 12])
break;
vmpa = bioscallvmd->pgtbl[vmva >> 12] & ~(NBPG - 1);
vmpa = bioscallvmd->pgtbl[vmva >> 12] & ~(PAGE_SIZE - 1);
pmap_kenter_pa(bioscalltmpva, vmpa, VM_PROT_READ);
pmap_update(pmap_kernel());
memcpy(buf, (void *)(bioscalltmpva + (vmva & (NBPG - 1))),
memcpy(buf, (void *)(bioscalltmpva + (vmva & (PAGE_SIZE - 1))),
now);
buf += now;
todo -= now;
@ -245,7 +245,7 @@ kvm86_bioscall(intno, tf)
tf->tf_eip = BIOSCALLSCRATCHPAGE_VMVA;
tf->tf_cs = 0;
tf->tf_esp = BIOSCALLSCRATCHPAGE_VMVA + NBPG - 2;
tf->tf_esp = BIOSCALLSCRATCHPAGE_VMVA + PAGE_SIZE - 2;
tf->tf_ss = 0;
tf->tf_eflags = PSL_USERSET | PSL_VM;
#ifdef KVM86_IOPL3

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.517 2003/03/25 19:37:16 jmmv Exp $ */
/* $NetBSD: machdep.c,v 1.518 2003/04/01 20:54:23 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.517 2003/03/25 19:37:16 jmmv Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.518 2003/04/01 20:54:23 thorpej Exp $");
#include "opt_cputype.h"
#include "opt_ddb.h"
@ -1505,11 +1505,6 @@ init386(first_avail)
* Initailize PAGE_SIZE-dependent variables.
*/
uvm_setpagesize();
/*
* A quick sanity check.
*/
if (PAGE_SIZE != NBPG)
panic("init386: PAGE_SIZE != NBPG");
/*
* Saving SSE registers won't work if the save area isn't

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.150 2003/02/26 21:28:24 fvdl Exp $ */
/* $NetBSD: pmap.c,v 1.151 2003/04/01 20:54:23 thorpej Exp $ */
/*
*
@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.150 2003/02/26 21:28:24 fvdl Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.151 2003/04/01 20:54:23 thorpej Exp $");
#include "opt_cputype.h"
#include "opt_user_ldt.h"
@ -406,7 +406,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)

View File

@ -1,4 +1,4 @@
/* $NetBSD: elan520.c,v 1.4 2002/10/02 05:47:15 thorpej Exp $ */
/* $NetBSD: elan520.c,v 1.5 2003/04/01 20:55:54 thorpej Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -47,13 +47,15 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: elan520.c,v 1.4 2002/10/02 05:47:15 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: elan520.c,v 1.5 2003/04/01 20:55:54 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/wdog.h>
#include <uvm/uvm_extern.h>
#include <machine/bus.h>
#include <dev/pci/pcivar.h>
@ -220,7 +222,7 @@ elansc_attach(struct device *parent, struct device *self, void *aux)
printf(": AMD Elan SC520 System Controller\n");
sc->sc_memt = pa->pa_memt;
if (bus_space_map(sc->sc_memt, MMCR_BASE_ADDR, NBPG, 0,
if (bus_space_map(sc->sc_memt, MMCR_BASE_ADDR, PAGE_SIZE, 0,
&sc->sc_memh) != 0) {
printf("%s: unable to map registers\n", sc->sc_dev.dv_xname);
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pnpbios.c,v 1.35 2003/02/26 22:23:11 fvdl Exp $ */
/* $NetBSD: pnpbios.c,v 1.36 2003/04/01 20:56:30 thorpej Exp $ */
/*
* Copyright (c) 2000 Jason R. Thorpe. All rights reserved.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pnpbios.c,v 1.35 2003/02/26 22:23:11 fvdl Exp $");
__KERNEL_RCSID(0, "$NetBSD: pnpbios.c,v 1.36 2003/04/01 20:56:30 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -275,7 +275,7 @@ pnpbios_mapit(addr, len, prot)
va = startva = uvm_km_valloc(kernel_map, endpa - startpa);
if (!startva)
return (0);
for (; pa < endpa; pa += NBPG, va += NBPG)
for (; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE)
pmap_kenter_pa(va, pa, prot);
pmap_update(pmap_kernel());
@ -322,7 +322,7 @@ pnpbios_attach(parent, self, aux)
/* if we have an event mechnism queue a thread to deal with them */
evtype = (sc->sc_control & PNP_IC_CONTORL_EVENT_MASK);
if (evtype == PNP_IC_CONTROL_EVENT_POLL) {
sc->sc_evaddr = pnpbios_mapit(evaddrp, NBPG,
sc->sc_evaddr = pnpbios_mapit(evaddrp, PAGE_SIZE,
VM_PROT_READ | VM_PROT_WRITE);
if (!sc->sc_evaddr)
printf("%s: couldn't map event flag 0x%08x\n",