pub struct IgvmFile { /* private fields */ }
Expand description
An in-memory IGVM file that can be used to load a guest, or serialized to the binary format.
Implementations§
Source§impl IgvmFile
impl IgvmFile
Sourcepub fn serialize(&self, output: &mut Vec<u8>) -> Result<(), Error>
pub fn serialize(&self, output: &mut Vec<u8>) -> Result<(), Error>
Serialize this IGVM file into the binary format, into the supplied output Vec.
Sourcepub fn new(
revision: IgvmRevision,
platform_headers: Vec<IgvmPlatformHeader>,
initialization_headers: Vec<IgvmInitializationHeader>,
directive_headers: Vec<IgvmDirectiveHeader>,
) -> Result<Self, Error>
pub fn new( revision: IgvmRevision, platform_headers: Vec<IgvmPlatformHeader>, initialization_headers: Vec<IgvmInitializationHeader>, directive_headers: Vec<IgvmDirectiveHeader>, ) -> Result<Self, Error>
Create a new IgvmFile
from the given headers.
Sourcepub fn new_from_binary(
file: &[u8],
isolation_filter: Option<IsolationType>,
) -> Result<Self, Error>
pub fn new_from_binary( file: &[u8], isolation_filter: Option<IsolationType>, ) -> Result<Self, Error>
Create a new IgvmFile
from a serialized binary representation. An
optional filter can be specified to filter headers that do not apply to
the given isolation platform.
Sourcepub fn platforms(&self) -> &[IgvmPlatformHeader]
pub fn platforms(&self) -> &[IgvmPlatformHeader]
Get the platform headers in this file.
Sourcepub fn initializations(&self) -> &[IgvmInitializationHeader]
pub fn initializations(&self) -> &[IgvmInitializationHeader]
Get the initialization headers in this file.
Sourcepub fn directives(&self) -> &[IgvmDirectiveHeader]
pub fn directives(&self) -> &[IgvmDirectiveHeader]
Get the directive headers in this file.
Sourcepub fn relocations(
&self,
compatibility_mask: u32,
) -> (Option<Vec<IgvmRelocatableRegion>>, Option<PageTableRelocationBuilder>)
pub fn relocations( &self, compatibility_mask: u32, ) -> (Option<Vec<IgvmRelocatableRegion>>, Option<PageTableRelocationBuilder>)
Get the relocation regions and page table builder in this file for a given compatibility mask. If relocation is not supported, None is returned.
Sourcepub fn merge(&mut self, other: IgvmFile) -> Result<(), Error>
pub fn merge(&mut self, other: IgvmFile) -> Result<(), Error>
Merge the other
IgvmFile
into self
.
This will change compatabilty masks of other
if any conflict with the
current file.
Parameter area indices will be changed to avoid any conflicts. While it’s technically possible to merge parameter areas, it would require each parameter usage within that parameter area match exactly between different platforms due to only the final parameter insert having a compatibility mask.
To preserve all potential measurements in both self
and other
,
merging is stable and will not modify the relative order of directives
in both IGVM files.
The runtime of this function is O(n*m) where n is the number of headers in self, and m is the number of headers in other.
Sourcepub fn merge_simple(&mut self, other: IgvmFile) -> Result<(), Error>
pub fn merge_simple(&mut self, other: IgvmFile) -> Result<(), Error>
Merge other
into self, only fixing up compatibilty masks and parameter
area indices as necessary, like Self::merge
. No deduplication of
headers will be done.
The runtime of this function is O(n+m) where n is the number of headers in self, and m is the number of headers in other.