Trait ckb_vm::memory::Memory

source ·
pub trait Memory {
    type REG: Register;

Show 23 methods // Required methods fn new() -> Self; fn new_with_memory(memory_size: usize) -> Self; fn init_pages( &mut self, addr: u64, size: u64, flags: u8, source: Option<Bytes>, offset_from_addr: u64, ) -> Result<(), Error>; fn fetch_flag(&mut self, page: u64) -> Result<u8, Error>; fn set_flag(&mut self, page: u64, flag: u8) -> Result<(), Error>; fn clear_flag(&mut self, page: u64, flag: u8) -> Result<(), Error>; fn memory_size(&self) -> usize; fn store_byte( &mut self, addr: u64, size: u64, value: u8, ) -> Result<(), Error>; fn store_bytes(&mut self, addr: u64, value: &[u8]) -> Result<(), Error>; fn load_bytes(&mut self, addr: u64, size: u64) -> Result<Bytes, Error>; fn execute_load16(&mut self, addr: u64) -> Result<u16, Error>; fn execute_load32(&mut self, addr: u64) -> Result<u32, Error>; fn load8(&mut self, addr: &Self::REG) -> Result<Self::REG, Error>; fn load16(&mut self, addr: &Self::REG) -> Result<Self::REG, Error>; fn load32(&mut self, addr: &Self::REG) -> Result<Self::REG, Error>; fn load64(&mut self, addr: &Self::REG) -> Result<Self::REG, Error>; fn store8( &mut self, addr: &Self::REG, value: &Self::REG, ) -> Result<(), Error>; fn store16( &mut self, addr: &Self::REG, value: &Self::REG, ) -> Result<(), Error>; fn store32( &mut self, addr: &Self::REG, value: &Self::REG, ) -> Result<(), Error>; fn store64( &mut self, addr: &Self::REG, value: &Self::REG, ) -> Result<(), Error>; fn lr(&self) -> &Self::REG; fn set_lr(&mut self, value: &Self::REG); // Provided method fn memory_pages(&self) -> usize { ... }
}

Required Associated Types§

Required Methods§

source

fn new() -> Self

source

fn new_with_memory(memory_size: usize) -> Self

source

fn init_pages( &mut self, addr: u64, size: u64, flags: u8, source: Option<Bytes>, offset_from_addr: u64, ) -> Result<(), Error>

source

fn fetch_flag(&mut self, page: u64) -> Result<u8, Error>

source

fn set_flag(&mut self, page: u64, flag: u8) -> Result<(), Error>

source

fn clear_flag(&mut self, page: u64, flag: u8) -> Result<(), Error>

source

fn memory_size(&self) -> usize

source

fn store_byte(&mut self, addr: u64, size: u64, value: u8) -> Result<(), Error>

source

fn store_bytes(&mut self, addr: u64, value: &[u8]) -> Result<(), Error>

source

fn load_bytes(&mut self, addr: u64, size: u64) -> Result<Bytes, Error>

source

fn execute_load16(&mut self, addr: u64) -> Result<u16, Error>

source

fn execute_load32(&mut self, addr: u64) -> Result<u32, Error>

source

fn load8(&mut self, addr: &Self::REG) -> Result<Self::REG, Error>

source

fn load16(&mut self, addr: &Self::REG) -> Result<Self::REG, Error>

source

fn load32(&mut self, addr: &Self::REG) -> Result<Self::REG, Error>

source

fn load64(&mut self, addr: &Self::REG) -> Result<Self::REG, Error>

source

fn store8(&mut self, addr: &Self::REG, value: &Self::REG) -> Result<(), Error>

source

fn store16(&mut self, addr: &Self::REG, value: &Self::REG) -> Result<(), Error>

source

fn store32(&mut self, addr: &Self::REG, value: &Self::REG) -> Result<(), Error>

source

fn store64(&mut self, addr: &Self::REG, value: &Self::REG) -> Result<(), Error>

source

fn lr(&self) -> &Self::REG

source

fn set_lr(&mut self, value: &Self::REG)

Provided Methods§

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<M: Memory> Memory for WXorXMemory<M>

§

type REG = <M as Memory>::REG

source§

impl<R: Register> Memory for FlatMemory<R>

A flat chunk of memory used for RISC-V machine, it lacks all the permission checking logic.

§

type REG = R

source§

impl<R: Register> Memory for SparseMemory<R>

§

type REG = R