vmar_allocate - allocate a new subregion
#include <magenta/syscalls.h> mx_status_t mx_vmar_allocate(mx_handle_t parent_vmar_handle, size_t offset, size_t size, uint32_t map_flags, mx_handle_t* child_vmar, uintptr_t* child_addr)
Creates a new VMAR within the one specified by parent_vmar_handle.
map_flags is a bit vector of the following flags:
offset must be 0 if map_flags does not have MX_VM_FLAG_SPECIFIC set.
vmar_allocate() returns MX_OK, the absolute base address of the subregion (via child_addr), and a handle to the new subregion (via child_vmar) on success. In the event of failure, a negative error value is returned.
MX_ERR_BAD_HANDLE parent_vmar_handle is not a valid handle.
MX_ERR_WRONG_TYPE parent_vmar_handle is not a VMAR handle.
MX_ERR_BAD_STATE parent_vmar_handle refers to a destroyed VMAR.
MX_ERR_INVALID_ARGS child_vmar or child_addr are not valid, offset is non-zero when MX_VM_FLAG_SPECIFIC is not given, offset and size describe an unsatisfiable allocation due to exceeding the region bounds, offset or size is not page-aligned, or size is 0.
MX_ERR_NO_MEMORY (Temporary) Failure due to lack of memory.
MX_ERR_ACCESS_DENIED Insufficient privileges to make the requested allocation.
The kernel interprets this flag as a request to reduce sprawl in allocations. While this does not necessitate reducing the absolute entropy of the allocated addresses, there will potentially be a very high correlation between allocations. This is a trade-off that the developer can make to increase locality of allocations and reduce the number of page tables necessary, if they are willing to have certain addresses be more correlated.