pub(super) fn stable64_read(
        &self,
        dst: u64,
        offset: u64,
        size: u64,
        heap: &mut [u8],
    ) -> HypervisorResult<()> {
        let (dst, offset, size) = (dst as usize, offset as usize, size as usize);

        let (stable_memory_size_in_bytes, overflow) = self
            .stable64_size()?
            .overflowing_mul(WASM_PAGE_SIZE_IN_BYTES as u64);
        if overflow {
            return Err(HypervisorError::Trapped(StableMemoryOutOfBounds));
        }

        let (stable_memory_end, overflow) = offset.overflowing_add(size);
        if overflow || stable_memory_end > stable_memory_size_in_bytes as usize {
            return Err(HypervisorError::Trapped(StableMemoryOutOfBounds));
        }

        let (heap_end, overflow) = dst.overflowing_add(size);
        if overflow || heap_end > heap.len() {
            return Err(HypervisorError::Trapped(HeapOutOfBounds));
        }
        self.stable_memory_buffer
            .read(&mut heap[dst..heap_end], offset);
        Ok(())
    }
/// Reads from stable memory back to heap.
///
/// Supports bigger stable memory indexed by 64 bit pointers.
Reads from stable memory back to heap.
Supports bigger stable memory indexed by 64 bit pointers.
Reads from stable memory back to heap . Supports bigger stable memory indexed by 64 bit pointers .
pub(super) fn stable64_read(
        &self,
        dst: u64,
        offset: u64,
        size: u64,
        heap: &mut [u8],
    ) -> HypervisorResult<()> {
        let (dst, offset, size) = (dst as usize, offset as usize, size as usize);
        let (stable_memory_size_in_bytes, overflow) = self
            .stable64_size()?
            .overflowing_mul(WASM_PAGE_SIZE_IN_BYTES as u64);
        if overflow {
            return Err(HypervisorError::Trapped(StableMemoryOutOfBounds));
        }
        let (stable_memory_end, overflow) = offset.overflowing_add(size);
        if overflow || stable_memory_end > stable_memory_size_in_bytes as usize {
            return Err(HypervisorError::Trapped(StableMemoryOutOfBounds));
        }
        let (heap_end, overflow) = dst.overflowing_add(size);
        if overflow || heap_end > heap.len() {
            return Err(HypervisorError::Trapped(HeapOutOfBounds));
        }
        self.stable_memory_buffer
            .read(&mut heap[dst..heap_end], offset);
        Ok(())
    }
pub ( super ) fn stable64_read ( & self , dst : u64 , offset : u64 , size : u64 , heap : & mut [ u8 ] , ) -> HypervisorResult < ( ) > { let ( dst , offset , size ) = ( dst as usize , offset as usize , size as usize ) ; let ( stable_memory_size_in_bytes , overflow ) = self . stable64_size ( ) ? . overflowing_mul ( WASM_PAGE_SIZE_IN_BYTES as u64 ) ; if overflow { return Err ( HypervisorError :: Trapped ( StableMemoryOutOfBounds ) ) ; } let ( stable_memory_end , overflow ) = offset . overflowing_add ( size ) ; if overflow || stable_memory_end > stable_memory_size_in_bytes as usize { return Err ( HypervisorError :: Trapped ( StableMemoryOutOfBounds ) ) ; } let ( heap_end , overflow ) = dst . overflowing_add ( size ) ; if overflow || heap_end > heap . len ( ) { return Err ( HypervisorError :: Trapped ( HeapOutOfBounds ) ) ; } self . stable_memory_buffer . read ( & mut heap [ dst .. heap_end ] , offset ) ; Ok ( ( ) ) }
Reads from stable memory back to heap.
Reads from stable memory back to heap .
&self
dst
u64
offset
u64
size
u64
heap
&mut [u8]
&self
dst
u64
offset
u64
size
u64
heap
&mut [u8]