Struct zfi::BootServices
source · #[repr(C)]pub struct BootServices { /* private fields */ }
Expand description
Represents an EFI_BOOT_SERVICES
.
Implementations§
source§impl BootServices
impl BootServices
sourcepub fn allocate_pages(
&self,
at: AllocateType,
mt: MemoryType,
pages: usize,
addr: u64
) -> Result<Pages, Status>
pub fn allocate_pages( &self, at: AllocateType, mt: MemoryType, pages: usize, addr: u64 ) -> Result<Pages, Status>
Allocates memory pages from the system.
sourcepub unsafe fn free_pages(
&self,
base: *mut u8,
pages: usize
) -> Result<(), Status>
pub unsafe fn free_pages( &self, base: *mut u8, pages: usize ) -> Result<(), Status>
Safety
base
must be allocated with [allocate_pages()
].
sourcepub fn get_memory_map(&self) -> Result<(Vec<MemoryDescriptor>, usize), Status>
pub fn get_memory_map(&self) -> Result<(Vec<MemoryDescriptor>, usize), Status>
Returns the current memory map. A common mistake when using this method to get a key to
invoke [exit_boot_services()
] is discarding the result, which will cause the vector to
drop and memory map will be changed.
sourcepub fn allocate_pool(
&self,
ty: MemoryType,
size: usize
) -> Result<*mut u8, Status>
pub fn allocate_pool( &self, ty: MemoryType, size: usize ) -> Result<*mut u8, Status>
All allocations are eight-byte aligned.
sourcepub unsafe fn free_pool(&self, mem: *mut u8) -> Result<(), Status>
pub unsafe fn free_pool(&self, mem: *mut u8) -> Result<(), Status>
Safety
mem
must be allocated by [allocate_pool()
].
sourcepub fn locate_device_path<'a>(
&self,
proto: &Guid,
path: &'a Path
) -> Result<(&'static Device, &'a Path), Status>
pub fn locate_device_path<'a>( &self, proto: &Guid, path: &'a Path ) -> Result<(&'static Device, &'a Path), Status>
Locates the handle to a device on the device path that supports the specified protocol.
sourcepub unsafe fn exit_boot_services(&self, map_key: usize) -> Result<(), Status>
pub unsafe fn exit_boot_services(&self, map_key: usize) -> Result<(), Status>
Terminates all boot services.
Safety
Once this method is returned any functions provided by ZFI will not be usable. Beware of any functions that are automatically called by Rust (e.g. when the value is dropped)! Usually this method will be called right before transfering the control to the OS kernel.
sourcepub unsafe fn get_protocol(
&self,
handle: *const (),
proto: &Guid
) -> Option<*const ()>
pub unsafe fn get_protocol( &self, handle: *const (), proto: &Guid ) -> Option<*const ()>
Safety
This method don’t check anything so the caller is responsible to make sure all arguments is
valid for EFI_BOOT_SERVICES.OpenProtocol()
.
sourcepub unsafe fn open_protocol(
&self,
handle: *const (),
proto: &Guid,
agent: *const (),
controller: *const (),
attrs: OpenProtocolAttributes
) -> Result<*const (), Status>
pub unsafe fn open_protocol( &self, handle: *const (), proto: &Guid, agent: *const (), controller: *const (), attrs: OpenProtocolAttributes ) -> Result<*const (), Status>
Safety
This method don’t check anything so the caller is responsible to make sure all arguments is
valid for EFI_BOOT_SERVICES.OpenProtocol()
.