pub struct UsedLevel4Entries { /* private fields */ }
Expand description
Keeps track of used entries in a level 4 page table.
Useful for determining a free virtual memory block, e.g. for mapping additional data.
Implementations§
Source§impl UsedLevel4Entries
impl UsedLevel4Entries
Sourcepub fn new(
max_phys_addr: PhysAddr,
regions_len: usize,
framebuffer: Option<&RawFrameBufferInfo>,
config: &BootloaderConfig,
) -> Self
pub fn new( max_phys_addr: PhysAddr, regions_len: usize, framebuffer: Option<&RawFrameBufferInfo>, config: &BootloaderConfig, ) -> Self
Initializes a new instance.
Marks the statically configured virtual address ranges from the config as used.
Sourcepub fn mark_segments<'a>(
&mut self,
segments: impl Iterator<Item = ProgramHeader<'a>>,
virtual_address_offset: VirtualAddressOffset,
)
pub fn mark_segments<'a>( &mut self, segments: impl Iterator<Item = ProgramHeader<'a>>, virtual_address_offset: VirtualAddressOffset, )
Marks the virtual address range of all segments as used.
Sourcepub fn get_free_entries(&mut self, num: u64) -> PageTableIndex
pub fn get_free_entries(&mut self, num: u64) -> PageTableIndex
Returns the first index of a num
contiguous unused level 4 entries and marks them as
used. If CONFIG.aslr
is enabled, this will return random contiguous available entries.
Since this method marks each returned index as used, it can be used multiple times to determine multiple unused virtual memory regions.
Sourcepub fn get_free_address(&mut self, size: u64, alignment: u64) -> VirtAddr
pub fn get_free_address(&mut self, size: u64, alignment: u64) -> VirtAddr
Returns a virtual address in one or more unused level 4 entries and marks them as used.
This function calls [get_free_entries
] internally, so all of its docs applies here
too.