[][src]Trait dynasmrt::relocations::Relocation

pub trait Relocation {
    type Encoding;
    pub fn from_encoding(encoding: Self::Encoding) -> Self;
pub fn from_size(size: RelocationSize) -> Self;
pub fn size(&self) -> usize;
pub fn write_value(
        &self,
        buf: &mut [u8],
        value: isize
    ) -> Result<(), ImpossibleRelocation>;
pub fn read_value(&self, buf: &[u8]) -> isize;
pub fn kind(&self) -> RelocationKind;
pub fn page_size() -> usize; }

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.

Loading content...

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]

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.

Loading content...

Implementors

impl Relocation for Aarch64Relocation[src]

type Encoding = (u8,)

impl Relocation for RelocationSize[src]

type Encoding = u8

impl Relocation for X64Relocation[src]

type Encoding = (u8,)

impl Relocation for X86Relocation[src]

type Encoding = (u8, u8)

Loading content...