rusty_mos::process::elf_loader

Struct Elf32Ehdr

Source
#[repr(C)]
pub struct Elf32Ehdr {
Show 14 fields ident: [u8; 16], ftype: u16, _machine: u16, _version: u32, pub entry: u32, phoff: u32, _shoff: u32, _flags: u32, _ehsize: u16, phentsize: u16, phnum: u16, _shentsize: u16, _shnum: u16, _shstrndx: u16,
}
Expand description

The ELF32 file header structure. The members are defined in the same order as in the actual elf file.

Fields§

§ident: [u8; 16]

Magic number and other information.

§ftype: u16

The object file type.

§_machine: u16

The architecture.

§_version: u32

The object file version.

§entry: u32

The virtual address for the entry point.

§phoff: u32

The offset of the program header table from the file’s start.

§_shoff: u32

The offset of the section header table from the file’s start.

§_flags: u32

The processor-specific flag.

§_ehsize: u16

The elf header size (in bytes).

§phentsize: u16

The program header table entry size.

§phnum: u16

The program header table entry count.

§_shentsize: u16

The section header table entry size.

§_shnum: u16

The section header table entry count.

§_shstrndx: u16

The section header string table index.

Implementations§

Source§

impl Elf32Ehdr

Source

pub fn from(binary: *const u8, size: usize) -> *const Self

Build the Elf32Ehdr object from the binary.

§Return

The raw-pointer of the binary start if the size and the magic number is valid. Otherwise, a null point will be returned.

Source

pub fn foreach(&self, apply: impl Fn(u32))

Walk all the program header entry, use the function apply passed.

Trait Implementations§

Source§

impl Clone for Elf32Ehdr

Source§

fn clone(&self) -> Elf32Ehdr

Returns a copy of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Elf32Ehdr

Auto Trait Implementations§

§

impl Freeze for Elf32Ehdr

§

impl RefUnwindSafe for Elf32Ehdr

§

impl Send for Elf32Ehdr

§

impl Sync for Elf32Ehdr

§

impl Unpin for Elf32Ehdr

§

impl UnwindSafe for Elf32Ehdr

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.