lief::runtime::memory

Struct Chunk

pub struct Chunk { /* private fields */ }
Expand description

Represents a contiguous chunk of memory allocated or inspected by the runtime.

Implementations§

§

impl Chunk

pub fn addr(&self) -> u64

Returns the start address of the memory chunk.

pub fn size(&self) -> u64

Returns the size of the memory chunk in bytes.

pub fn permissions(&self) -> Perm

Returns the current permissions of the memory chunk.

pub fn page_start(&self) -> u64

Returns the address of the start of the page containing this chunk.

pub fn page_end(&self) -> u64

Returns the address of the end of the page containing this chunk.

pub fn change_permissions(&mut self, perm: Perm)

Changes the permissions of the memory chunk.

pub fn make_x(&mut self)

Sets the permissions to Execute only.

pub fn make_rw(&mut self)

Sets the permissions to Read and Write.

pub fn make_rx(&mut self)

Sets the permissions to Read and Execute.

pub fn make_rwx(&mut self)

Sets the permissions to Read, Write, and Execute.

pub fn make_ro(&mut self)

Sets the permissions to Read Only.

pub fn cache_flush(&mut self)

Flushes the instruction cache for this memory chunk. This should be used when modifying code in memory (e.g., hooking, JIT).

pub fn is_valid(&self) -> bool

Trait Implementations§

§

impl Display for Chunk

§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Chunk

§

impl RefUnwindSafe for Chunk

§

impl !Send for Chunk

§

impl !Sync for Chunk

§

impl Unpin for Chunk

§

impl UnwindSafe for Chunk

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.