1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-02 12:20:51 +00:00

Pass the size of the mapping to contigmapping() as a "vm_size_t" rather

than a "vm_pindex_t".  A "vm_size_t" is more convenient for it to use.
This commit is contained in:
Alan Cox 2009-06-17 07:11:38 +00:00
parent 7ca3f45cd2
commit 2d59a004af
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=194337

View File

@ -194,35 +194,31 @@ vm_page_release_contig(vm_page_t m, vm_pindex_t count)
* before they are mapped.
*/
static void *
contigmapping(vm_page_t m, vm_pindex_t npages, int flags)
contigmapping(vm_map_t map, vm_size_t size, vm_page_t m, int flags)
{
vm_object_t object = kernel_object;
vm_map_t map = kernel_map;
vm_offset_t addr, tmp_addr;
vm_pindex_t i;
vm_map_lock(map);
if (vm_map_findspace(map, vm_map_min(map), npages << PAGE_SHIFT, &addr)
!= KERN_SUCCESS) {
if (vm_map_findspace(map, vm_map_min(map), size, &addr)) {
vm_map_unlock(map);
return (NULL);
}
vm_object_reference(object);
vm_map_insert(map, object, addr - VM_MIN_KERNEL_ADDRESS,
addr, addr + (npages << PAGE_SHIFT), VM_PROT_ALL, VM_PROT_ALL, 0);
addr, addr + size, VM_PROT_ALL, VM_PROT_ALL, 0);
vm_map_unlock(map);
tmp_addr = addr;
VM_OBJECT_LOCK(object);
for (i = 0; i < npages; i++) {
vm_page_insert(&m[i], object,
for (tmp_addr = addr; tmp_addr < addr + size; tmp_addr += PAGE_SIZE) {
vm_page_insert(m, object,
OFF_TO_IDX(tmp_addr - VM_MIN_KERNEL_ADDRESS));
if ((flags & M_ZERO) && !(m[i].flags & PG_ZERO))
pmap_zero_page(&m[i]);
m[i].valid = VM_PAGE_BITS_ALL;
tmp_addr += PAGE_SIZE;
if ((flags & M_ZERO) && (m->flags & PG_ZERO) == 0)
pmap_zero_page(m);
m->valid = VM_PAGE_BITS_ALL;
m++;
}
VM_OBJECT_UNLOCK(object);
vm_map_wire(map, addr, addr + (npages << PAGE_SHIFT),
vm_map_wire(map, addr, addr + size,
VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES);
return ((void *)addr);
}
@ -242,7 +238,8 @@ contigmalloc(
unsigned long npgs;
int actl, actmax, inactl, inactmax, tries;
npgs = round_page(size) >> PAGE_SHIFT;
size = round_page(size);
npgs = size >> PAGE_SHIFT;
tries = 0;
retry:
pages = vm_phys_alloc_contig(npgs, low, high, alignment, boundary);
@ -270,7 +267,7 @@ contigmalloc(
}
ret = NULL;
} else {
ret = contigmapping(pages, npgs, flags);
ret = contigmapping(kernel_map, size, pages, flags);
if (ret == NULL)
vm_page_release_contig(pages, npgs);
else