pub fn new<'a>(segments: impl Iterator<Item = ProgramHeader<'a>>) -> Self {
        let mut used = UsedLevel4Entries {
            entry_state: [false; 512],
        };

        used.entry_state[0] = true; // TODO: Can we do this dynamically?

        for segment in segments {
            let start_page: Page = Page::containing_address(VirtAddr::new(segment.virtual_addr()));
            let end_page: Page = Page::containing_address(VirtAddr::new(
                segment.virtual_addr() + segment.mem_size(),
            ));

            for p4_index in u64::from(start_page.p4_index())..=u64::from(end_page.p4_index()) {
                used.entry_state[p4_index as usize] = true;
            }
        }

        used
    }
/// Initializes a new instance from the given ELF program segments.
///
/// Marks the virtual address range of all segments as used.
Initializes a new instance from the given ELF program segments.
Marks the virtual address range of all segments as used.
Initializes a new instance from the given ELF program segments . Marks the virtual address range of all segments as used .
pub fn new<'a>(segments: impl Iterator<Item = ProgramHeader<'a>>) -> Self {
        let mut used = UsedLevel4Entries {
            entry_state: [false; 512],
        };
        used.entry_state[0] = true; // TODO: Can we do this dynamically?
        for segment in segments {
            let start_page: Page = Page::containing_address(VirtAddr::new(segment.virtual_addr()));
            let end_page: Page = Page::containing_address(VirtAddr::new(
                segment.virtual_addr() + segment.mem_size(),
            ));
            for p4_index in u64::from(start_page.p4_index())..=u64::from(end_page.p4_index()) {
                used.entry_state[p4_index as usize] = true;
            }
        }
        used
    }
pub fn new < ' a > ( segments : impl Iterator < Item = ProgramHeader < ' a > > ) -> Self { let mut used = UsedLevel4Entries { entry_state : [ false ; 512 ] , } ; used . entry_state [ 0 ] = true ; // TODO: Can we do this dynamically? for segment in segments { let start_page : Page = Page :: containing_address ( VirtAddr :: new ( segment . virtual_addr ( ) ) ) ; let end_page : Page = Page :: containing_address ( VirtAddr :: new ( segment . virtual_addr ( ) + segment . mem_size ( ) , ) ) ; for p4_index in u64 :: from ( start_page . p4_index ( ) ) ..= u64 :: from ( end_page . p4_index ( ) ) { used . entry_state [ p4_index as usize ] = true ; } } used }
Initializes a new instance from the given ELF program segments.
Initializes a new instance from the given ELF program segments .
segments
impl Iterator<Item = ProgramHeader<'a>>
segments
impl Iterator<Item = ProgramHeader<'a>>