Another sweep over the pmap/vm macros, this time with more focus on

the usage.  I'm not satisfied with the naming, but now at least there is
less bogus stuff around.
This commit is contained in:
Poul-Henning Kamp 1996-05-03 21:01:54 +00:00
parent 5903c0ce22
commit aa8de40ae5
23 changed files with 72 additions and 92 deletions

View File

@ -23,7 +23,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: db_interface.c,v 1.17 1995/12/10 13:36:25 phk Exp $
* $Id: db_interface.c,v 1.18 1996/04/07 18:34:59 bde Exp $
*/
/*
@ -225,8 +225,8 @@ db_write_bytes(addr, size, data)
oldmap0 = *ptep0;
*(int *)ptep0 |= /* INTEL_PTE_WRITE */ PG_RW;
addr1 = i386_trunc_page(addr + size - 1);
if (i386_trunc_page(addr) != addr1) {
addr1 = trunc_page(addr + size - 1);
if (trunc_page(addr) != addr1) {
/* data crosses a page boundary */
ptep1 = pmap_pte(kernel_pmap, addr1);

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.187 1996/05/02 14:19:47 phk Exp $
* $Id: machdep.c,v 1.188 1996/05/02 22:24:57 phk Exp $
*/
#include "npx.h"
@ -341,7 +341,7 @@ cpu_startup(dummy)
bouncepages = 64;
bouncepages += ((Maxmem - 4096) / 2048) * 32;
}
v = (caddr_t)((vm_offset_t)((vm_offset_t)v + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1));
v = (caddr_t)((vm_offset_t)round_page(v));
valloc(bouncememory, char, bouncepages * PAGE_SIZE);
}
#endif

View File

@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
* from: @(#)pmap.c 7.7 (Berkeley) 5/12/91
* $Id: pmap.c,v 1.87 1996/05/02 14:19:52 phk Exp $
* $Id: pmap.c,v 1.88 1996/05/02 22:24:58 phk Exp $
*/
/*
@ -630,14 +630,14 @@ pmap_growkernel(vm_offset_t addr)
kernel_vm_end = KERNBASE;
nkpt = 0;
while (pdir_pde(PTD, kernel_vm_end)) {
kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG) & ~(PAGE_SIZE * NPTEPG - 1);
kernel_vm_end = (kernel_vm_end + NBPDR) & ~(NBPDR-1);
++nkpt;
}
}
addr = (addr + PAGE_SIZE * NPTEPG) & ~(PAGE_SIZE * NPTEPG - 1);
addr = (addr + NBPDR) & ~(NBPDR - 1);
while (kernel_vm_end < addr) {
if (pdir_pde(PTD, kernel_vm_end)) {
kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG) & ~(PAGE_SIZE * NPTEPG - 1);
kernel_vm_end = (kernel_vm_end + NBPDR) & ~(NBPDR-1);
continue;
}
++nkpt;
@ -659,7 +659,7 @@ pmap_growkernel(vm_offset_t addr)
}
}
*pmap_pde(kernel_pmap, kernel_vm_end) = pdir_pde(PTD, kernel_vm_end);
kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG) & ~(PAGE_SIZE * NPTEPG - 1);
kernel_vm_end = (kernel_vm_end + NBPDR) & ~(NBPDR-1);
}
splx(s);
}
@ -839,8 +839,7 @@ init_pv_entries(npg)
* kvm space is fairly cheap, be generous!!! (the system can panic if
* this is too small.)
*/
npvvapg = ((npg * PVSPERPAGE) * sizeof(struct pv_entry)
+ PAGE_SIZE - 1) / PAGE_SIZE;
npvvapg = btoc((npg * PVSPERPAGE) * sizeof(struct pv_entry));
pvva = kmem_alloc_pageable(kernel_map, npvvapg * PAGE_SIZE);
/*
* get the first batch of entries

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: support.s,v 1.33 1996/04/06 01:06:06 davidg Exp $
* $Id: support.s,v 1.34 1996/05/02 14:19:53 phk Exp $
*/
#include "assym.s" /* system definitions */
@ -414,7 +414,7 @@ ENTRY(copyout) /* copyout(from_kernel, to_user, len) */
*/
/* compute number of pages */
movl %edi,%ecx
andl $PAGE_SIZE-1,%ecx
andl $PAGE_MASK,%ecx
addl %ebx,%ecx
decl %ecx
shrl $IDXSHIFT+2,%ecx

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: support.s,v 1.33 1996/04/06 01:06:06 davidg Exp $
* $Id: support.s,v 1.34 1996/05/02 14:19:53 phk Exp $
*/
#include "assym.s" /* system definitions */
@ -414,7 +414,7 @@ ENTRY(copyout) /* copyout(from_kernel, to_user, len) */
*/
/* compute number of pages */
movl %edi,%ecx
andl $PAGE_SIZE-1,%ecx
andl $PAGE_MASK,%ecx
addl %ebx,%ecx
decl %ecx
shrl $IDXSHIFT+2,%ecx

View File

@ -21,7 +21,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: if_de.c,v 1.44 1996/03/23 19:29:09 fenner Exp $
* $Id: if_de.c,v 1.45 1996/05/02 14:20:44 phk Exp $
*
*/
@ -1301,7 +1301,7 @@ tulip_start(
do {
int len = m0->m_len;
caddr_t addr = mtod(m0, caddr_t);
unsigned clsize = PAGE_SIZE - (((u_long) addr) & (PAGE_SIZE-1));
unsigned clsize = PAGE_SIZE - (((u_long) addr) & PAGE_MASK);
next_m0 = m0->m_next;
while (len > 0) {

View File

@ -23,7 +23,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: db_interface.c,v 1.17 1995/12/10 13:36:25 phk Exp $
* $Id: db_interface.c,v 1.18 1996/04/07 18:34:59 bde Exp $
*/
/*
@ -225,8 +225,8 @@ db_write_bytes(addr, size, data)
oldmap0 = *ptep0;
*(int *)ptep0 |= /* INTEL_PTE_WRITE */ PG_RW;
addr1 = i386_trunc_page(addr + size - 1);
if (i386_trunc_page(addr) != addr1) {
addr1 = trunc_page(addr + size - 1);
if (trunc_page(addr) != addr1) {
/* data crosses a page boundary */
ptep1 = pmap_pte(kernel_pmap, addr1);

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.187 1996/05/02 14:19:47 phk Exp $
* $Id: machdep.c,v 1.188 1996/05/02 22:24:57 phk Exp $
*/
#include "npx.h"
@ -341,7 +341,7 @@ cpu_startup(dummy)
bouncepages = 64;
bouncepages += ((Maxmem - 4096) / 2048) * 32;
}
v = (caddr_t)((vm_offset_t)((vm_offset_t)v + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1));
v = (caddr_t)((vm_offset_t)round_page(v));
valloc(bouncememory, char, bouncepages * PAGE_SIZE);
}
#endif

View File

@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
* from: @(#)pmap.c 7.7 (Berkeley) 5/12/91
* $Id: pmap.c,v 1.87 1996/05/02 14:19:52 phk Exp $
* $Id: pmap.c,v 1.88 1996/05/02 22:24:58 phk Exp $
*/
/*
@ -630,14 +630,14 @@ pmap_growkernel(vm_offset_t addr)
kernel_vm_end = KERNBASE;
nkpt = 0;
while (pdir_pde(PTD, kernel_vm_end)) {
kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG) & ~(PAGE_SIZE * NPTEPG - 1);
kernel_vm_end = (kernel_vm_end + NBPDR) & ~(NBPDR-1);
++nkpt;
}
}
addr = (addr + PAGE_SIZE * NPTEPG) & ~(PAGE_SIZE * NPTEPG - 1);
addr = (addr + NBPDR) & ~(NBPDR - 1);
while (kernel_vm_end < addr) {
if (pdir_pde(PTD, kernel_vm_end)) {
kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG) & ~(PAGE_SIZE * NPTEPG - 1);
kernel_vm_end = (kernel_vm_end + NBPDR) & ~(NBPDR-1);
continue;
}
++nkpt;
@ -659,7 +659,7 @@ pmap_growkernel(vm_offset_t addr)
}
}
*pmap_pde(kernel_pmap, kernel_vm_end) = pdir_pde(PTD, kernel_vm_end);
kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG) & ~(PAGE_SIZE * NPTEPG - 1);
kernel_vm_end = (kernel_vm_end + NBPDR) & ~(NBPDR-1);
}
splx(s);
}
@ -839,8 +839,7 @@ init_pv_entries(npg)
* kvm space is fairly cheap, be generous!!! (the system can panic if
* this is too small.)
*/
npvvapg = ((npg * PVSPERPAGE) * sizeof(struct pv_entry)
+ PAGE_SIZE - 1) / PAGE_SIZE;
npvvapg = btoc((npg * PVSPERPAGE) * sizeof(struct pv_entry));
pvva = kmem_alloc_pageable(kernel_map, npvvapg * PAGE_SIZE);
/*
* get the first batch of entries

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: support.s,v 1.33 1996/04/06 01:06:06 davidg Exp $
* $Id: support.s,v 1.34 1996/05/02 14:19:53 phk Exp $
*/
#include "assym.s" /* system definitions */
@ -414,7 +414,7 @@ ENTRY(copyout) /* copyout(from_kernel, to_user, len) */
*/
/* compute number of pages */
movl %edi,%ecx
andl $PAGE_SIZE-1,%ecx
andl $PAGE_MASK,%ecx
addl %ebx,%ecx
decl %ecx
shrl $IDXSHIFT+2,%ecx

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)param.h 5.8 (Berkeley) 6/28/91
* $Id: param.h,v 1.20 1996/05/02 14:20:02 phk Exp $
* $Id: param.h,v 1.21 1996/05/02 22:25:17 phk Exp $
*/
#ifndef _MACHINE_PARAM_H_
@ -92,14 +92,6 @@
/*
* Some macros for units conversion
*/
/* Core clicks (4096 bytes) to segments and vice versa */
#define ctos(x) (x)
#define stoc(x) (x)
/* Core clicks (4096 bytes) to disk blocks */
#define ctod(x) ((x)<<(PAGE_SHIFT-DEV_BSHIFT))
#define dtoc(x) ((x)>>(PAGE_SHIFT-DEV_BSHIFT))
#define dtob(x) ((x)<<DEV_BSHIFT)
/* clicks to bytes */
#define ctob(x) ((x)<<PAGE_SHIFT)
@ -129,12 +121,6 @@
#define atop(x) ((unsigned)(x) >> PAGE_SHIFT)
#define ptoa(x) ((unsigned)(x) << PAGE_SHIFT)
#define i386_round_pdr(x) ((((unsigned)(x)) + NBPDR - 1) & ~(NBPDR-1))
#define i386_trunc_pdr(x) ((unsigned)(x) & ~(NBPDR-1))
#define i386_round_page(x) ((((unsigned)(x)) + PAGE_MASK) & ~PAGE_MASK)
#define i386_trunc_page(x) ((unsigned)(x) & ~PAGE_MASK)
#define i386_btod(x) ((unsigned)(x) >> PDRSHIFT)
#define i386_dtob(x) ((unsigned)(x) << PDRSHIFT)
#define i386_btop(x) ((unsigned)(x) >> PAGE_SHIFT)
#define i386_ptob(x) ((unsigned)(x) << PAGE_SHIFT)

View File

@ -1,4 +1,4 @@
/* $Id: sysv_shm.c,v 1.18 1996/02/23 18:49:18 peter Exp $ */
/* $Id: sysv_shm.c,v 1.19 1996/05/02 14:20:26 phk Exp $ */
/* $NetBSD: sysv_shm.c,v 1.23 1994/07/04 23:25:12 glass Exp $ */
/*
@ -141,7 +141,7 @@ shm_deallocate_segment(shmseg)
size_t size;
shm_handle = shmseg->shm_internal;
size = (shmseg->shm_segsz + PAGE_SIZE-1) & ~(PAGE_SIZE-1);
size = round_page(shmseg->shm_segsz);
(void) vm_map_remove(sysvshm_map, shm_handle->kva, shm_handle->kva + size);
free((caddr_t)shm_handle, M_SHM);
shmseg->shm_internal = NULL;
@ -161,7 +161,7 @@ shm_delete_mapping(p, shmmap_s)
segnum = IPCID_TO_IX(shmmap_s->shmid);
shmseg = &shmsegs[segnum];
size = (shmseg->shm_segsz + PAGE_SIZE-1) & ~(PAGE_SIZE-1);
size = round_page(shmseg->shm_segsz);
result = vm_map_remove(&p->p_vmspace->vm_map, shmmap_s->va, shmmap_s->va + size);
if (result != KERN_SUCCESS)
return EINVAL;
@ -246,7 +246,7 @@ shmat(p, uap, retval)
}
if (i >= shminfo.shmseg)
return EMFILE;
size = (shmseg->shm_segsz + PAGE_SIZE-1) & ~(PAGE_SIZE-1);
size = round_page(shmseg->shm_segsz);
prot = VM_PROT_READ;
if ((uap->shmflg & SHM_RDONLY) == 0)
prot |= VM_PROT_WRITE;
@ -463,7 +463,7 @@ shmget_allocate_segment(p, uap, mode, retval)
return EINVAL;
if (shm_nused >= shminfo.shmmni) /* any shmids left? */
return ENOSPC;
size = (shmseg->shm_segsz + PAGE_SIZE-1) & ~(PAGE_SIZE-1);
size = round_page(shmseg->shm_segsz);
if (shm_committed + btoc(size) > shminfo.shmall)
return ENOMEM;
if (shm_last_free < 0) {

View File

@ -18,7 +18,7 @@
* 5. Modifications may be freely made to this file if the above conditions
* are met.
*
* $Id: vfs_bio.c,v 1.87 1996/03/03 01:04:28 dyson Exp $
* $Id: vfs_bio.c,v 1.88 1996/03/09 06:46:51 dyson Exp $
*/
/*
@ -735,7 +735,6 @@ static struct buf *
getnewbuf(int slpflag, int slptimeo, int doingvmio)
{
struct buf *bp;
int s;
int nbyteswritten = 0;
start:
@ -858,7 +857,6 @@ struct buf *
incore(struct vnode * vp, daddr_t blkno)
{
struct buf *bp;
struct bufhashhdr *bh;
int s = splbio();
bp = gbincore(vp, blkno);
@ -1255,7 +1253,7 @@ allocbuf(struct buf * bp, int size)
bytesinpage = newbsize - toff;
if ((bp->b_flags & B_CACHE) &&
!vm_page_is_valid(m,
(vm_offset_t) ((toff + off) & (PAGE_SIZE - 1)),
(vm_offset_t) ((toff + off) & PAGE_MASK),
bytesinpage)) {
bp->b_flags &= ~B_CACHE;
}
@ -1296,7 +1294,7 @@ allocbuf(struct buf * bp, int size)
bytesinpage = newbsize - toff;
if ((bp->b_flags & B_CACHE) &&
!vm_page_is_valid(m,
(vm_offset_t) ((toff + off) & (PAGE_SIZE - 1)),
(vm_offset_t) ((toff + off) & PAGE_MASK),
bytesinpage)) {
bp->b_flags &= ~B_CACHE;
}
@ -1309,7 +1307,7 @@ allocbuf(struct buf * bp, int size)
bp->b_npages = curbpnpages;
pmap_qenter((vm_offset_t) bp->b_data,
bp->b_pages, bp->b_npages);
((vm_offset_t) bp->b_data) |= off & (PAGE_SIZE - 1);
((vm_offset_t) bp->b_data) |= off & PAGE_MASK;
}
}
}
@ -1434,7 +1432,7 @@ biodone(register struct buf * bp)
*/
if ((bp->b_flags & B_READ) && !bogusflag && resid > 0) {
vm_page_set_validclean(m,
(vm_offset_t) (foff & (PAGE_SIZE-1)), resid);
(vm_offset_t) (foff & PAGE_MASK), resid);
}
/*
@ -1449,7 +1447,7 @@ biodone(register struct buf * bp)
(int) m->pindex, (int)(foff >> 32),
(int) foff & 0xffffffff, resid, i);
if (vp->v_type != VBLK)
printf(" iosize: %d, lblkno: %d, flags: 0x%lx, npages: %d\n",
printf(" iosize: %ld, lblkno: %d, flags: 0x%lx, npages: %d\n",
bp->b_vp->v_mount->mnt_stat.f_iosize,
(int) bp->b_lblkno,
bp->b_flags, bp->b_npages);
@ -1614,7 +1612,7 @@ vfs_busy_pages(struct buf * bp, int clear_modify)
if (clear_modify) {
vm_page_protect(m, VM_PROT_READ);
vm_page_set_validclean(m,
(vm_offset_t) (foff & (PAGE_SIZE-1)), resid);
(vm_offset_t) (foff & PAGE_MASK), resid);
} else if (bp->b_bcount >= PAGE_SIZE) {
if (m->valid && (bp->b_flags & B_CACHE) == 0) {
bp->b_pages[i] = bogus_page;
@ -1654,7 +1652,7 @@ vfs_clean_pages(struct buf * bp)
resid = iocount;
if (resid > 0) {
vm_page_set_validclean(m,
((vm_offset_t) foff & (PAGE_SIZE-1)), resid);
((vm_offset_t) foff & PAGE_MASK), resid);
}
foff += resid;
iocount -= resid;

View File

@ -21,7 +21,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: if_de.c,v 1.44 1996/03/23 19:29:09 fenner Exp $
* $Id: if_de.c,v 1.45 1996/05/02 14:20:44 phk Exp $
*
*/
@ -1301,7 +1301,7 @@ tulip_start(
do {
int len = m0->m_len;
caddr_t addr = mtod(m0, caddr_t);
unsigned clsize = PAGE_SIZE - (((u_long) addr) & (PAGE_SIZE-1));
unsigned clsize = PAGE_SIZE - (((u_long) addr) & PAGE_MASK);
next_m0 = m0->m_next;
while (len > 0) {

View File

@ -1509,8 +1509,7 @@ meteor_ioctl(dev_t dev, int cmd, caddr_t arg, int flag, struct proc *pr)
return(EINVAL);
/* meteor_mem structure is on the page after the data */
mem = mtr->mem = (struct meteor_mem *) (mtr->bigbuf +
((mtr->frame_size *
mtr->frames+PAGE_SIZE-1)/PAGE_SIZE)*PAGE_SIZE);
(round_page(mtr->frame_size * mtr->frames)));
mtr->current = 1;
mtr->synch_wait = 0;
mem->num_bufs = mtr->frames;
@ -1599,7 +1598,7 @@ meteor_ioctl(dev_t dev, int cmd, caddr_t arg, int flag, struct proc *pr)
/* meteor_mem structure for SYNC Capture */
if (geo->frames > 1) temp += PAGE_SIZE;
temp = (temp + PAGE_SIZE -1)/PAGE_SIZE;
temp = btoc(temp);
if (temp > mtr->alloc_pages
#ifdef METEOR_TEST_VIDEO
&& mtr->video.addr == 0

View File

@ -1,6 +1,6 @@
/**************************************************************************
**
** $Id: ncr.c,v 1.70 1996/04/07 17:32:33 bde Exp $
** $Id: ncr.c,v 1.71 1996/05/02 14:20:47 phk Exp $
**
** Device driver for the NCR 53C810 PCI-SCSI-Controller.
**
@ -1254,7 +1254,7 @@ static void ncr_attach (pcici_t tag, int unit);
static char ident[] =
"\n$Id: ncr.c,v 1.70 1996/04/07 17:32:33 bde Exp $\n";
"\n$Id: ncr.c,v 1.71 1996/05/02 14:20:47 phk Exp $\n";
static u_long ncr_version = NCR_VERSION * 11
+ (u_long) sizeof (struct ncb) * 7
@ -6425,7 +6425,7 @@ static int ncr_scatter
free = MAX_SCATTER - 1;
if (vaddr & (PAGE_SIZE-1)) free -= datalen / PAGE_SIZE;
if (vaddr & PAGE_MASK) free -= datalen / PAGE_SIZE;
if (free>1)
while ((chunk * free >= 2 * datalen) && (chunk>=1024))
@ -6454,7 +6454,7 @@ static int ncr_scatter
/*
** continue this segment
*/
pnext = (paddr & (~(PAGE_SIZE - 1))) + PAGE_SIZE;
pnext = (paddr & (~PAGE_MASK)) + PAGE_SIZE;
/*
** Compute max size

View File

@ -8,7 +8,7 @@
* file.
*
* Written by Julian Elischer (julian@dialix.oz.au)
* $Id: scsi_base.c,v 1.36 1996/03/10 07:13:07 gibbs Exp $
* $Id: scsi_base.c,v 1.37 1996/03/31 03:19:06 gibbs Exp $
*/
#include "opt_bounce.h"
@ -515,7 +515,7 @@ scsi_scsi_cmd(sc_link, scsi_cmd, cmdlen, data_addr, datalen,
goto bad;
}
#ifdef BOUNCE_BUFFERS
xs->data = (caddr_t) vm_bounce_kva_alloc( (datalen + PAGE_SIZE - 1)/PAGE_SIZE);
xs->data = (caddr_t) vm_bounce_kva_alloc(btoc(datalen));
#else
xs->data = malloc(datalen, M_TEMP, M_WAITOK);
#endif
@ -604,7 +604,7 @@ scsi_scsi_cmd(sc_link, scsi_cmd, cmdlen, data_addr, datalen,
}
#ifdef BOUNCE_BUFFERS
vm_bounce_kva_alloc_free((vm_offset_t) xs->data,
(datalen + PAGE_SIZE - 1)/PAGE_SIZE);
btoc(datalen));
#else
free(xs->data, M_TEMP);
#endif

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)device_pager.c 8.1 (Berkeley) 6/11/93
* $Id: device_pager.c,v 1.20 1996/01/19 03:59:38 dyson Exp $
* $Id: device_pager.c,v 1.21 1996/03/09 06:54:41 dyson Exp $
*/
#include <sys/param.h>
@ -119,7 +119,7 @@ dev_pager_alloc(handle, size, prot, foff)
/*
* Offset should be page aligned.
*/
if (foff & (PAGE_SIZE - 1))
if (foff & PAGE_MASK)
return (NULL);
/*

View File

@ -39,7 +39,7 @@
* from: Utah $Hdr: swap_pager.c 1.4 91/04/30$
*
* @(#)swap_pager.c 8.9 (Berkeley) 3/21/94
* $Id: swap_pager.c,v 1.63 1996/03/06 04:31:46 dyson Exp $
* $Id: swap_pager.c,v 1.64 1996/05/02 14:21:14 phk Exp $
*/
/*
@ -304,13 +304,13 @@ swap_pager_alloc(handle, size, prot, offset)
* rip support of "named anonymous regions" out altogether.
*/
object = vm_object_allocate(OBJT_SWAP,
OFF_TO_IDX(offset + PAGE_SIZE - 1) + size);
OFF_TO_IDX(offset + PAGE_MASK) + size);
object->handle = handle;
(void) swap_pager_swp_alloc(object, M_WAITOK);
}
} else {
object = vm_object_allocate(OBJT_SWAP,
OFF_TO_IDX(offset + PAGE_SIZE - 1) + size);
OFF_TO_IDX(offset + PAGE_MASK) + size);
(void) swap_pager_swp_alloc(object, M_WAITOK);
}

View File

@ -61,7 +61,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: vm_map.c,v 1.42 1996/04/03 05:23:38 dyson Exp $
* $Id: vm_map.c,v 1.43 1996/04/29 22:04:57 dyson Exp $
*/
/*
@ -214,7 +214,7 @@ vmspace_alloc(min, max, pageable)
if (mapvmpgcnt == 0 && mapvm == 0) {
int s;
mapvmpgcnt = (cnt.v_page_count * sizeof(struct vm_map_entry) + PAGE_SIZE - 1) / PAGE_SIZE;
mapvmpgcnt = btoc(cnt.v_page_count * sizeof(struct vm_map_entry));
s = splhigh();
mapvm_start = mapvm = kmem_alloc_pageable(kernel_map, mapvmpgcnt * PAGE_SIZE);
mapvmmax = mapvm_start + mapvmpgcnt * PAGE_SIZE;

View File

@ -38,7 +38,7 @@
* from: Utah $Hdr: vm_mmap.c 1.6 91/10/21$
*
* @(#)vm_mmap.c 8.4 (Berkeley) 1/12/94
* $Id: vm_mmap.c,v 1.39 1996/03/12 02:27:20 dyson Exp $
* $Id: vm_mmap.c,v 1.40 1996/03/16 15:00:05 davidg Exp $
*/
/*
@ -767,7 +767,7 @@ vm_mmap(map, addr, size, prot, maxprot, flags, handle, foff)
docow = MAP_COPY_ON_WRITE;
if (objsize < size) {
object2 = vm_object_allocate( OBJT_DEFAULT,
OFF_TO_IDX(size - (foff & ~(PAGE_SIZE - 1))));
OFF_TO_IDX(size - (foff & ~PAGE_MASK)));
object2->backing_object = object;
object2->backing_object_offset = foff;
TAILQ_INSERT_TAIL(&object->shadow_head,

View File

@ -61,7 +61,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: vm_pager.c,v 1.20 1995/12/11 04:58:29 dyson Exp $
* $Id: vm_pager.c,v 1.21 1995/12/14 09:55:11 phk Exp $
*/
/*
@ -143,7 +143,6 @@ vm_pager_bufferinit()
}
bp->b_rcred = bp->b_wcred = NOCRED;
bp->b_vnbufs.le_next = NOLIST;
bp->b_actf = NULL;
swapbkva = kmem_alloc_pageable(pager_map, nswbuf * MAXPHYS);
if (!swapbkva)

View File

@ -38,7 +38,7 @@
* SUCH DAMAGE.
*
* from: @(#)vnode_pager.c 7.5 (Berkeley) 4/20/91
* $Id: vnode_pager.c,v 1.58 1996/01/19 04:00:31 dyson Exp $
* $Id: vnode_pager.c,v 1.59 1996/03/19 05:13:22 dyson Exp $
*/
/*
@ -295,10 +295,10 @@ vnode_pager_setsize(vp, nsize)
*/
if (nsize < object->un_pager.vnp.vnp_size) {
vm_ooffset_t nsizerounded;
nsizerounded = IDX_TO_OFF(OFF_TO_IDX(nsize + PAGE_SIZE - 1));
nsizerounded = IDX_TO_OFF(OFF_TO_IDX(nsize + PAGE_MASK));
if (nsizerounded < object->un_pager.vnp.vnp_size) {
vm_object_page_remove(object,
OFF_TO_IDX(nsize + PAGE_SIZE - 1),
OFF_TO_IDX(nsize + PAGE_MASK),
OFF_TO_IDX(object->un_pager.vnp.vnp_size),
FALSE);
}
@ -320,7 +320,7 @@ vnode_pager_setsize(vp, nsize)
}
}
object->un_pager.vnp.vnp_size = nsize;
object->size = OFF_TO_IDX(nsize + PAGE_SIZE - 1);
object->size = OFF_TO_IDX(nsize + PAGE_MASK);
}
void
@ -518,9 +518,9 @@ vnode_pager_input_smlfs(object, m)
if (error)
break;
vm_page_set_validclean(m, (i * bsize) & (PAGE_SIZE-1), bsize);
vm_page_set_validclean(m, (i * bsize) & PAGE_MASK, bsize);
} else {
vm_page_set_validclean(m, (i * bsize) & (PAGE_SIZE-1), bsize);
vm_page_set_validclean(m, (i * bsize) & PAGE_MASK, bsize);
bzero((caddr_t) kva + i * bsize, bsize);
}
}
@ -897,7 +897,7 @@ vnode_pager_leaf_putpages(object, m, count, sync, rtvals)
maxsize = object->un_pager.vnp.vnp_size - poffset;
else
maxsize = 0;
ncount = (maxsize + PAGE_SIZE - 1) / PAGE_SIZE;
ncount = btoc(maxsize);
if (ncount < count) {
for (i = ncount; i < count; i++) {
rtvals[i] = VM_PAGER_BAD;