[−][src]Struct dynasmrt::Assembler
A full assembler implementation. Supports labels, all types of relocations, incremental compilation and multithreaded execution with simultaneous compiltion. Its implementation guarantees no memory is executable and writable at the same time.
Methods
impl<R: Relocation> Assembler<R>
[src]
pub fn new() -> Result<Self>
[src]
Create a new, empty assembler, with initial allocation size page_size
.
pub fn new_dynamic_label(&mut self) -> DynamicLabel
[src]
Create a new dynamic label ID
pub fn alter_uncommitted(&mut self) -> UncommittedModifier
[src]
Use an UncommittedModifier
to alter uncommitted code.
This does not allow the user to change labels/relocations.
pub fn alter<F, O>(&mut self, f: F) -> Result<O, DynasmError> where
F: FnOnce(&mut Modifier<R>) -> O,
[src]
F: FnOnce(&mut Modifier<R>) -> O,
Use a Modifier
to alter committed code directly. While this is happening
no code can be executed as the relevant pages are remapped as writable.
This API supports defining new labels/relocations, and overwriting previously defined relocations.
pub fn commit(&mut self) -> Result<(), DynasmError>
[src]
Commit code, flushing the temporary internal assembling buffer to the mapped executable memory. This makes assembled code available for execution.
pub fn finalize(self) -> Result<ExecutableBuffer, Self>
[src]
Finalize this assembler, returning the internal executablebuffer if no Executor instances exist.
This panics if any uncommitted changes caused errors near the end. To handle these, call commit()
explicitly beforehand.
pub fn reader(&self) -> Executor
[src]
Create an executor which can be used to execute code while still assembling code
pub fn labels(&self) -> &LabelRegistry
[src]
Provides access to the assemblers internal labels registry
pub fn labels_mut(&mut self) -> &mut LabelRegistry
[src]
Provides mutable access to the assemblers internal labels registry
Trait Implementations
impl<R: Relocation> DynasmApi for Assembler<R>
[src]
fn offset(&self) -> AssemblyOffset
[src]
fn push(&mut self, value: u8)
[src]
fn align(&mut self, alignment: usize, with: u8)
[src]
fn push_i8(&mut self, value: i8)
[src]
fn push_i16(&mut self, value: i16)
[src]
fn push_i32(&mut self, value: i32)
[src]
fn push_i64(&mut self, value: i64)
[src]
fn push_u16(&mut self, value: u16)
[src]
fn push_u32(&mut self, value: u32)
[src]
fn push_u64(&mut self, value: u64)
[src]
fn runtime_error(&self, msg: &'static str) -> !
[src]
impl<R: Relocation> DynasmLabelApi for Assembler<R>
[src]
type Relocation = R
The relocation info type this assembler uses.
fn local_label(&mut self, name: &'static str)
[src]
fn global_label(&mut self, name: &'static str)
[src]
fn dynamic_label(&mut self, id: DynamicLabel)
[src]
fn global_relocation(&mut self, name: &'static str, offset: isize, kind: R)
[src]
fn dynamic_relocation(&mut self, id: DynamicLabel, offset: isize, kind: R)
[src]
fn forward_relocation(&mut self, name: &'static str, offset: isize, kind: R)
[src]
fn backward_relocation(&mut self, name: &'static str, offset: isize, kind: R)
[src]
fn bare_relocation(&mut self, target: usize, kind: R)
[src]
fn forward_reloc(
&mut self,
name: &'static str,
offset: isize,
kind: <Self::Relocation as Relocation>::Encoding
)
[src]
&mut self,
name: &'static str,
offset: isize,
kind: <Self::Relocation as Relocation>::Encoding
)
fn backward_reloc(
&mut self,
name: &'static str,
offset: isize,
kind: <Self::Relocation as Relocation>::Encoding
)
[src]
&mut self,
name: &'static str,
offset: isize,
kind: <Self::Relocation as Relocation>::Encoding
)
fn global_reloc(
&mut self,
name: &'static str,
offset: isize,
kind: <Self::Relocation as Relocation>::Encoding
)
[src]
&mut self,
name: &'static str,
offset: isize,
kind: <Self::Relocation as Relocation>::Encoding
)
fn dynamic_reloc(
&mut self,
id: DynamicLabel,
offset: isize,
kind: <Self::Relocation as Relocation>::Encoding
)
[src]
&mut self,
id: DynamicLabel,
offset: isize,
kind: <Self::Relocation as Relocation>::Encoding
)
fn bare_reloc(
&mut self,
target: usize,
kind: <Self::Relocation as Relocation>::Encoding
)
[src]
&mut self,
target: usize,
kind: <Self::Relocation as Relocation>::Encoding
)
impl<R: Relocation> Extend<u8> for Assembler<R>
[src]
fn extend<T>(&mut self, iter: T) where
T: IntoIterator<Item = u8>,
[src]
T: IntoIterator<Item = u8>,
impl<'a, R: Relocation> Extend<&'a u8> for Assembler<R>
[src]
fn extend<T>(&mut self, iter: T) where
T: IntoIterator<Item = &'a u8>,
[src]
T: IntoIterator<Item = &'a u8>,
impl<R: Debug + Relocation> Debug for Assembler<R>
[src]
Auto Trait Implementations
impl<R> Send for Assembler<R> where
R: Send,
R: Send,
impl<R> Sync for Assembler<R> where
R: Sync,
R: Sync,
impl<R> Unpin for Assembler<R> where
R: Unpin,
R: Unpin,
impl<R> UnwindSafe for Assembler<R> where
R: RefUnwindSafe + UnwindSafe,
R: RefUnwindSafe + UnwindSafe,
impl<R> RefUnwindSafe for Assembler<R> where
R: RefUnwindSafe,
R: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,