[−][src]Function solana_rbpf::helpers::memfrob
pub fn memfrob(
addr: u64,
len: u64,
unused3: u64,
unused4: u64,
unused5: u64,
_context: &mut HelperContext,
_ro_regions: &[MemoryRegion],
rw_regions: &[MemoryRegion]
) -> Result<u64, Error>
Same as void *memfrob(void *s, size_t n);
in string.h
in C. See the GNU manual page (in
section 3) for memfrob
. The memory is directly modified, and the helper returns 0 in all
cases. Arguments 3 to 5 are unused.
Examples
use solana_rbpf::helpers; use solana_rbpf::memory_region::MemoryRegion; let val = vec![0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x22, 0x33]; let val_va = 0x1000; let regions = [MemoryRegion::new_from_slice(&val, val_va)]; helpers::memfrob(val_va, 8, 0, 0, 0, &mut None, ®ions, ®ions); assert_eq!(val, vec![0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x3b, 0x08, 0x19]); helpers::memfrob(val_va, 8, 0, 0, 0, &mut None, ®ions, ®ions); assert_eq!(val, vec![0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x22, 0x33]);