pub fn sys_vmar_protect(
        &self,
        handle_value: HandleValue,
        options: u32,
        addr: u64,
        len: u64,
    ) -> ZxResult {
        let options = VmOptions::from_bits(options).ok_or(ZxError::INVALID_ARGS)?;
        let rights = options.to_required_rights();
        info!(
            "vmar.protect: handle={:#x}, options={:#x}, addr={:#x}, len={:#x}",
            handle_value, options, addr, len
        );
        let proc = self.thread.proc();
        let vmar = proc.get_object_with_rights::<VmAddressRegion>(handle_value, rights)?;
        if options.intersects(!VmOptions::PERM_RXW) {
            return Err(ZxError::INVALID_ARGS);
        }
        let mut mapping_flags = MMUFlags::empty();
        mapping_flags.set(MMUFlags::READ, options.contains(VmOptions::PERM_READ));
        mapping_flags.set(MMUFlags::WRITE, options.contains(VmOptions::PERM_WRITE));
        mapping_flags.set(MMUFlags::EXECUTE, options.contains(VmOptions::PERM_EXECUTE));
        info!("mmuflags: {:?}", mapping_flags);
        let len = roundup_pages(len as usize);
        if len == 0 {
            return Err(ZxError::INVALID_ARGS);
        }
        vmar.protect(addr as usize, len, mapping_flags)?;
        Ok(())
    }
/// Set protection of virtual memory pages.
Set protection of virtual memory pages.
Set protection of virtual memory pages .
pub fn sys_vmar_protect(
        &self,
        handle_value: HandleValue,
        options: u32,
        addr: u64,
        len: u64,
    ) -> ZxResult {
        let options = VmOptions::from_bits(options).ok_or(ZxError::INVALID_ARGS)?;
        let rights = options.to_required_rights();
        info!(
            "vmar.protect: handle={:#x}, options={:#x}, addr={:#x}, len={:#x}",
            handle_value, options, addr, len
        );
        let proc = self.thread.proc();
        let vmar = proc.get_object_with_rights::<VmAddressRegion>(handle_value, rights)?;
        if options.intersects(!VmOptions::PERM_RXW) {
            return Err(ZxError::INVALID_ARGS);
        }
        let mut mapping_flags = MMUFlags::empty();
        mapping_flags.set(MMUFlags::READ, options.contains(VmOptions::PERM_READ));
        mapping_flags.set(MMUFlags::WRITE, options.contains(VmOptions::PERM_WRITE));
        mapping_flags.set(MMUFlags::EXECUTE, options.contains(VmOptions::PERM_EXECUTE));
        info!("mmuflags: {:?}", mapping_flags);
        let len = roundup_pages(len as usize);
        if len == 0 {
            return Err(ZxError::INVALID_ARGS);
        }
        vmar.protect(addr as usize, len, mapping_flags)?;
        Ok(())
    }
pub fn sys_vmar_protect ( & self , handle_value : HandleValue , options : u32 , addr : u64 , len : u64 , ) -> ZxResult { let options = VmOptions :: from_bits ( options ) . ok_or ( ZxError :: INVALID_ARGS ) ? ; let rights = options . to_required_rights ( ) ; info ! ( " " handle_value options addr len ) ; let proc = self . thread . proc ( ) ; let vmar = proc . get_object_with_rights :: < VmAddressRegion > ( handle_value , rights ) ? ; if options . intersects ( ! VmOptions :: PERM_RXW ) { return Err ( ZxError :: INVALID_ARGS ) ; } let mut mapping_flags = MMUFlags :: empty ( ) ; mapping_flags . set ( MMUFlags :: READ , options . contains ( VmOptions :: PERM_READ ) ) ; mapping_flags . set ( MMUFlags :: WRITE , options . contains ( VmOptions :: PERM_WRITE ) ) ; mapping_flags . set ( MMUFlags :: EXECUTE , options . contains ( VmOptions :: PERM_EXECUTE ) ) ; info ! ( " " mapping_flags ) ; let len = roundup_pages ( len as usize ) ; if len == 0 { return Err ( ZxError :: INVALID_ARGS ) ; } vmar . protect ( addr as usize , len , mapping_flags ) ? ; Ok ( ( ) ) }
Set protection of virtual memory pages.
Set protection of virtual memory pages .
&self
handle_value
HandleValue
options
u32
addr
u64
len
u64
&self
handle_value
HandleValue
options
u32
addr
u64
len
u64