pub fn map<E: UserDefinedError>(
        &self,
        access_type: AccessType,
        vm_addr: u64,
        len: u64,
    ) -> Result<u64, EbpfError<E>> {
        let mut index = 1;
        while index <= self.dense_keys.len() {
            index = (index << 1) + (self.dense_keys[index - 1] <= vm_addr) as usize;
        }
        index >>= index.trailing_zeros() + 1;
        if index == 0 {
            return Err(self.generate_access_violation(access_type, vm_addr, len));
        }
        let region = &self.regions[index - 1];
        if access_type == AccessType::Load || region.is_writable {
            if let Ok(host_addr) = region.vm_to_host::<E>(vm_addr, len as u64) {
                return Ok(host_addr);
            }
        }
        Err(self.generate_access_violation(access_type, vm_addr, len))
    }
/// Given a list of regions translate from virtual machine to host address
Given a list of regions translate from virtual machine to host address
Given a list of regions translate from virtual machine to host address
pub fn map<E: UserDefinedError>(
        &self,
        access_type: AccessType,
        vm_addr: u64,
        len: u64,
    ) -> Result<u64, EbpfError<E>> {
        let mut index = 1;
        while index <= self.dense_keys.len() {
            index = (index << 1) + (self.dense_keys[index - 1] <= vm_addr) as usize;
        }
        index >>= index.trailing_zeros() + 1;
        if index == 0 {
            return Err(self.generate_access_violation(access_type, vm_addr, len));
        }
        let region = &self.regions[index - 1];
        if access_type == AccessType::Load || region.is_writable {
            if let Ok(host_addr) = region.vm_to_host::<E>(vm_addr, len as u64) {
                return Ok(host_addr);
            }
        }
        Err(self.generate_access_violation(access_type, vm_addr, len))
    }
pub fn map < E : UserDefinedError > ( & self , access_type : AccessType , vm_addr : u64 , len : u64 , ) -> Result < u64 , EbpfError < E > > { let mut index = 1 ; while index <= self . dense_keys . len ( ) { index = ( index << 1 ) + ( self . dense_keys [ index - 1 ] <= vm_addr ) as usize ; } index >>= index . trailing_zeros ( ) + 1 ; if index == 0 { return Err ( self . generate_access_violation ( access_type , vm_addr , len ) ) ; } let region = & self . regions [ index - 1 ] ; if access_type == AccessType :: Load || region . is_writable { if let Ok ( host_addr ) = region . vm_to_host :: < E > ( vm_addr , len as u64 ) { return Ok ( host_addr ) ; } } Err ( self . generate_access_violation ( access_type , vm_addr , len ) ) }
Given a list of regions translate from virtual machine to host address
Given a list of regions translate from virtual machine to host address
&self
access_type
AccessType
vm_addr
u64
len
u64