[−][src]Trait dynasmrt::relocations::Relocation
Used to inform assemblers on how to implement relocations for each architecture. When implementing a new architecture, one simply has to implement this trait for the architecture's relocation definition.
Associated Types
type Encoding
[src]
The encoded representation for this relocation that is emitted by the dynasm! macro.
Required methods
pub fn from_encoding(encoding: Self::Encoding) -> Self
[src]
construct this relocation from an encoded representation.
pub fn from_size(size: RelocationSize) -> Self
[src]
construct this relocation from a simple size. This is used to implement relocations in directives and literal pools.
pub fn size(&self) -> usize
[src]
The size of the slice of bytes affected by this relocation
pub fn write_value(
&self,
buf: &mut [u8],
value: isize
) -> Result<(), ImpossibleRelocation>
[src]
&self,
buf: &mut [u8],
value: isize
) -> Result<(), ImpossibleRelocation>
Write a value into a buffer of size self.size()
in the format of this relocation.
Any bits not part of the relocation should be preserved.
pub fn read_value(&self, buf: &[u8]) -> isize
[src]
Read a value from a buffer of size self.size()
in the format of this relocation.
pub fn kind(&self) -> RelocationKind
[src]
Specifies what kind of relocation this relocation instance is.
pub fn page_size() -> usize
[src]
Specifies the default page size on this platform.
Implementors
impl Relocation for Aarch64Relocation
[src]
type Encoding = (u8,)
pub fn from_encoding(encoding: Self::Encoding) -> Self
[src]
pub fn from_size(size: RelocationSize) -> Self
[src]
pub fn size(&self) -> usize
[src]
pub fn write_value(
&self,
buf: &mut [u8],
value: isize
) -> Result<(), ImpossibleRelocation>
[src]
&self,
buf: &mut [u8],
value: isize
) -> Result<(), ImpossibleRelocation>
pub fn read_value(&self, buf: &[u8]) -> isize
[src]
pub fn kind(&self) -> RelocationKind
[src]
pub fn page_size() -> usize
[src]
impl Relocation for RelocationSize
[src]
type Encoding = u8
pub fn from_encoding(encoding: Self::Encoding) -> Self
[src]
pub fn from_size(size: RelocationSize) -> Self
[src]
pub fn size(&self) -> usize
[src]
pub fn write_value(
&self,
buf: &mut [u8],
value: isize
) -> Result<(), ImpossibleRelocation>
[src]
&self,
buf: &mut [u8],
value: isize
) -> Result<(), ImpossibleRelocation>
pub fn read_value(&self, buf: &[u8]) -> isize
[src]
pub fn kind(&self) -> RelocationKind
[src]
pub fn page_size() -> usize
[src]
impl Relocation for X64Relocation
[src]
type Encoding = (u8,)
pub fn from_encoding(encoding: Self::Encoding) -> Self
[src]
pub fn from_size(size: RelocationSize) -> Self
[src]
pub fn size(&self) -> usize
[src]
pub fn write_value(
&self,
buf: &mut [u8],
value: isize
) -> Result<(), ImpossibleRelocation>
[src]
&self,
buf: &mut [u8],
value: isize
) -> Result<(), ImpossibleRelocation>
pub fn read_value(&self, buf: &[u8]) -> isize
[src]
pub fn kind(&self) -> RelocationKind
[src]
pub fn page_size() -> usize
[src]
impl Relocation for X86Relocation
[src]
type Encoding = (u8, u8)
pub fn from_encoding(encoding: Self::Encoding) -> Self
[src]
pub fn from_size(size: RelocationSize) -> Self
[src]
pub fn size(&self) -> usize
[src]
pub fn write_value(
&self,
buf: &mut [u8],
value: isize
) -> Result<(), ImpossibleRelocation>
[src]
&self,
buf: &mut [u8],
value: isize
) -> Result<(), ImpossibleRelocation>