pub fn sys_vmo_create_physical(
        &self,
        resource: HandleValue,
        paddr: PhysAddr,
        size: usize,
        mut out: UserOutPtr<HandleValue>,
    ) -> ZxResult {
        info!(
            "vmo.create_physical: handle={:#x?}, paddr={:#x?}, size={:#x}, out={:#x?}",
            resource, paddr, size, out
        );
        let proc = self.thread.proc();
        proc.check_policy(PolicyCondition::NewVMO)?;
        proc.get_object::<Resource>(resource)?
            .validate_ranged_resource(ResourceKind::MMIO, paddr, size)?;
        let size = roundup_pages(size);
        if size == 0 || !page_aligned(paddr) {
            return Err(ZxError::INVALID_ARGS);
        }
        if paddr.overflowing_add(size).1 {
            return Err(ZxError::INVALID_ARGS);
        }
        let vmo = VmObject::new_physical(paddr, size / PAGE_SIZE);
        let handle_value = proc.add_handle(Handle::new(vmo, Rights::DEFAULT_VMO | Rights::EXECUTE));
        out.write(handle_value)?;
        Ok(())
    }
/// Create a VM object referring to a specific contiguous range of physical memory.
Create a VM object referring to a specific contiguous range of physical memory.
Create a VM object referring to a specific contiguous range of physical memory .
pub fn sys_vmo_create_physical(
        &self,
        resource: HandleValue,
        paddr: PhysAddr,
        size: usize,
        mut out: UserOutPtr<HandleValue>,
    ) -> ZxResult {
        info!(
            "vmo.create_physical: handle={:#x?}, paddr={:#x?}, size={:#x}, out={:#x?}",
            resource, paddr, size, out
        );
        let proc = self.thread.proc();
        proc.check_policy(PolicyCondition::NewVMO)?;
        proc.get_object::<Resource>(resource)?
            .validate_ranged_resource(ResourceKind::MMIO, paddr, size)?;
        let size = roundup_pages(size);
        if size == 0 || !page_aligned(paddr) {
            return Err(ZxError::INVALID_ARGS);
        }
        if paddr.overflowing_add(size).1 {
            return Err(ZxError::INVALID_ARGS);
        }
        let vmo = VmObject::new_physical(paddr, size / PAGE_SIZE);
        let handle_value = proc.add_handle(Handle::new(vmo, Rights::DEFAULT_VMO | Rights::EXECUTE));
        out.write(handle_value)?;
        Ok(())
    }
pub fn sys_vmo_create_physical ( & self , resource : HandleValue , paddr : PhysAddr , size : usize , mut out : UserOutPtr < HandleValue > , ) -> ZxResult { info ! ( " " resource paddr size out ) ; let proc = self . thread . proc ( ) ; proc . check_policy ( PolicyCondition :: NewVMO ) ? ; proc . get_object :: < Resource > ( resource ) ? . validate_ranged_resource ( ResourceKind :: MMIO , paddr , size ) ? ; let size = roundup_pages ( size ) ; if size == 0 || ! page_aligned ( paddr ) { return Err ( ZxError :: INVALID_ARGS ) ; } if paddr . overflowing_add ( size ) . 1 { return Err ( ZxError :: INVALID_ARGS ) ; } let vmo = VmObject :: new_physical ( paddr , size / PAGE_SIZE ) ; let handle_value = proc . add_handle ( Handle :: new ( vmo , Rights :: DEFAULT_VMO | Rights :: EXECUTE ) ) ; out . write ( handle_value ) ? ; Ok ( ( ) ) }
Create a VM object referring to a specific contiguous range of physical memory.
Create a VM object referring to a specific contiguous range of physical memory .
&self
resource
HandleValue
paddr
PhysAddr
size
usize
out
UserOutPtr<HandleValue>
&self
resource
HandleValue
paddr
PhysAddr
size
usize
out
UserOutPtr<HandleValue>