pub struct PatchableBlock { /* private fields */ }Expand description
Self-describing handle for a rewritable code region (immediate or custom block).
Implementations§
Source§impl PatchableBlock
impl PatchableBlock
Sourcepub const unsafe fn new(
offset: CodeOffset,
size: CodeOffset,
arch: Arch,
) -> Self
pub const unsafe fn new( offset: CodeOffset, size: CodeOffset, arch: Arch, ) -> Self
Construct a block handle manually.
§Safety
offset..offset+size in any image you later patch must be a reserved patch region for
arch (instruction alignment and nop-fill rules apply).
pub const fn offset(self) -> CodeOffset
pub const fn size(self) -> CodeOffset
pub const fn arch(self) -> Arch
Sourcepub unsafe fn rewrite(
self,
bytes: &mut [u8],
new_bytes: &[u8],
) -> Result<(), AsmError>
pub unsafe fn rewrite( self, bytes: &mut [u8], new_bytes: &[u8], ) -> Result<(), AsmError>
Overwrite this block; shorter payloads are padded with architecture nops.
§Safety
bytes must be the code image this block was recorded against. The caller synchronizes
concurrent execution of the patched region.
Trait Implementations§
Source§impl Clone for PatchableBlock
impl Clone for PatchableBlock
Source§fn clone(&self) -> PatchableBlock
fn clone(&self) -> PatchableBlock
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PatchableBlock
Source§impl Debug for PatchableBlock
impl Debug for PatchableBlock
impl Eq for PatchableBlock
Source§impl Hash for PatchableBlock
impl Hash for PatchableBlock
Source§impl PartialEq for PatchableBlock
impl PartialEq for PatchableBlock
impl StructuralPartialEq for PatchableBlock
Auto Trait Implementations§
impl Freeze for PatchableBlock
impl RefUnwindSafe for PatchableBlock
impl Send for PatchableBlock
impl Sync for PatchableBlock
impl Unpin for PatchableBlock
impl UnsafeUnpin for PatchableBlock
impl UnwindSafe for PatchableBlock
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