Skip to content

Commit 272f3b9

Browse files
author
Alexandra Iordache
committed
elf: add missing documentation
Signed-off-by: Alexandra Iordache <aghecen@amazon.com>
1 parent d6f52c7 commit 272f3b9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/loader/x86_64/elf/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ impl Display for Error {
102102
pub struct Elf;
103103

104104
impl Elf {
105+
/// Verifies that magic numbers are present in the Elf header.
105106
fn validate_header(ehdr: &elf::Elf64_Ehdr) -> std::result::Result<(), Error> {
106107
// Sanity checks
107108
if ehdr.e_ident[elf::EI_MAG0 as usize] != elf::ELFMAG0 as u8
@@ -246,6 +247,12 @@ impl KernelLoader for Elf {
246247
}
247248
}
248249

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

0 commit comments

Comments
 (0)