fn populate_allocator(info: &dyn boot::Info, image_address: u64, image_size: u64) {
    for i in 0..info.num_entries() {
        let entry = info.entry(i);
        if entry.entry_type == boot::E820Entry::RAM_TYPE {
            ALLOCATOR.borrow_mut().add_initial_allocation(
                MemoryType::ConventionalMemory,
                entry.size / PAGE_SIZE,
                entry.addr,
                efi::MEMORY_WB,
            );
        }
    }

    // Add ourselves
    ALLOCATOR.borrow_mut().allocate_pages(
        AllocateType::AllocateAddress,
        MemoryType::RuntimeServicesCode,
        1024 * 1024 / PAGE_SIZE,
        1024 * 1024,
    );

    // Add the loaded binary
    ALLOCATOR.borrow_mut().allocate_pages(
        AllocateType::AllocateAddress,
        MemoryType::LoaderCode,
        image_size / PAGE_SIZE,
        image_address,
    );
}
// Populate allocator from E820, fixed ranges for the firmware and the loaded binary.
Populate allocator from E820, fixed ranges for the firmware and the loaded binary.
Populate allocator from E820 fixed ranges for the firmware and the loaded binary .
fn populate_allocator(info: &dyn boot::Info, image_address: u64, image_size: u64) {
    for i in 0..info.num_entries() {
        let entry = info.entry(i);
        if entry.entry_type == boot::E820Entry::RAM_TYPE {
            ALLOCATOR.borrow_mut().add_initial_allocation(
                MemoryType::ConventionalMemory,
                entry.size / PAGE_SIZE,
                entry.addr,
                efi::MEMORY_WB,
            );
        }
    }
    // Add ourselves
    ALLOCATOR.borrow_mut().allocate_pages(
        AllocateType::AllocateAddress,
        MemoryType::RuntimeServicesCode,
        1024 * 1024 / PAGE_SIZE,
        1024 * 1024,
    );
    // Add the loaded binary
    ALLOCATOR.borrow_mut().allocate_pages(
        AllocateType::AllocateAddress,
        MemoryType::LoaderCode,
        image_size / PAGE_SIZE,
        image_address,
    );
}
fn populate_allocator ( info : & dyn boot :: Info , image_address : u64 , image_size : u64 ) { for i in 0 .. info . num_entries ( ) { let entry = info . entry ( i ) ; if entry . entry_type == boot :: E820Entry :: RAM_TYPE { ALLOCATOR . borrow_mut ( ) . add_initial_allocation ( MemoryType :: ConventionalMemory , entry . size / PAGE_SIZE , entry . addr , efi :: MEMORY_WB , ) ; } } // Add ourselves ALLOCATOR . borrow_mut ( ) . allocate_pages ( AllocateType :: AllocateAddress , MemoryType :: RuntimeServicesCode , 1024 * 1024 / PAGE_SIZE , 1024 * 1024 , ) ; // Add the loaded binary ALLOCATOR . borrow_mut ( ) . allocate_pages ( AllocateType :: AllocateAddress , MemoryType :: LoaderCode , image_size / PAGE_SIZE , image_address , ) ; }
Populate allocator from E820, fixed ranges for the firmware and the loaded binary.
Populate allocator from E820 fixed ranges for the firmware and the loaded binary .
info
&dyn boot::Info
image_address
u64
image_size
u64
info
&dyn boot::Info
image_address
u64
image_size
u64