Skip to content

can't get size of memory_map when it's a failed Result #1539

@balenamiaa

Description

@balenamiaa

In case the status is Status::BUFFER_TOO_SMALL, map_size should be available. Perhaps through the Error's optional ErrData? Also, memory_map_size is internal, so, the only way seems to be directly using the raw methods in the boot table.

let memory_map = loop {
    let mut memory_map = uefi::boot::memory_map(MemoryType::LOADER_DATA);
    log::info!("memory_map: {:?}", memory_map);

    match memory_map {
        Ok(e) => break e,
        Err(e) => {
            if e.status() == Status::BUFFER_TOO_SMALL {
                log::info!("Buffer too small. Allocating more memory...");
                let memory_map_size = ???;
                memory_map = uefi::boot::allocate_pool(MemoryType::LOADER_DATA, ???);
            }
        }
    }
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions