pub fn vm_to_host<E: UserDefinedError>(
        &self,
        vm_addr: u64,
        len: u64,
    ) -> Result<u64, EbpfError<E>> {
        let mut begin_offset = vm_addr - self.vm_addr;
        let is_in_gap = ((begin_offset >> self.vm_gap_shift as u32) & 1) == 1;
        let gap_mask = (1 << self.vm_gap_shift) - 1;
        begin_offset = (begin_offset & !gap_mask) >> 1 | (begin_offset & gap_mask);
        if let Some(end_offset) = begin_offset.checked_add(len as u64) {
            if end_offset <= self.len && !is_in_gap {
                return Ok(self.host_addr + begin_offset);
            }
        }
        Err(EbpfError::InvalidVirtualAddress(vm_addr))
    }
/// Convert a virtual machine address into a host address
/// Does not perform a lower bounds check, as that is already done by the binary search in MemoryMapping::map()
Convert a virtual machine address into a host address
Does not perform a lower bounds check, as that is already done by the binary search in MemoryMapping::map()
Convert a virtual machine address into a host address Does not perform a lower bounds check as that is already done by the binary search in MemoryMapping :: map ()
pub fn vm_to_host<E: UserDefinedError>(
        &self,
        vm_addr: u64,
        len: u64,
    ) -> Result<u64, EbpfError<E>> {
        let mut begin_offset = vm_addr - self.vm_addr;
        let is_in_gap = ((begin_offset >> self.vm_gap_shift as u32) & 1) == 1;
        let gap_mask = (1 << self.vm_gap_shift) - 1;
        begin_offset = (begin_offset & !gap_mask) >> 1 | (begin_offset & gap_mask);
        if let Some(end_offset) = begin_offset.checked_add(len as u64) {
            if end_offset <= self.len && !is_in_gap {
                return Ok(self.host_addr + begin_offset);
            }
        }
        Err(EbpfError::InvalidVirtualAddress(vm_addr))
    }
pub fn vm_to_host < E : UserDefinedError > ( & self , vm_addr : u64 , len : u64 , ) -> Result < u64 , EbpfError < E > > { let mut begin_offset = vm_addr - self . vm_addr ; let is_in_gap = ( ( begin_offset >> self . vm_gap_shift as u32 ) & 1 ) == 1 ; let gap_mask = ( 1 << self . vm_gap_shift ) - 1 ; begin_offset = ( begin_offset & ! gap_mask ) >> 1 | ( begin_offset & gap_mask ) ; if let Some ( end_offset ) = begin_offset . checked_add ( len as u64 ) { if end_offset <= self . len && ! is_in_gap { return Ok ( self . host_addr + begin_offset ) ; } } Err ( EbpfError :: InvalidVirtualAddress ( vm_addr ) ) }
Convert a virtual machine address into a host address
Does not perform a lower bounds check, as that is already done by the binary search in MemoryMapping::map()
Convert a virtual machine address into a host address Does not perform a lower bounds check as that is already done by the binary search in MemoryMapping :: map ()
&self
vm_addr
u64
len
u64