fn acquire_allocate_pages(regions: &HeapRegionState, pages: usize, align: usize)
    -> Result<VirtualAddress, ()> {

    // Allocate virtual from the free_virtual list and acquire and map physical
    // pages.
    let alloc_start = allocate_pages_from(
        &regions.free_virtual, pages, align).ok_or(())?;

    // Map the pages
    let map_res = kernel_acquire_and_map(
        alloc_start as *mut u8,
        pages,
        |acq| {
            regions.alloc_physical.push(Node::new(acq));
        }
    );

    if !map_res.is_ok() {
        return Err(());
    }

    // We successfully allocated!
    Ok(alloc_start)
}
/// Always acquire fresh physical pages and allocate them.
Always acquire fresh physical pages and allocate them.
Always acquire fresh physical pages and allocate them .
fn acquire_allocate_pages(regions: &HeapRegionState, pages: usize, align: usize)
    -> Result<VirtualAddress, ()> {
    // Allocate virtual from the free_virtual list and acquire and map physical
    // pages.
    let alloc_start = allocate_pages_from(
        &regions.free_virtual, pages, align).ok_or(())?;
    // Map the pages
    let map_res = kernel_acquire_and_map(
        alloc_start as *mut u8,
        pages,
        |acq| {
            regions.alloc_physical.push(Node::new(acq));
        }
    );
    if !map_res.is_ok() {
        return Err(());
    }
    // We successfully allocated!
    Ok(alloc_start)
}
fn acquire_allocate_pages ( regions : & HeapRegionState , pages : usize , align : usize ) -> Result < VirtualAddress , ( ) > { // Allocate virtual from the free_virtual list and acquire and map physical // pages. let alloc_start = allocate_pages_from ( & regions . free_virtual , pages , align ) . ok_or ( ( ) ) ? ; // Map the pages let map_res = kernel_acquire_and_map ( alloc_start as * mut u8 , pages , | acq | { regions . alloc_physical . push ( Node :: new ( acq ) ) ; } ) ; if ! map_res . is_ok ( ) { return Err ( ( ) ) ; } // We successfully allocated! Ok ( alloc_start ) }
Always acquire fresh physical pages and allocate them.
Always acquire fresh physical pages and allocate them .
regions
&HeapRegionState
pages
usize
align
usize