pub struct AddressSpaceManager {
address_space: ArrayVec<AddressRange, MAX_ADDRESS_RANGES>,
vtl2_pool: bool,
}
Fields§
§address_space: ArrayVec<AddressRange, MAX_ADDRESS_RANGES>
Track the whole address space - this must be sorted.
vtl2_pool: bool
Track that the VTL2 GPA pool has at least one allocation.
Implementations§
Source§impl AddressSpaceManager
impl AddressSpaceManager
pub const fn new_const() -> Self
Sourcefn allocate_range(
&mut self,
index: usize,
len: u64,
usage: AddressUsage,
allocation_policy: AllocationPolicy,
) -> AllocatedRange
fn allocate_range( &mut self, index: usize, len: u64, usage: AddressUsage, allocation_policy: AllocationPolicy, ) -> AllocatedRange
Split a free range into two, with allocation policy deciding if we allocate the low part or high part.
Sourcepub fn allocate(
&mut self,
required_vnode: Option<u32>,
len: u64,
allocation_type: AllocationType,
allocation_policy: AllocationPolicy,
) -> Option<AllocatedRange>
pub fn allocate( &mut self, required_vnode: Option<u32>, len: u64, allocation_type: AllocationType, allocation_policy: AllocationPolicy, ) -> Option<AllocatedRange>
Allocate a new range of memory with the given type and policy. None is returned if the allocation was unable to be satisfied.
len
is the number of bytes to allocate. The number of bytes are
rounded up to the next 4K page size increment. if len
is 0, then
None
is returned.
required_vnode
if Some(u32)
is the vnode to allocate from. If there
are no free ranges left in that vnode, None is returned.
Sourcepub fn vtl2_ranges(
&self,
) -> impl Iterator<Item = (MemoryRange, MemoryVtlType)> + use<'_>
pub fn vtl2_ranges( &self, ) -> impl Iterator<Item = (MemoryRange, MemoryVtlType)> + use<'_>
Returns an iterator for all VTL2 ranges.
Sourcepub fn reserved_vtl2_ranges(
&self,
) -> impl Iterator<Item = (MemoryRange, ReservedMemoryType)> + use<'_>
pub fn reserved_vtl2_ranges( &self, ) -> impl Iterator<Item = (MemoryRange, ReservedMemoryType)> + use<'_>
Returns an iterator for reserved VTL2 ranges that should not be described as ram to the kernel.
Sourcepub fn has_vtl2_pool(&self) -> bool
pub fn has_vtl2_pool(&self) -> bool
Returns true if there are VTL2 pool allocations.