pub trait ImageLoad<R>where
R: GuestArch,{
// Required methods
fn isolation_config(&self) -> IsolationConfig;
fn create_parameter_area(
&mut self,
page_base: u64,
page_count: u32,
debug_tag: &str,
) -> Result<ParameterAreaIndex>;
fn create_parameter_area_with_data(
&mut self,
page_base: u64,
page_count: u32,
debug_tag: &str,
initial_data: &[u8],
) -> Result<ParameterAreaIndex>;
fn import_parameter(
&mut self,
parameter_area: ParameterAreaIndex,
byte_offset: u32,
parameter_type: IgvmParameterType,
) -> Result<()>;
fn import_pages(
&mut self,
page_base: u64,
page_count: u64,
debug_tag: &str,
acceptance: BootPageAcceptance,
data: &[u8],
) -> Result<()>;
fn import_vp_register(&mut self, register: R) -> Result<()>;
fn verify_startup_memory_available(
&mut self,
page_base: u64,
page_count: u64,
memory_type: StartupMemoryType,
) -> Result<()>;
fn set_vp_context_page(&mut self, page_base: u64) -> Result<()>;
fn relocation_region(
&mut self,
gpa: u64,
size_bytes: u64,
relocation_alignment: u64,
minimum_relocation_gpa: u64,
maximum_relocation_gpa: u64,
apply_rip_offset: bool,
apply_gdtr_offset: bool,
vp_index: u16,
) -> Result<()>;
fn page_table_relocation(
&mut self,
page_table_gpa: u64,
size_pages: u64,
used_pages: u64,
vp_index: u16,
) -> Result<()>;
fn set_imported_regions_config_page(&mut self, page_base: u64);
}
Required Methods§
Sourcefn isolation_config(&self) -> IsolationConfig
fn isolation_config(&self) -> IsolationConfig
Get the isolation configuration for this loader. This can be used by loaders to load different state depending on the platform.
Sourcefn create_parameter_area(
&mut self,
page_base: u64,
page_count: u32,
debug_tag: &str,
) -> Result<ParameterAreaIndex>
fn create_parameter_area( &mut self, page_base: u64, page_count: u32, debug_tag: &str, ) -> Result<ParameterAreaIndex>
Create a parameter area for the given page_base and page_count, which can be used to import parameters.
debug_tag
is a human readable string used by the loader to identify
this region for debugging and reporting.
Sourcefn create_parameter_area_with_data(
&mut self,
page_base: u64,
page_count: u32,
debug_tag: &str,
initial_data: &[u8],
) -> Result<ParameterAreaIndex>
fn create_parameter_area_with_data( &mut self, page_base: u64, page_count: u32, debug_tag: &str, initial_data: &[u8], ) -> Result<ParameterAreaIndex>
Create a parameter area for the given page_base, page_count, and initial_data which can be used to import parameters.
debug_tag
is a human readable string used by the loader to identify
this region for debugging and reporting.
Sourcefn import_parameter(
&mut self,
parameter_area: ParameterAreaIndex,
byte_offset: u32,
parameter_type: IgvmParameterType,
) -> Result<()>
fn import_parameter( &mut self, parameter_area: ParameterAreaIndex, byte_offset: u32, parameter_type: IgvmParameterType, ) -> Result<()>
Import an IGVM parameter into the given parameter area index at the given offset.
IGVM Parameters are used to specify where OS agnostic runtime dynamic information should be loaded into the guest memory space. This allows loaders to load a base IGVM file with a given measurement that can be specialized with runtime unmeasured parameters.
Sourcefn import_pages(
&mut self,
page_base: u64,
page_count: u64,
debug_tag: &str,
acceptance: BootPageAcceptance,
data: &[u8],
) -> Result<()>
fn import_pages( &mut self, page_base: u64, page_count: u64, debug_tag: &str, acceptance: BootPageAcceptance, data: &[u8], ) -> Result<()>
Import data into the guest address space with the given acceptance type. data.len() must be smaller than or equal to the number of pages being imported.
debug_tag
is a human readable string used by the loader to identify
this region for debugging and reporting.
Sourcefn import_vp_register(&mut self, register: R) -> Result<()>
fn import_vp_register(&mut self, register: R) -> Result<()>
Import a register into the BSP.
Sourcefn verify_startup_memory_available(
&mut self,
page_base: u64,
page_count: u64,
memory_type: StartupMemoryType,
) -> Result<()>
fn verify_startup_memory_available( &mut self, page_base: u64, page_count: u64, memory_type: StartupMemoryType, ) -> Result<()>
Verify with the loader that memory is available in guest address space with the given type.
Sourcefn set_vp_context_page(&mut self, page_base: u64) -> Result<()>
fn set_vp_context_page(&mut self, page_base: u64) -> Result<()>
Notify the loader to deposit architecture specific VP context information at the given page.
TODO: It probably makes sense to use a different acceptance type than the default one?
Sourcefn relocation_region(
&mut self,
gpa: u64,
size_bytes: u64,
relocation_alignment: u64,
minimum_relocation_gpa: u64,
maximum_relocation_gpa: u64,
apply_rip_offset: bool,
apply_gdtr_offset: bool,
vp_index: u16,
) -> Result<()>
fn relocation_region( &mut self, gpa: u64, size_bytes: u64, relocation_alignment: u64, minimum_relocation_gpa: u64, maximum_relocation_gpa: u64, apply_rip_offset: bool, apply_gdtr_offset: bool, vp_index: u16, ) -> Result<()>
Specify this region as relocatable.
Sourcefn page_table_relocation(
&mut self,
page_table_gpa: u64,
size_pages: u64,
used_pages: u64,
vp_index: u16,
) -> Result<()>
fn page_table_relocation( &mut self, page_table_gpa: u64, size_pages: u64, used_pages: u64, vp_index: u16, ) -> Result<()>
Specify a region as relocatable page table memory.
Sourcefn set_imported_regions_config_page(&mut self, page_base: u64)
fn set_imported_regions_config_page(&mut self, page_base: u64)
Lets the loader know what the base page of where the config page
containing list of accepted regions should be. This list should contain
the pages that will be accepted by the loader and therefore should not
be accepted again by either the boot shim or the vtl 2 firmware. The
list will be sorted in ascending order (on the base page) and be an
array of non-overlapping
[loader_defs::paravisor::ImportedRegionDescriptor
]. A
[loader_defs::paravisor::ImportedRegionDescriptor
] with a page count
of 0 indicates the end of the list.