diff --git a/src/loader/elf.rs b/src/loader/elf.rs index b7d71d7a..eee311ed 100644 --- a/src/loader/elf.rs +++ b/src/loader/elf.rs @@ -1,3 +1,5 @@ +// Copyright © 2020, Oracle and/or its affiliates. +// // Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. // // Portions Copyright 2017 The Chromium OS Authors. All rights reserved. @@ -22,6 +24,16 @@ pub const ELFMAG0: ::std::os::raw::c_uint = 127; pub const ELFDATA2LSB: ::std::os::raw::c_uint = 1; pub const PT_LOAD: ::std::os::raw::c_uint = 1; +// ELF Note p_type used to parse PVH entry point address +pub const PT_NOTE: ::std::os::raw::c_uint = 4; + +// 32bit entry point into the kernel. When requested to boot the +// guest kernel using the PVH boot protocol, use this entry point +// to start the guest in 32-bit protected mode with paging disabled. +// +// [ Corresponding definition in Linux kernel: include/xen/interface/elfnote.h ] +pub const XEN_ELFNOTE_PHYS32_ENTRY: u32 = 18; + pub const ELFMAG1: u8 = b'E'; pub const ELFMAG2: u8 = b'L'; pub const ELFMAG3: u8 = b'F'; @@ -86,6 +98,16 @@ impl Clone for elf64_phdr { } pub type Elf64_Phdr = elf64_phdr; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct elf64_nhdr { + pub n_namesz: Elf64_Word, // Name size + pub n_descsz: Elf64_Word, // Content size + pub n_type: Elf64_Word, // Content type +} + +pub type Elf64_Nhdr = elf64_nhdr; + #[cfg(test)] mod tests { use super::*;