pub fn new_from_slice(v: &[u8], vm_addr: u64, vm_gap_size: u64, is_writable: bool) -> Self {
        let vm_gap_shift = if vm_gap_size > 0 {
            let vm_gap_shift =
                std::mem::size_of::<u64>() as u8 * 8 - vm_gap_size.leading_zeros() as u8 - 1;
            assert_eq!(vm_gap_size, 1 << vm_gap_shift);
            vm_gap_shift
        } else {
            std::mem::size_of::<u64>() as u8 * 8 - 1
        };
        MemoryRegion {
            host_addr: v.as_ptr() as u64,
            vm_addr,
            len: v.len() as u64,
            vm_gap_shift,
            is_writable,
        }
    }
/// Creates a new MemoryRegion structure from a slice
Creates a new MemoryRegion structure from a slice
Creates a new MemoryRegion structure from a slice
pub fn new_from_slice(v: &[u8], vm_addr: u64, vm_gap_size: u64, is_writable: bool) -> Self {
        let vm_gap_shift = if vm_gap_size > 0 {
            let vm_gap_shift =
                std::mem::size_of::<u64>() as u8 * 8 - vm_gap_size.leading_zeros() as u8 - 1;
            assert_eq!(vm_gap_size, 1 << vm_gap_shift);
            vm_gap_shift
        } else {
            std::mem::size_of::<u64>() as u8 * 8 - 1
        };
        MemoryRegion {
            host_addr: v.as_ptr() as u64,
            vm_addr,
            len: v.len() as u64,
            vm_gap_shift,
            is_writable,
        }
    }
pub fn new_from_slice ( v : & [ u8 ] , vm_addr : u64 , vm_gap_size : u64 , is_writable : bool ) -> Self { let vm_gap_shift = if vm_gap_size > 0 { let vm_gap_shift = std :: mem :: size_of :: < u64 > ( ) as u8 * 8 - vm_gap_size . leading_zeros ( ) as u8 - 1 ; assert_eq ! ( vm_gap_size 1 vm_gap_shift ) ; vm_gap_shift } else { std :: mem :: size_of :: < u64 > ( ) as u8 * 8 - 1 } ; MemoryRegion { host_addr : v . as_ptr ( ) as u64 , vm_addr , len : v . len ( ) as u64 , vm_gap_shift , is_writable , } }
Creates a new MemoryRegion structure from a slice
Creates a new MemoryRegion structure from a slice
v
&[u8]
vm_addr
u64
vm_gap_size
u64
is_writable
bool