Add vm_map_find_aligned(9).
Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D24652
This commit is contained in:
parent
60cd9c95c5
commit
7a9f2da33c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=365516
@ -1980,6 +1980,19 @@ vm_map_alignspace(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
vm_map_find_aligned(vm_map_t map, vm_offset_t *addr, vm_size_t length,
|
||||||
|
vm_offset_t max_addr, vm_offset_t alignment)
|
||||||
|
{
|
||||||
|
/* XXXKIB ASLR eh ? */
|
||||||
|
*addr = vm_map_findspace(map, *addr, length);
|
||||||
|
if (*addr + length > vm_map_max(map) ||
|
||||||
|
(max_addr != 0 && *addr + length > max_addr))
|
||||||
|
return (KERN_NO_SPACE);
|
||||||
|
return (vm_map_alignspace(map, NULL, 0, addr, length, max_addr,
|
||||||
|
alignment));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* vm_map_find finds an unallocated region in the target address
|
* vm_map_find finds an unallocated region in the target address
|
||||||
* map with the given length. The search is defined to be
|
* map with the given length. The search is defined to be
|
||||||
|
@ -460,6 +460,8 @@ int vm_map_find(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *, vm_size_t,
|
|||||||
vm_offset_t, int, vm_prot_t, vm_prot_t, int);
|
vm_offset_t, int, vm_prot_t, vm_prot_t, int);
|
||||||
int vm_map_find_min(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *,
|
int vm_map_find_min(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *,
|
||||||
vm_size_t, vm_offset_t, vm_offset_t, int, vm_prot_t, vm_prot_t, int);
|
vm_size_t, vm_offset_t, vm_offset_t, int, vm_prot_t, vm_prot_t, int);
|
||||||
|
int vm_map_find_aligned(vm_map_t map, vm_offset_t *addr, vm_size_t length,
|
||||||
|
vm_offset_t max_addr, vm_offset_t alignment);
|
||||||
int vm_map_fixed(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, vm_size_t,
|
int vm_map_fixed(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, vm_size_t,
|
||||||
vm_prot_t, vm_prot_t, int);
|
vm_prot_t, vm_prot_t, int);
|
||||||
vm_offset_t vm_map_findspace(vm_map_t, vm_offset_t, vm_size_t);
|
vm_offset_t vm_map_findspace(vm_map_t, vm_offset_t, vm_size_t);
|
||||||
|
Loading…
Reference in New Issue
Block a user