allow an offset to *really* be passed in for mmap's on devices.

From Julian Elischer.
This commit is contained in:
cgd 1993-10-02 00:00:21 +00:00
parent 89ec54d834
commit 95e5868ee2
4 changed files with 15 additions and 12 deletions

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)device_pager.c 7.2 (Berkeley) 4/20/91
* $Id: device_pager.c,v 1.4 1993/08/30 07:09:20 deraadt Exp $
* $Id: device_pager.c,v 1.5 1993/10/02 00:00:21 cgd Exp $
*/
/*
@ -74,10 +74,11 @@ dev_pager_init()
}
vm_pager_t
dev_pager_alloc(handle, size, prot)
dev_pager_alloc(handle, size, prot, start_off)
caddr_t handle;
vm_size_t size;
vm_prot_t prot;
int start_off;
{
dev_t dev;
vm_pager_t pager;
@ -120,7 +121,7 @@ dev_pager_alloc(handle, size, prot)
if (prot & VM_PROT_EXECUTE)
nprot |= PROT_EXEC;
npages = atop(round_page(size));
for (off = 0; npages--; off += PAGE_SIZE)
for (off = start_off; npages--; off += PAGE_SIZE)
if ((*mapfunc)(dev, off, nprot) == -1)
return(NULL);
/*
@ -146,10 +147,11 @@ dev_pager_alloc(handle, size, prot)
npages = devp->devp_npages;
object = devp->devp_object = vm_object_allocate(ptoa(npages));
vm_object_enter(object, pager);
vm_object_setpager(object, pager, (vm_offset_t)0, FALSE);
vm_object_setpager(object, pager, (vm_offset_t)start_off,
FALSE);
devp->devp_pages = (vm_page_t)
kmem_alloc(kernel_map, npages*sizeof(struct vm_page));
off = 0;
off = start_off;
for (page = devp->devp_pages;
page < &devp->devp_pages[npages]; page++) {
vm_object_lock(object);

View File

@ -37,7 +37,7 @@
*
* from: Utah Hdr: vm_mmap.c 1.3 90/01/21
* from: @(#)vm_mmap.c 7.5 (Berkeley) 6/28/91
* $Id: vm_mmap.c,v 1.11 1993/08/01 19:26:40 mycroft Exp $
* $Id: vm_mmap.c,v 1.12 1993/10/02 00:00:22 cgd Exp $
*/
/*
@ -489,7 +489,7 @@ vm_mmap(map, addr, size, prot, maxprot, flags, handle, foff)
} else
type = PG_VNODE;
}
pager = vm_pager_allocate(type, handle, size, prot);
pager = vm_pager_allocate(type, handle, size, prot, foff);
if (pager == NULL)
return (type == PG_DEVICE ? EINVAL : ENOMEM);
/*

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)vm_pageout.c 7.4 (Berkeley) 5/7/91
* $Id: vm_pageout.c,v 1.4 1993/05/20 03:59:40 cgd Exp $
* $Id: vm_pageout.c,v 1.5 1993/10/02 00:00:23 cgd Exp $
*
*
* Copyright (c) 1987, 1990 Carnegie-Mellon University.
@ -243,7 +243,8 @@ vm_pageout_scan()
pager = vm_pager_allocate(PG_DFLT,
(caddr_t)0,
object->size,
VM_PROT_ALL);
VM_PROT_ALL,
0);
if (pager != NULL) {
vm_object_setpager(object,
pager, 0, FALSE);

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)vm_pager.c 7.4 (Berkeley) 5/7/91
* $Id: vm_pager.c,v 1.6 1993/08/30 07:09:25 deraadt Exp $
* $Id: vm_pager.c,v 1.7 1993/10/02 00:00:24 cgd Exp $
*
*
* Copyright (c) 1987, 1990 Carnegie-Mellon University.
@ -132,7 +132,7 @@ vm_pager_init()
* Allocate an instance of a pager of the given type.
*/
vm_pager_t
vm_pager_allocate(type, handle, size, prot)
vm_pager_allocate(type, handle, size, prot, off)
int type;
caddr_t handle;
vm_size_t size;
@ -142,7 +142,7 @@ vm_pager_allocate(type, handle, size, prot)
struct pagerops *ops;
ops = (type == PG_DFLT) ? dfltpagerops : pagertab[type];
return((*ops->pgo_alloc)(handle, size, prot));
return((*ops->pgo_alloc)(handle, size, prot, off));
}
void