|
LIEF: Library to Instrument Executable Formats Version 1.0.0
|
Represents a contiguous chunk of memory allocated or inspected by the runtime. More...
#include <Memory.hpp>
Public Member Functions | |
| Chunk (void *addr, size_t size, uint32_t permissions) | |
| Chunk (void *addr, size_t size) | |
| Chunk (void *addr) | |
| void * | addr_ptr () |
| Returns the start address of the memory chunk as an opaque pointer. | |
| const void * | addr_ptr () const |
| uintptr_t | addr () const |
| Returns the start address of the memory chunk. | |
| size_t | size () const |
| Returns the size of the memory chunk in bytes. | |
| uint32_t | permissions () const |
| Returns the current permissions of the memory chunk. | |
| uintptr_t | page_start () const |
| Returns the address of the start of the page containing this chunk. | |
| uintptr_t | page_end () const |
| Returns the address of the end of the page containing this chunk. | |
| Chunk & | change_permissions (uint32_t p) |
| Changes the permissions of the memory chunk. | |
| Chunk & | make_x () |
| Sets the permissions to Execute only. | |
| Chunk & | make_rw () |
| Sets the permissions to Read and Write. | |
| Chunk & | make_rx () |
| Sets the permissions to Read and Execute. | |
| Chunk & | make_rwx () |
| Sets the permissions to Read, Write, and Execute. | |
| Chunk & | make_ro () |
| Sets the permissions to Read Only. | |
| Chunk & | cache_flush () |
| Flushes the instruction cache for this memory chunk. This should be used when modifying code in memory (e.g., hooking, JIT). | |
| bool | is_valid () const |
| Check if this chunk is valid. | |
| operator bool () const | |
| ok_error_t | deallocate () |
| std::string | to_string () const |
Represents a contiguous chunk of memory allocated or inspected by the runtime.
|
inline |
References addr(), permissions(), and size().
Referenced by cache_flush(), change_permissions(), Chunk(), Chunk(), make_ro(), make_rw(), make_rwx(), make_rx(), make_x(), and operator<<.
|
inline |
References addr(), Chunk(), LIEF::runtime::Memory::P_NONE, and size().
|
inline |
References addr(), Chunk(), and LIEF::runtime::Memory::P_NONE.
|
inline |
|
inline |
Returns the start address of the memory chunk as an opaque pointer.
|
inline |
| Chunk & LIEF::runtime::Memory::Chunk::cache_flush | ( | ) |
Flushes the instruction cache for this memory chunk. This should be used when modifying code in memory (e.g., hooking, JIT).
References Chunk(), and LIEF_LIFETIMEBOUND.
|
inline |
Changes the permissions of the memory chunk.
References Chunk(), LIEF::logging::err(), LIEF_LIFETIMEBOUND, LIEF::runtime::Memory::mprotect(), and to_string().
Referenced by make_ro(), make_rw(), make_rwx(), make_rx(), and make_x().
|
inline |
References LIEF::runtime::Memory::munmap().
|
inline |
|
inline |
Sets the permissions to Read Only.
References change_permissions(), Chunk(), LIEF_LIFETIMEBOUND, and LIEF::runtime::Memory::P_READ.
|
inline |
Sets the permissions to Read and Write.
References change_permissions(), Chunk(), LIEF_LIFETIMEBOUND, LIEF::runtime::Memory::P_READ, and LIEF::runtime::Memory::P_WRITE.
|
inline |
Sets the permissions to Read, Write, and Execute.
References change_permissions(), Chunk(), LIEF_LIFETIMEBOUND, LIEF::runtime::Memory::P_EXEC, LIEF::runtime::Memory::P_READ, and LIEF::runtime::Memory::P_WRITE.
|
inline |
Sets the permissions to Read and Execute.
References change_permissions(), Chunk(), LIEF_LIFETIMEBOUND, LIEF::runtime::Memory::P_EXEC, and LIEF::runtime::Memory::P_READ.
|
inline |
Sets the permissions to Execute only.
References change_permissions(), Chunk(), LIEF_LIFETIMEBOUND, and LIEF::runtime::Memory::P_EXEC.
|
inline |
References is_valid().
| uintptr_t LIEF::runtime::Memory::Chunk::page_end | ( | ) | const |
Returns the address of the end of the page containing this chunk.
| uintptr_t LIEF::runtime::Memory::Chunk::page_start | ( | ) | const |
Returns the address of the start of the page containing this chunk.
|
inline |
Returns the current permissions of the memory chunk.
Referenced by Chunk().
|
inline |
| std::string LIEF::runtime::Memory::Chunk::to_string | ( | ) | const |