Skip to content

Commit

Permalink
elf: add missing documentation
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandra Iordache <[email protected]>
  • Loading branch information
Alexandra Iordache committed Mar 24, 2020
1 parent 664b3da commit 388fd99
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/loader/x86_64/elf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ impl Display for Error {
pub struct Elf;

impl Elf {
/// Verifies that magic numbers are present in the Elf header.
fn validate_header(ehdr: &elf::Elf64_Ehdr) -> std::result::Result<(), Error> {
// Sanity checks
if ehdr.e_ident[elf::EI_MAG0 as usize] != elf::ELFMAG0 as u8
Expand Down Expand Up @@ -248,6 +249,12 @@ impl KernelLoader for Elf {
}
}

/// Examines a supplied elf program header of type `PT_NOTE` to determine if it contains an entry
/// of type `XEN_ELFNOTE_PHYS32_ENTRY` (0x12). Notes of this type encode a physical 32-bit entry
/// point address into the kernel, which is used when launching guests in 32-bit (protected) mode
/// with paging disabled, as described by the PVH boot protocol.
/// Returns the encoded entry point address, or `None` if no `XEN_ELFNOTE_PHYS32_ENTRY` entries are
/// found in the note header.
fn parse_elf_note<F>(phdr: &elf::Elf64_Phdr, kernel_image: &mut F) -> Result<Option<GuestAddress>>
where
F: Read + Seek,
Expand Down

0 comments on commit 388fd99

Please sign in to comment.