Skip to content

Commit 2adddce

Browse files
Alexandra IordacheSamuel Ortiz
Alexandra Iordache
authored and
Samuel Ortiz
committed
elf: add missing documentation
Signed-off-by: Alexandra Iordache <[email protected]>
1 parent 422d564 commit 2adddce

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/loader/x86_64/elf/mod.rs

+7
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ impl Display for Error {
104104
pub struct Elf;
105105

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

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

0 commit comments

Comments
 (0)