pub struct Segment<T: SizeT> {
pub p_type: SegmentType,
pub data: Vec<u8>,
pub offset: T,
pub virtual_address: T,
pub physical_address: T,
pub size: T,
pub flags: u32,
pub align: T,
}
Expand description
A segment, this gets loaded into memory when elf file gets executed
Fields§
§p_type: SegmentType
Identifies the type of the segment
data: Vec<u8>
Data of this segment
offset: T
Offset of the segment in the file image
virtual_address: T
Virtual address of the segment in memory
physical_address: T
On systems where physical address is relevant, reserved for segment’s physical address
size: T
Size in bytes of the segment in memory. May be 0. May be more then data to pad segment with zeros
flags: u32
Segment-dependent flags. Essentially permissions, specified with SegmentFlags like that:
use orecc_elf::SegmentFlags;
let flags = SegmentFlags::Readable as u32 | SegmentFlags::Executable as u32;
assert_eq!(flags, 0x05);
align: T
0 and 1 specify no alignment. Otherwise should be a positive, integral power of 2. I don’t really know how it works
Trait Implementations§
Source§impl<T: Ord + SizeT> Ord for Segment<T>
impl<T: Ord + SizeT> Ord for Segment<T>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialOrd + SizeT> PartialOrd for Segment<T>
impl<T: PartialOrd + SizeT> PartialOrd for Segment<T>
impl<T: Eq + SizeT> Eq for Segment<T>
impl<T: SizeT> StructuralPartialEq for Segment<T>
Auto Trait Implementations§
impl<T> Freeze for Segment<T>where
T: Freeze,
impl<T> RefUnwindSafe for Segment<T>where
T: RefUnwindSafe,
impl<T> Send for Segment<T>where
T: Send,
impl<T> Sync for Segment<T>where
T: Sync,
impl<T> Unpin for Segment<T>where
T: Unpin,
impl<T> UnwindSafe for Segment<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more