Trait solana_rbpf::vm::Executable[][src]

pub trait Executable<E: UserDefinedError, I: InstructionMeter>: Send + Sync {
    fn get_config(&self) -> &Config;
fn get_text_bytes(&self) -> Result<(u64, &[u8]), EbpfError<E>>;
fn get_ro_sections(&self) -> Result<Vec<(u64, &[u8])>, EbpfError<E>>;
fn get_entrypoint_instruction_offset(&self) -> Result<usize, EbpfError<E>>;
fn register_bpf_function(&mut self, hash: u32, pc: usize);
fn lookup_bpf_function(&self, hash: u32) -> Option<&usize>;
fn get_syscall_registry(&self) -> &SyscallRegistry;
fn set_syscall_registry(&mut self, syscall_registry: SyscallRegistry);
fn get_compiled_program(&self) -> Option<&JitProgram<E, I>>;
fn jit_compile(&mut self) -> Result<(), EbpfError<E>>;
fn report_unresolved_symbol(
        &self,
        insn_offset: usize
    ) -> Result<u64, EbpfError<E>>;
fn get_symbols(
        &self
    ) -> (HashMap<u32, String>, HashMap<usize, (String, usize)>); }
Expand description

An relocated and ready to execute binary

Required methods

fn get_config(&self) -> &Config[src]

Get the configuration settings

fn get_text_bytes(&self) -> Result<(u64, &[u8]), EbpfError<E>>[src]

Get the .text section virtual address and bytes

fn get_ro_sections(&self) -> Result<Vec<(u64, &[u8])>, EbpfError<E>>[src]

Get a vector of virtual addresses for each read-only section

fn get_entrypoint_instruction_offset(&self) -> Result<usize, EbpfError<E>>[src]

Get the entry point offset into the text section

fn register_bpf_function(&mut self, hash: u32, pc: usize)[src]

Set a symbol’s instruction offset

fn lookup_bpf_function(&self, hash: u32) -> Option<&usize>[src]

Get a symbol’s instruction offset

fn get_syscall_registry(&self) -> &SyscallRegistry[src]

Get the syscall registry

fn set_syscall_registry(&mut self, syscall_registry: SyscallRegistry)[src]

Set (overwrite) the syscall registry

fn get_compiled_program(&self) -> Option<&JitProgram<E, I>>[src]

Get the JIT compiled program

fn jit_compile(&mut self) -> Result<(), EbpfError<E>>[src]

JIT compile the executable

fn report_unresolved_symbol(
    &self,
    insn_offset: usize
) -> Result<u64, EbpfError<E>>
[src]

Report information on a symbol that failed to be resolved

fn get_symbols(&self) -> (HashMap<u32, String>, HashMap<usize, (String, usize)>)[src]

Get syscalls and BPF functions (if debug symbols are not stripped)

Implementations

impl<E: UserDefinedError, I: 'static + InstructionMeter> dyn Executable<E, I>[src]

Static constructors for Executable

pub fn from_elf(
    elf_bytes: &[u8],
    verifier: Option<Verifier<E>>,
    config: Config
) -> Result<Box<Self>, EbpfError<E>>
[src]

Creates a post relocaiton/fixup executable from an ELF file

pub fn from_text_bytes(
    text_bytes: &[u8],
    verifier: Option<Verifier<E>>,
    config: Config
) -> Result<Box<Self>, EbpfError<E>>
[src]

Creates a post relocaiton/fixup executable from machine code

Implementors

impl<E: UserDefinedError, I: InstructionMeter> Executable<E, I> for EBpfElf<E, I>[src]

fn get_config(&self) -> &Config[src]

Get the configuration settings

fn get_text_bytes(&self) -> Result<(u64, &[u8]), EbpfError<E>>[src]

Get the .text section virtual address and bytes

fn get_ro_sections(&self) -> Result<Vec<(u64, &[u8])>, EbpfError<E>>[src]

Get a vector of virtual addresses for each read-only section

fn get_entrypoint_instruction_offset(&self) -> Result<usize, EbpfError<E>>[src]

Get the entry point offset into the text section

fn register_bpf_function(&mut self, hash: u32, pc: usize)[src]

Set a symbol’s instruction offset

fn lookup_bpf_function(&self, hash: u32) -> Option<&usize>[src]

Get a symbol’s instruction offset

fn get_syscall_registry(&self) -> &SyscallRegistry[src]

Get the syscall registry

fn set_syscall_registry(&mut self, syscall_registry: SyscallRegistry)[src]

Set (overwrite) the syscall registry

fn get_compiled_program(&self) -> Option<&JitProgram<E, I>>[src]

Get the JIT compiled program

fn jit_compile(&mut self) -> Result<(), EbpfError<E>>[src]

JIT compile the executable

fn report_unresolved_symbol(
    &self,
    insn_offset: usize
) -> Result<u64, EbpfError<E>>
[src]

Report information on a symbol that failed to be resolved

fn get_symbols(&self) -> (HashMap<u32, String>, HashMap<usize, (String, usize)>)[src]

Get syscalls and BPF functions (if debug symbols are not stripped)