diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 1996-05-02 10:43:17 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 1996-05-02 10:43:17 +0000 |
commit | f8845af0dbef25d2e6f611245f459918081b0cb2 (patch) | |
tree | cb8228f2628c3afe7a8e21ed27769c79832dab3b /sys | |
parent | f3e002a838fee75305d388964c7e4ee08075c6d1 (diff) | |
download | src-f8845af0dbef25d2e6f611245f459918081b0cb2.tar.gz src-f8845af0dbef25d2e6f611245f459918081b0cb2.zip |
First pass at cleaning up macros relating to pages, clusters and all that.
Notes
Notes:
svn path=/head/; revision=15538
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/autoconf.c | 4 | ||||
-rw-r--r-- | sys/amd64/amd64/mem.c | 24 | ||||
-rw-r--r-- | sys/amd64/amd64/vm_machdep.c | 42 | ||||
-rw-r--r-- | sys/amd64/isa/isa.c | 6 | ||||
-rw-r--r-- | sys/compat/linux/linux_misc.c | 6 | ||||
-rw-r--r-- | sys/conf/param.c | 4 | ||||
-rw-r--r-- | sys/fs/cd9660/cd9660_vnops.c | 4 | ||||
-rw-r--r-- | sys/i386/boot/biosboot/boot.c | 8 | ||||
-rw-r--r-- | sys/i386/boot/netboot/main.c | 4 | ||||
-rw-r--r-- | sys/i386/i386/autoconf.c | 4 | ||||
-rw-r--r-- | sys/i386/i386/mem.c | 24 | ||||
-rw-r--r-- | sys/i386/i386/vm_machdep.c | 42 | ||||
-rw-r--r-- | sys/i386/isa/aic6360.c | 6 | ||||
-rw-r--r-- | sys/i386/isa/isa.c | 6 | ||||
-rw-r--r-- | sys/i386/isa/wd.c | 8 | ||||
-rw-r--r-- | sys/i386/linux/imgact_linux.c | 6 | ||||
-rw-r--r-- | sys/i386/linux/linux_misc.c | 6 | ||||
-rw-r--r-- | sys/isofs/cd9660/cd9660_vnops.c | 4 | ||||
-rw-r--r-- | sys/kern/imgact_aout.c | 13 | ||||
-rw-r--r-- | sys/kern/imgact_gzip.c | 13 | ||||
-rw-r--r-- | sys/kern/kern_malloc.c | 14 | ||||
-rw-r--r-- | sys/kern/subr_param.c | 4 |
22 files changed, 125 insertions, 127 deletions
diff --git a/sys/amd64/amd64/autoconf.c b/sys/amd64/amd64/autoconf.c index 2e29703ef89d..aec1b54c03c5 100644 --- a/sys/amd64/amd64/autoconf.c +++ b/sys/amd64/amd64/autoconf.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 - * $Id: autoconf.c,v 1.50 1995/12/14 23:35:17 bde Exp $ + * $Id: autoconf.c,v 1.51 1995/12/16 18:52:05 peter Exp $ */ /* @@ -288,7 +288,7 @@ setdumpdev(dev) psize = bdevsw[maj]->d_psize(dev); if (psize == -1) return (ENXIO); /* XXX should be ENODEV ? */ - newdumplo = psize - Maxmem * NBPG / DEV_BSIZE; + newdumplo = psize - Maxmem * PAGE_SIZE / DEV_BSIZE; if (newdumplo < 0) return (ENOSPC); dumpdev = dev; diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c index 076a671a3a46..09ab5bf9813f 100644 --- a/sys/amd64/amd64/mem.c +++ b/sys/amd64/amd64/mem.c @@ -38,7 +38,7 @@ * * from: Utah $Hdr: mem.c 1.13 89/10/08$ * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 - * $Id: mem.c,v 1.32 1996/04/01 21:02:14 scrappy Exp $ + * $Id: mem.c,v 1.33 1996/04/07 14:59:26 bde Exp $ */ /* @@ -215,13 +215,13 @@ mmrw(dev, uio, flags) pmap_enter(kernel_pmap, (vm_offset_t)ptvmmap, v, uio->uio_rw == UIO_READ ? VM_PROT_READ : VM_PROT_WRITE, TRUE); - o = (int)uio->uio_offset & PGOFSET; - c = (u_int)(NBPG - ((int)iov->iov_base & PGOFSET)); - c = min(c, (u_int)(NBPG - o)); + o = (int)uio->uio_offset & PAGE_MASK; + c = (u_int)(PAGE_SIZE - ((int)iov->iov_base & PAGE_MASK)); + c = min(c, (u_int)(PAGE_SIZE - o)); c = min(c, (u_int)iov->iov_len); error = uiomove((caddr_t)&ptvmmap[o], (int)c, uio); pmap_remove(kernel_pmap, (vm_offset_t)ptvmmap, - (vm_offset_t)&ptvmmap[NBPG]); + (vm_offset_t)&ptvmmap[PAGE_SIZE]); continue; /* minor device 1 is kernel memory */ @@ -261,8 +261,8 @@ mmrw(dev, uio, flags) } if (buf == NULL) buf = (caddr_t) - malloc(CLBYTES, M_TEMP, M_WAITOK); - c = min(iov->iov_len, CLBYTES); + malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + c = min(iov->iov_len, PAGE_SIZE); poolsize = read_random(buf, c); if (poolsize == 0) { if (buf) @@ -281,8 +281,8 @@ mmrw(dev, uio, flags) } if (buf == NULL) buf = (caddr_t) - malloc(CLBYTES, M_TEMP, M_WAITOK); - c = min(iov->iov_len, CLBYTES); + malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + c = min(iov->iov_len, PAGE_SIZE); poolsize = read_random_unlimited(buf, c); c = min(c, poolsize); error = uiomove(buf, (int)c, uio); @@ -296,10 +296,10 @@ mmrw(dev, uio, flags) } if (buf == NULL) { buf = (caddr_t) - malloc(CLBYTES, M_TEMP, M_WAITOK); - bzero(buf, CLBYTES); + malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + bzero(buf, PAGE_SIZE); } - c = min(iov->iov_len, CLBYTES); + c = min(iov->iov_len, PAGE_SIZE); error = uiomove(buf, (int)c, uio); continue; diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index cfd2ddd88848..eb2a919aa64d 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.59 1996/04/18 21:34:28 phk Exp $ + * $Id: vm_machdep.c,v 1.60 1996/04/25 06:20:06 phk Exp $ */ #include "npx.h" @@ -92,7 +92,7 @@ static int bouncefree; #define SIXTEENMEG (4096*4096) #define MAXBKVA 1024 -int maxbkva = MAXBKVA*NBPG; +int maxbkva = MAXBKVA*PAGE_SIZE; /* special list that can be used at interrupt time for eventual kva free */ static struct kvasfree { @@ -210,7 +210,7 @@ more: if (!bmfreeing && kvasfreecnt) { bmfreeing = 1; for (i = 0; i < kvasfreecnt; i++) { - for(off=0;off<kvaf[i].size;off+=NBPG) { + for(off=0;off<kvaf[i].size;off+=PAGE_SIZE) { pmap_kremove( kvaf[i].addr + off); } kmem_free_wakeup(io_map, kvaf[i].addr, @@ -253,13 +253,13 @@ int count; vm_offset_t kva; vm_offset_t pa; if( bouncepages == 0) { - kva = (vm_offset_t) malloc(count*NBPG, M_TEMP, M_WAITOK); + kva = (vm_offset_t) malloc(count*PAGE_SIZE, M_TEMP, M_WAITOK); return kva; } - kva = vm_bounce_kva(count*NBPG, 1); + kva = vm_bounce_kva(count*PAGE_SIZE, 1); for(i=0;i<count;i++) { pa = vm_bounce_page_find(1); - pmap_kenter(kva + i * NBPG, pa); + pmap_kenter(kva + i * PAGE_SIZE, pa); } return kva; } @@ -279,10 +279,10 @@ vm_bounce_kva_alloc_free(kva, count) return; } for(i = 0; i < count; i++) { - pa = pmap_kextract(kva + i * NBPG); + pa = pmap_kextract(kva + i * PAGE_SIZE); vm_bounce_page_free(pa, 1); } - vm_bounce_kva_free(kva, count*NBPG, 0); + vm_bounce_kva_free(kva, count*PAGE_SIZE, 0); } /* @@ -329,7 +329,7 @@ vm_bounce_alloc(bp) vapstart = trunc_page(vastart); vapend = round_page(vaend); - countvmpg = (vapend - vapstart) / NBPG; + countvmpg = (vapend - vapstart) / PAGE_SIZE; /* * if any page is above 16MB, then go into bounce-buffer mode @@ -341,7 +341,7 @@ vm_bounce_alloc(bp) ++dobounceflag; if( pa == 0) panic("vm_bounce_alloc: Unmapped page"); - va += NBPG; + va += PAGE_SIZE; } if (dobounceflag == 0) return; @@ -352,7 +352,7 @@ vm_bounce_alloc(bp) /* * allocate a replacement kva for b_addr */ - kva = vm_bounce_kva(countvmpg*NBPG, 1); + kva = vm_bounce_kva(countvmpg*PAGE_SIZE, 1); #if 0 printf("%s: vapstart: %x, vapend: %x, countvmpg: %d, kva: %x ", (bp->b_flags & B_READ) ? "read":"write", @@ -366,7 +366,7 @@ vm_bounce_alloc(bp) * allocate a replacement page */ vm_offset_t bpa = vm_bounce_page_find(1); - pmap_kenter(kva + (NBPG * i), bpa); + pmap_kenter(kva + (PAGE_SIZE * i), bpa); #if 0 printf("r(%d): (%x,%x,%x) ", i, va, pa, bpa); #endif @@ -374,15 +374,15 @@ vm_bounce_alloc(bp) * if we are writing, the copy the data into the page */ if ((bp->b_flags & B_READ) == 0) { - bcopy((caddr_t) va, (caddr_t) kva + (NBPG * i), NBPG); + bcopy((caddr_t) va, (caddr_t) kva + (PAGE_SIZE * i), PAGE_SIZE); } } else { /* * use original page */ - pmap_kenter(kva + (NBPG * i), pa); + pmap_kenter(kva + (PAGE_SIZE * i), pa); } - va += NBPG; + va += PAGE_SIZE; } /* @@ -397,7 +397,7 @@ vm_bounce_alloc(bp) * put our new kva into the buffer (offset by original offset) */ bp->b_data = (caddr_t) (((vm_offset_t) kva) | - ((vm_offset_t) bp->b_savekva & (NBPG - 1))); + ((vm_offset_t) bp->b_savekva & PAGE_MASK)); #if 0 printf("b_savekva: %x, newva: %x\n", bp->b_savekva, bp->b_data); #endif @@ -482,7 +482,7 @@ vm_bounce_free(bp) bouncekvaend= round_page((vm_offset_t)bp->b_data + bp->b_bufsize); /* - printf("freeva: %d\n", (bouncekvaend - bouncekva) / NBPG); + printf("freeva: %d\n", (bouncekvaend - bouncekva) / PAGE_SIZE); */ vm_bounce_kva_free( bouncekva, (bouncekvaend - bouncekva), 0); bp->b_data = bp->b_savekva; @@ -522,7 +522,7 @@ vm_bounce_init() for(i=0;i<bouncepages;i++) { vm_offset_t pa; - if( (pa = pmap_kextract((vm_offset_t) bouncememory + i * NBPG)) >= SIXTEENMEG) + if( (pa = pmap_kextract((vm_offset_t) bouncememory + i * PAGE_SIZE)) >= SIXTEENMEG) panic("bounce memory out of range"); if( pa == 0) panic("bounce memory not resident"); @@ -753,7 +753,7 @@ vunmapbuf(bp) for (addr = (caddr_t)trunc_page((vm_offset_t) bp->b_data); addr < bp->b_data + bp->b_bufsize; - addr += NBPG) + addr += PAGE_SIZE) pmap_kremove((vm_offset_t) addr); bp->b_data = bp->b_saveaddr; @@ -764,7 +764,7 @@ vunmapbuf(bp) */ for (addr = (caddr_t)trunc_page((vm_offset_t) bp->b_data); addr < bp->b_data + bp->b_bufsize; - addr += NBPG) { + addr += PAGE_SIZE) { /* * release the data page */ @@ -793,7 +793,7 @@ cpu_reset() { #endif /* force a shutdown by unmapping entire address space ! */ - bzero((caddr_t) PTD, NBPG); + bzero((caddr_t) PTD, PAGE_SIZE); /* "good night, sweet prince .... <THUNK!>" */ pmap_update(); diff --git a/sys/amd64/isa/isa.c b/sys/amd64/isa/isa.c index 5b8f37aeea89..02fa63d2609e 100644 --- a/sys/amd64/isa/isa.c +++ b/sys/amd64/isa/isa.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - * $Id: isa.c,v 1.68 1996/04/11 21:18:43 bde Exp $ + * $Id: isa.c,v 1.69 1996/04/20 21:22:32 gibbs Exp $ */ /* @@ -838,7 +838,7 @@ isa_dmarangecheck(caddr_t va, u_int length, int chan) { u_int dma_pgmsk = (chan & 4) ? ~(128*1024-1) : ~(64*1024-1); endva = (vm_offset_t)round_page(va + length); - for (; va < (caddr_t) endva ; va += NBPG) { + for (; va < (caddr_t) endva ; va += PAGE_SIZE) { phys = trunc_page(pmap_extract(pmap_kernel(), (vm_offset_t)va)); #define ISARAM_END RAM_END if (phys == 0) @@ -846,7 +846,7 @@ isa_dmarangecheck(caddr_t va, u_int length, int chan) { if (phys >= ISARAM_END) return (1); if (priorpage) { - if (priorpage + NBPG != phys) + if (priorpage + PAGE_SIZE != phys) return (1); /* check if crossing a DMA page boundary */ if (((u_int)priorpage ^ (u_int)phys) & dma_pgmsk) diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index bbdb30318a42..61127711d81f 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_misc.c,v 1.17 1996/03/19 15:02:34 bde Exp $ + * $Id: linux_misc.c,v 1.18 1996/04/07 17:38:49 bde Exp $ */ #include <sys/param.h> @@ -279,7 +279,7 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args, int *retval) /* * Check various fields in header for validity/bounds. */ - if (a_out->a_text % NBPG || a_out->a_data % NBPG) { + if (a_out->a_text & PAGE_MASK || a_out->a_data & PAGE_MASK) { error = ENOEXEC; goto cleanup; } @@ -311,7 +311,7 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args, int *retval) * Currently we cannot handle misalinged file offsets, * and so we read in the entire image (what a waste). */ - if (file_offset & PGOFSET) { + if (file_offset & PAGE_MASK) { #ifdef DEBUG printf("uselib: Non page aligned binary %d\n", file_offset); #endif diff --git a/sys/conf/param.c b/sys/conf/param.c index 3de8e1152a8f..a49c1d023df4 100644 --- a/sys/conf/param.c +++ b/sys/conf/param.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)param.c 8.3 (Berkeley) 8/20/94 - * $Id: param.c,v 1.15 1996/03/02 18:23:57 peter Exp $ + * $Id: param.c,v 1.16 1996/03/11 05:52:50 hsu Exp $ */ #include "opt_sysvipc.h" @@ -103,7 +103,7 @@ int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */ */ #ifdef SYSVSHM #ifndef SHMMAX -#define SHMMAX (SHMMAXPGS*NBPG) +#define SHMMAX (SHMMAXPGS*PAGE_SIZE) #endif #ifndef SHMMIN #define SHMMIN 1 diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c index 5bf1751de966..e3b28cea026e 100644 --- a/sys/fs/cd9660/cd9660_vnops.c +++ b/sys/fs/cd9660/cd9660_vnops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)cd9660_vnops.c 8.3 (Berkeley) 1/23/94 - * $Id: cd9660_vnops.c,v 1.23 1995/12/03 17:14:38 bde Exp $ + * $Id: cd9660_vnops.c,v 1.24 1996/03/14 21:44:32 joerg Exp $ */ #include <sys/param.h> @@ -284,7 +284,7 @@ cd9660_getattr(ap) return (0); } -#if ISO_DEFAULT_BLOCK_SIZE >= NBPG +#if ISO_DEFAULT_BLOCK_SIZE >= PAGE_SIZE #ifdef DEBUG extern int doclusterread; #else diff --git a/sys/i386/boot/biosboot/boot.c b/sys/i386/boot/biosboot/boot.c index b32df606233c..90a638aea3d5 100644 --- a/sys/i386/boot/biosboot/boot.c +++ b/sys/i386/boot/biosboot/boot.c @@ -24,7 +24,7 @@ * the rights to redistribute these changes. * * from: Mach, [92/04/03 16:51:14 rvb] - * $Id: boot.c,v 1.47 1996/03/08 06:29:06 bde Exp $ + * $Id: boot.c,v 1.48 1996/04/07 14:28:00 bde Exp $ */ @@ -202,7 +202,7 @@ loadprog(void) /********************************************************/ /* Load the Initialised data after the text */ /********************************************************/ - while (addr & CLOFSET) + while (addr & PAGE_MASK) *(char *)addr++ = 0; printf("data=0x%x ", head.a_data); @@ -224,9 +224,9 @@ loadprog(void) addr += head.a_bss; /* Pad to a page boundary. */ - pad = (unsigned)addr % NBPG; + pad = (unsigned)addr & PAGE_MASK; if (pad != 0) { - pad = NBPG - pad; + pad = PAGE_SIZE - pad; addr += pad; } bootinfo.bi_symtab = addr; diff --git a/sys/i386/boot/netboot/main.c b/sys/i386/boot/netboot/main.c index bc8f48c5a353..0ff7c3d8934c 100644 --- a/sys/i386/boot/netboot/main.c +++ b/sys/i386/boot/netboot/main.c @@ -278,7 +278,7 @@ cfg_done: offset = N_TXTOFF(head); printf("text=0x%X, ",head.a_text); nfsload(head.a_text); - while (((int)loadpoint) & CLOFSET) + while (((int)loadpoint) & PAGE_MASK) *(loadpoint++) = 0; printf("data=0x%X, ",head.a_data); @@ -287,7 +287,7 @@ cfg_done: printf("bss=0x%X, ",head.a_bss); while(head.a_bss--) *(loadpoint++) = 0; - while (((int)loadpoint) & CLOFSET) + while (((int)loadpoint) & PAGE_MASK) *(loadpoint++) = 0; bootinfo.bi_symtab = (int) loadpoint; diff --git a/sys/i386/i386/autoconf.c b/sys/i386/i386/autoconf.c index 2e29703ef89d..aec1b54c03c5 100644 --- a/sys/i386/i386/autoconf.c +++ b/sys/i386/i386/autoconf.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 - * $Id: autoconf.c,v 1.50 1995/12/14 23:35:17 bde Exp $ + * $Id: autoconf.c,v 1.51 1995/12/16 18:52:05 peter Exp $ */ /* @@ -288,7 +288,7 @@ setdumpdev(dev) psize = bdevsw[maj]->d_psize(dev); if (psize == -1) return (ENXIO); /* XXX should be ENODEV ? */ - newdumplo = psize - Maxmem * NBPG / DEV_BSIZE; + newdumplo = psize - Maxmem * PAGE_SIZE / DEV_BSIZE; if (newdumplo < 0) return (ENOSPC); dumpdev = dev; diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c index 076a671a3a46..09ab5bf9813f 100644 --- a/sys/i386/i386/mem.c +++ b/sys/i386/i386/mem.c @@ -38,7 +38,7 @@ * * from: Utah $Hdr: mem.c 1.13 89/10/08$ * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 - * $Id: mem.c,v 1.32 1996/04/01 21:02:14 scrappy Exp $ + * $Id: mem.c,v 1.33 1996/04/07 14:59:26 bde Exp $ */ /* @@ -215,13 +215,13 @@ mmrw(dev, uio, flags) pmap_enter(kernel_pmap, (vm_offset_t)ptvmmap, v, uio->uio_rw == UIO_READ ? VM_PROT_READ : VM_PROT_WRITE, TRUE); - o = (int)uio->uio_offset & PGOFSET; - c = (u_int)(NBPG - ((int)iov->iov_base & PGOFSET)); - c = min(c, (u_int)(NBPG - o)); + o = (int)uio->uio_offset & PAGE_MASK; + c = (u_int)(PAGE_SIZE - ((int)iov->iov_base & PAGE_MASK)); + c = min(c, (u_int)(PAGE_SIZE - o)); c = min(c, (u_int)iov->iov_len); error = uiomove((caddr_t)&ptvmmap[o], (int)c, uio); pmap_remove(kernel_pmap, (vm_offset_t)ptvmmap, - (vm_offset_t)&ptvmmap[NBPG]); + (vm_offset_t)&ptvmmap[PAGE_SIZE]); continue; /* minor device 1 is kernel memory */ @@ -261,8 +261,8 @@ mmrw(dev, uio, flags) } if (buf == NULL) buf = (caddr_t) - malloc(CLBYTES, M_TEMP, M_WAITOK); - c = min(iov->iov_len, CLBYTES); + malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + c = min(iov->iov_len, PAGE_SIZE); poolsize = read_random(buf, c); if (poolsize == 0) { if (buf) @@ -281,8 +281,8 @@ mmrw(dev, uio, flags) } if (buf == NULL) buf = (caddr_t) - malloc(CLBYTES, M_TEMP, M_WAITOK); - c = min(iov->iov_len, CLBYTES); + malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + c = min(iov->iov_len, PAGE_SIZE); poolsize = read_random_unlimited(buf, c); c = min(c, poolsize); error = uiomove(buf, (int)c, uio); @@ -296,10 +296,10 @@ mmrw(dev, uio, flags) } if (buf == NULL) { buf = (caddr_t) - malloc(CLBYTES, M_TEMP, M_WAITOK); - bzero(buf, CLBYTES); + malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + bzero(buf, PAGE_SIZE); } - c = min(iov->iov_len, CLBYTES); + c = min(iov->iov_len, PAGE_SIZE); error = uiomove(buf, (int)c, uio); continue; diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index cfd2ddd88848..eb2a919aa64d 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.59 1996/04/18 21:34:28 phk Exp $ + * $Id: vm_machdep.c,v 1.60 1996/04/25 06:20:06 phk Exp $ */ #include "npx.h" @@ -92,7 +92,7 @@ static int bouncefree; #define SIXTEENMEG (4096*4096) #define MAXBKVA 1024 -int maxbkva = MAXBKVA*NBPG; +int maxbkva = MAXBKVA*PAGE_SIZE; /* special list that can be used at interrupt time for eventual kva free */ static struct kvasfree { @@ -210,7 +210,7 @@ more: if (!bmfreeing && kvasfreecnt) { bmfreeing = 1; for (i = 0; i < kvasfreecnt; i++) { - for(off=0;off<kvaf[i].size;off+=NBPG) { + for(off=0;off<kvaf[i].size;off+=PAGE_SIZE) { pmap_kremove( kvaf[i].addr + off); } kmem_free_wakeup(io_map, kvaf[i].addr, @@ -253,13 +253,13 @@ int count; vm_offset_t kva; vm_offset_t pa; if( bouncepages == 0) { - kva = (vm_offset_t) malloc(count*NBPG, M_TEMP, M_WAITOK); + kva = (vm_offset_t) malloc(count*PAGE_SIZE, M_TEMP, M_WAITOK); return kva; } - kva = vm_bounce_kva(count*NBPG, 1); + kva = vm_bounce_kva(count*PAGE_SIZE, 1); for(i=0;i<count;i++) { pa = vm_bounce_page_find(1); - pmap_kenter(kva + i * NBPG, pa); + pmap_kenter(kva + i * PAGE_SIZE, pa); } return kva; } @@ -279,10 +279,10 @@ vm_bounce_kva_alloc_free(kva, count) return; } for(i = 0; i < count; i++) { - pa = pmap_kextract(kva + i * NBPG); + pa = pmap_kextract(kva + i * PAGE_SIZE); vm_bounce_page_free(pa, 1); } - vm_bounce_kva_free(kva, count*NBPG, 0); + vm_bounce_kva_free(kva, count*PAGE_SIZE, 0); } /* @@ -329,7 +329,7 @@ vm_bounce_alloc(bp) vapstart = trunc_page(vastart); vapend = round_page(vaend); - countvmpg = (vapend - vapstart) / NBPG; + countvmpg = (vapend - vapstart) / PAGE_SIZE; /* * if any page is above 16MB, then go into bounce-buffer mode @@ -341,7 +341,7 @@ vm_bounce_alloc(bp) ++dobounceflag; if( pa == 0) panic("vm_bounce_alloc: Unmapped page"); - va += NBPG; + va += PAGE_SIZE; } if (dobounceflag == 0) return; @@ -352,7 +352,7 @@ vm_bounce_alloc(bp) /* * allocate a replacement kva for b_addr */ - kva = vm_bounce_kva(countvmpg*NBPG, 1); + kva = vm_bounce_kva(countvmpg*PAGE_SIZE, 1); #if 0 printf("%s: vapstart: %x, vapend: %x, countvmpg: %d, kva: %x ", (bp->b_flags & B_READ) ? "read":"write", @@ -366,7 +366,7 @@ vm_bounce_alloc(bp) * allocate a replacement page */ vm_offset_t bpa = vm_bounce_page_find(1); - pmap_kenter(kva + (NBPG * i), bpa); + pmap_kenter(kva + (PAGE_SIZE * i), bpa); #if 0 printf("r(%d): (%x,%x,%x) ", i, va, pa, bpa); #endif @@ -374,15 +374,15 @@ vm_bounce_alloc(bp) * if we are writing, the copy the data into the page */ if ((bp->b_flags & B_READ) == 0) { - bcopy((caddr_t) va, (caddr_t) kva + (NBPG * i), NBPG); + bcopy((caddr_t) va, (caddr_t) kva + (PAGE_SIZE * i), PAGE_SIZE); } } else { /* * use original page */ - pmap_kenter(kva + (NBPG * i), pa); + pmap_kenter(kva + (PAGE_SIZE * i), pa); } - va += NBPG; + va += PAGE_SIZE; } /* @@ -397,7 +397,7 @@ vm_bounce_alloc(bp) * put our new kva into the buffer (offset by original offset) */ bp->b_data = (caddr_t) (((vm_offset_t) kva) | - ((vm_offset_t) bp->b_savekva & (NBPG - 1))); + ((vm_offset_t) bp->b_savekva & PAGE_MASK)); #if 0 printf("b_savekva: %x, newva: %x\n", bp->b_savekva, bp->b_data); #endif @@ -482,7 +482,7 @@ vm_bounce_free(bp) bouncekvaend= round_page((vm_offset_t)bp->b_data + bp->b_bufsize); /* - printf("freeva: %d\n", (bouncekvaend - bouncekva) / NBPG); + printf("freeva: %d\n", (bouncekvaend - bouncekva) / PAGE_SIZE); */ vm_bounce_kva_free( bouncekva, (bouncekvaend - bouncekva), 0); bp->b_data = bp->b_savekva; @@ -522,7 +522,7 @@ vm_bounce_init() for(i=0;i<bouncepages;i++) { vm_offset_t pa; - if( (pa = pmap_kextract((vm_offset_t) bouncememory + i * NBPG)) >= SIXTEENMEG) + if( (pa = pmap_kextract((vm_offset_t) bouncememory + i * PAGE_SIZE)) >= SIXTEENMEG) panic("bounce memory out of range"); if( pa == 0) panic("bounce memory not resident"); @@ -753,7 +753,7 @@ vunmapbuf(bp) for (addr = (caddr_t)trunc_page((vm_offset_t) bp->b_data); addr < bp->b_data + bp->b_bufsize; - addr += NBPG) + addr += PAGE_SIZE) pmap_kremove((vm_offset_t) addr); bp->b_data = bp->b_saveaddr; @@ -764,7 +764,7 @@ vunmapbuf(bp) */ for (addr = (caddr_t)trunc_page((vm_offset_t) bp->b_data); addr < bp->b_data + bp->b_bufsize; - addr += NBPG) { + addr += PAGE_SIZE) { /* * release the data page */ @@ -793,7 +793,7 @@ cpu_reset() { #endif /* force a shutdown by unmapping entire address space ! */ - bzero((caddr_t) PTD, NBPG); + bzero((caddr_t) PTD, PAGE_SIZE); /* "good night, sweet prince .... <THUNK!>" */ pmap_update(); diff --git a/sys/i386/isa/aic6360.c b/sys/i386/isa/aic6360.c index f3ec95ab1b1e..db958a1b78f8 100644 --- a/sys/i386/isa/aic6360.c +++ b/sys/i386/isa/aic6360.c @@ -31,7 +31,7 @@ */ /* - * $Id: aic6360.c,v 1.19 1996/01/07 19:22:35 gibbs Exp $ + * $Id: aic6360.c,v 1.20 1996/03/10 07:04:43 gibbs Exp $ * * Acknowledgements: Many of the algorithms used in this driver are * inspired by the work of Julian Elischer (julian@tfs.com) and @@ -1067,8 +1067,8 @@ aic_minphys(bp) { AIC_TRACE(("aic_minphys\n")); - if (bp->b_bcount > (AIC_NSEG << PGSHIFT)) - bp->b_bcount = (AIC_NSEG << PGSHIFT); + if (bp->b_bcount > (AIC_NSEG << PAGE_SHIFT)) + bp->b_bcount = (AIC_NSEG << PAGE_SHIFT); } diff --git a/sys/i386/isa/isa.c b/sys/i386/isa/isa.c index 5b8f37aeea89..02fa63d2609e 100644 --- a/sys/i386/isa/isa.c +++ b/sys/i386/isa/isa.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - * $Id: isa.c,v 1.68 1996/04/11 21:18:43 bde Exp $ + * $Id: isa.c,v 1.69 1996/04/20 21:22:32 gibbs Exp $ */ /* @@ -838,7 +838,7 @@ isa_dmarangecheck(caddr_t va, u_int length, int chan) { u_int dma_pgmsk = (chan & 4) ? ~(128*1024-1) : ~(64*1024-1); endva = (vm_offset_t)round_page(va + length); - for (; va < (caddr_t) endva ; va += NBPG) { + for (; va < (caddr_t) endva ; va += PAGE_SIZE) { phys = trunc_page(pmap_extract(pmap_kernel(), (vm_offset_t)va)); #define ISARAM_END RAM_END if (phys == 0) @@ -846,7 +846,7 @@ isa_dmarangecheck(caddr_t va, u_int length, int chan) { if (phys >= ISARAM_END) return (1); if (priorpage) { - if (priorpage + NBPG != phys) + if (priorpage + PAGE_SIZE != phys) return (1); /* check if crossing a DMA page boundary */ if (((u_int)priorpage ^ (u_int)phys) & dma_pgmsk) diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c index e4570cbdebb6..1c7b54971275 100644 --- a/sys/i386/isa/wd.c +++ b/sys/i386/isa/wd.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)wd.c 7.2 (Berkeley) 5/9/91 - * $Id: wd.c,v 1.105 1996/03/27 18:49:54 bde Exp $ + * $Id: wd.c,v 1.106 1996/04/18 21:37:43 phk Exp $ */ /* TODO: @@ -1792,7 +1792,7 @@ wddump(dev_t dev) return (ENXIO); /* Size of memory to dump, in disk sectors. */ - num = (u_long)Maxmem * NBPG / du->dk_dd.d_secsize; + num = (u_long)Maxmem * PAGE_SIZE / du->dk_dd.d_secsize; secpertrk = du->dk_dd.d_nsectors; secpercyl = du->dk_dd.d_secpercyl; @@ -1906,11 +1906,11 @@ out: } if (du->dk_flags & DKFL_32BIT) outsl(du->dk_port + wd_data, - CADDR1 + ((int)addr & (NBPG - 1)), + CADDR1 + ((int)addr & PAGE_MASK), DEV_BSIZE / sizeof(long)); else outsw(du->dk_port + wd_data, - CADDR1 + ((int)addr & (NBPG - 1)), + CADDR1 + ((int)addr & PAGE_MASK), DEV_BSIZE / sizeof(short)); addr += DEV_BSIZE; if ((unsigned)addr % (1024 * 1024) == 0) diff --git a/sys/i386/linux/imgact_linux.c b/sys/i386/linux/imgact_linux.c index ea1b4c5f1065..cef58c57790a 100644 --- a/sys/i386/linux/imgact_linux.c +++ b/sys/i386/linux/imgact_linux.c @@ -28,7 +28,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: imgact_linux.c,v 1.13 1996/03/19 15:02:33 bde Exp $ + * $Id: imgact_linux.c,v 1.14 1996/05/01 02:42:32 bde Exp $ */ #include <sys/param.h> @@ -97,7 +97,7 @@ exec_linux_imgact(imgp) */ if (a_out->a_entry < virtual_offset || a_out->a_entry >= virtual_offset + a_out->a_text || - a_out->a_text % NBPG || a_out->a_data % NBPG) + a_out->a_text & PAGE_MASK || a_out->a_data & PAGE_MASK) return (-1); /* text + data can't exceed file size */ @@ -125,7 +125,7 @@ exec_linux_imgact(imgp) * Currently we cannot handle misalinged file offsets, * and so we read in the entire image (what a waste). */ - if (file_offset & PGOFSET) { + if (file_offset & PAGE_MASK) { #ifdef DEBUG printf("imgact: Non page aligned binary %d\n", file_offset); #endif diff --git a/sys/i386/linux/linux_misc.c b/sys/i386/linux/linux_misc.c index bbdb30318a42..61127711d81f 100644 --- a/sys/i386/linux/linux_misc.c +++ b/sys/i386/linux/linux_misc.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_misc.c,v 1.17 1996/03/19 15:02:34 bde Exp $ + * $Id: linux_misc.c,v 1.18 1996/04/07 17:38:49 bde Exp $ */ #include <sys/param.h> @@ -279,7 +279,7 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args, int *retval) /* * Check various fields in header for validity/bounds. */ - if (a_out->a_text % NBPG || a_out->a_data % NBPG) { + if (a_out->a_text & PAGE_MASK || a_out->a_data & PAGE_MASK) { error = ENOEXEC; goto cleanup; } @@ -311,7 +311,7 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args, int *retval) * Currently we cannot handle misalinged file offsets, * and so we read in the entire image (what a waste). */ - if (file_offset & PGOFSET) { + if (file_offset & PAGE_MASK) { #ifdef DEBUG printf("uselib: Non page aligned binary %d\n", file_offset); #endif diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c index 5bf1751de966..e3b28cea026e 100644 --- a/sys/isofs/cd9660/cd9660_vnops.c +++ b/sys/isofs/cd9660/cd9660_vnops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)cd9660_vnops.c 8.3 (Berkeley) 1/23/94 - * $Id: cd9660_vnops.c,v 1.23 1995/12/03 17:14:38 bde Exp $ + * $Id: cd9660_vnops.c,v 1.24 1996/03/14 21:44:32 joerg Exp $ */ #include <sys/param.h> @@ -284,7 +284,7 @@ cd9660_getattr(ap) return (0); } -#if ISO_DEFAULT_BLOCK_SIZE >= NBPG +#if ISO_DEFAULT_BLOCK_SIZE >= PAGE_SIZE #ifdef DEBUG extern int doclusterread; #else diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c index 9174d328f456..0455da5a08ed 100644 --- a/sys/kern/imgact_aout.c +++ b/sys/kern/imgact_aout.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: imgact_aout.c,v 1.26 1996/04/08 01:21:57 davidg Exp $ + * $Id: imgact_aout.c,v 1.27 1996/05/01 02:42:41 bde Exp $ */ #include <sys/param.h> @@ -80,14 +80,14 @@ exec_aout_imgact(imgp) case ZMAGIC: virtual_offset = 0; if (a_out->a_text) { - file_offset = NBPG; + file_offset = PAGE_SIZE; } else { /* Bill's "screwball mode" */ file_offset = 0; } break; case QMAGIC: - virtual_offset = NBPG; + virtual_offset = PAGE_SIZE; file_offset = 0; break; default: @@ -95,7 +95,7 @@ exec_aout_imgact(imgp) switch ((int)(ntohl(a_out->a_magic) & 0xffff)) { case ZMAGIC: case QMAGIC: - virtual_offset = NBPG; + virtual_offset = PAGE_SIZE; file_offset = 0; break; default: @@ -103,7 +103,7 @@ exec_aout_imgact(imgp) } } - bss_size = roundup(a_out->a_bss, NBPG); + bss_size = roundup(a_out->a_bss, PAGE_SIZE); /* * Check various fields in header for validity/bounds. @@ -113,8 +113,7 @@ exec_aout_imgact(imgp) a_out->a_entry >= virtual_offset + a_out->a_text || /* text and data size must each be page rounded */ - a_out->a_text % NBPG || - a_out->a_data % NBPG) + a_out->a_text & PAGE_MASK || a_out->a_data & PAGE_MASK) return (-1); /* text + data can't exceed file size */ diff --git a/sys/kern/imgact_gzip.c b/sys/kern/imgact_gzip.c index 83c15474f9db..5253e68eaaf4 100644 --- a/sys/kern/imgact_gzip.c +++ b/sys/kern/imgact_gzip.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: imgact_gzip.c,v 1.20 1996/03/19 15:02:47 bde Exp $ + * $Id: imgact_gzip.c,v 1.21 1996/05/01 02:42:50 bde Exp $ * * This module handles execution of a.out files which have been run through * "gzip". This saves diskspace, but wastes cpu-cycles and VM. @@ -148,14 +148,14 @@ do_aout_hdr(struct imgact_gzip * gz) case ZMAGIC: gz->virtual_offset = 0; if (gz->a_out.a_text) { - gz->file_offset = NBPG; + gz->file_offset = PAGE_SIZE; } else { /* Bill's "screwball mode" */ gz->file_offset = 0; } break; case QMAGIC: - gz->virtual_offset = NBPG; + gz->virtual_offset = PAGE_SIZE; gz->file_offset = 0; break; default: @@ -163,7 +163,7 @@ do_aout_hdr(struct imgact_gzip * gz) switch ((int) (ntohl(gz->a_out.a_magic) & 0xffff)) { case ZMAGIC: case QMAGIC: - gz->virtual_offset = NBPG; + gz->virtual_offset = PAGE_SIZE; gz->file_offset = 0; break; default: @@ -172,7 +172,7 @@ do_aout_hdr(struct imgact_gzip * gz) } } - gz->bss_size = roundup(gz->a_out.a_bss, NBPG); + gz->bss_size = roundup(gz->a_out.a_bss, PAGE_SIZE); /* * Check various fields in header for validity/bounds. @@ -182,8 +182,7 @@ do_aout_hdr(struct imgact_gzip * gz) gz->a_out.a_entry >= gz->virtual_offset + gz->a_out.a_text || /* text and data size must each be page rounded */ - gz->a_out.a_text % NBPG || - gz->a_out.a_data % NBPG) { + gz->a_out.a_text & PAGE_MASK || gz->a_out.a_data & PAGE_MASK) { gz->where = __LINE__; return (-1); } diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 033d913299d3..3bd77215fb81 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94 - * $Id: kern_malloc.c,v 1.18 1996/01/29 09:58:34 davidg Exp $ + * $Id: kern_malloc.c,v 1.19 1996/01/29 11:12:37 davidg Exp $ */ #include <sys/param.h> @@ -138,7 +138,7 @@ malloc(size, type, flags) if (kbp->kb_next == NULL) { kbp->kb_last = NULL; if (size > MAXALLOCSAVE) - allocsize = roundup(size, CLBYTES); + allocsize = roundup(size, PAGE_SIZE); else allocsize = 1 << indx; npg = clrnd(btoc(allocsize)); @@ -287,8 +287,8 @@ free(addr, type) * Check for returns of data that do not point to the * beginning of the allocation. */ - if (size > NBPG * CLSIZE) - alloc = addrmask[BUCKETINDX(NBPG * CLSIZE)]; + if (size > PAGE_SIZE) + alloc = addrmask[BUCKETINDX(PAGE_SIZE)]; else alloc = addrmask[kup->ku_indx]; if (((u_long)addr & alloc) != 0) @@ -377,7 +377,7 @@ kmeminit(dummy) #if (MAXALLOCSAVE > MINALLOCSIZE * 32768) ERROR!_kmeminit:_MAXALLOCSAVE_too_big #endif -#if (MAXALLOCSAVE < CLBYTES) +#if (MAXALLOCSAVE < PAGE_SIZE) ERROR!_kmeminit:_MAXALLOCSAVE_too_small #endif npg = (nmbclusters * MCLBYTES + VM_KMEM_SIZE) / PAGE_SIZE; @@ -389,10 +389,10 @@ kmeminit(dummy) FALSE); #ifdef KMEMSTATS for (indx = 0; indx < MINBUCKET + 16; indx++) { - if (1 << indx >= CLBYTES) + if (1 << indx >= PAGE_SIZE) bucket[indx].kb_elmpercl = 1; else - bucket[indx].kb_elmpercl = CLBYTES / (1 << indx); + bucket[indx].kb_elmpercl = PAGE_SIZE / (1 << indx); bucket[indx].kb_highwat = 5 * bucket[indx].kb_elmpercl; } /* diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c index 3de8e1152a8f..a49c1d023df4 100644 --- a/sys/kern/subr_param.c +++ b/sys/kern/subr_param.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)param.c 8.3 (Berkeley) 8/20/94 - * $Id: param.c,v 1.15 1996/03/02 18:23:57 peter Exp $ + * $Id: param.c,v 1.16 1996/03/11 05:52:50 hsu Exp $ */ #include "opt_sysvipc.h" @@ -103,7 +103,7 @@ int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */ */ #ifdef SYSVSHM #ifndef SHMMAX -#define SHMMAX (SHMMAXPGS*NBPG) +#define SHMMAX (SHMMAXPGS*PAGE_SIZE) #endif #ifndef SHMMIN #define SHMMIN 1 |