Function memory::create_contiguous_mapping
source · pub fn create_contiguous_mapping<F: Into<PteFlagsArch>>(
size_in_bytes: usize,
flags: F
) -> Result<(MappedPages, PhysicalAddress), &'static str>
Expand description
A convenience function that creates a new memory mapping by allocating frames that are contiguous in physical memory.
If contiguous frames are not required, then see create_mapping()
.
Returns a tuple containing the new MappedPages
and the starting PhysicalAddress of the first frame,
which is a convenient way to get the physical address without walking the page tables.
Locking / Deadlock
Currently, this function acquires the lock on the frame allocator and the kernel’s MemoryManagementInfo
instance.
Thus, the caller should ensure that the locks on those two variables are not held when invoking this function.