amebazii::types::header

Struct EntryHeader

Source
pub struct EntryHeader {
    pub length: u32,
    pub load_address: u32,
    pub entry_address: Option<u32>,
}
Expand description

EntryHeader represents the header of a specific entry within a binary image. It includes metadata about the entry, such as its length, load address, and entry point.

This structure is used to describe a segment or block of data that is loaded into memory at a specified address and contains an entry point that the system can use to jump to the start of execution.

Fields:

  • length: The length of the entry in bytes. This defines how much memory the entry occupies.
  • load_address: The memory address at which the entry is loaded into the system’s memory space.
  • entry_address: The address to which control is transferred when the entry is executed. By default, it’s set to 0xFFFF_FFFF (None), which indicates an invalid entry address.

Fields§

§length: u32

The length of the entry in bytes.

§load_address: u32

The load address in memory where the entry will be loaded.

§entry_address: Option<u32>

The entry address, the address to which the system will jump to start execution. Defaults to 0xFFFF_FFFF (None), indicating an invalid address.

Trait Implementations§

Source§

impl BinarySize for EntryHeader

Source§

fn binary_size() -> usize

Returns the binary size of the EntryHeader struct in bytes.

§Returns
  • 0x20: The size of the EntryHeader struct in bytes.
Source§

impl Debug for EntryHeader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EntryHeader

Source§

fn default() -> EntryHeader

Returns the default values for the EntryHeader struct.

The default values are:

  • length: 0 (indicating no data or length of the entry).
  • load_address: 0 (indicating the entry is not loaded anywhere).
  • entry_address: 0xFFFF_FFFF (None) (invalid entry address, typically indicating no valid entry).
§Returns
  • EntryHeader: A struct with default values.
Source§

impl FromStream for EntryHeader

Source§

fn read_from<R>(&mut self, reader: &mut R) -> Result<(), Error>
where R: Read + Seek,

Reads an EntryHeader from the provided reader (e.g., a file or memory buffer).

§Arguments
  • reader: A mutable reference to an object that implements Read and Seek (e.g., a file or buffer).
§Returns
  • Ok(()): If the deserialization is successful.
  • Err(Error): If there is an error reading from the stream, such as an unexpected end of data.
Source§

impl ToStream for EntryHeader

Source§

fn write_to<W>(&self, writer: &mut W) -> Result<(), Error>
where W: Write + Seek,

Serializes the EntryHeader struct to a stream.

§Parameters
  • writer: A mutable reference to a type that implements the std::io::Write trait. The data will be written to this stream.
§Returns
  • Ok(()): If the data is written successfully.
  • Err(Error): If there is an issue writing the data to the stream.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.