user/lib/libsystem/src/sys/vm.c
/**
 * Builds the flag value to be provided to the various system calls to map a virtual memory object
 * into memory.
 *
 * @note If _any_ of the permission (RWX) flags are specified, the combination of these flags is
 *       used as a mask on the VM object's base permission flags. This means that it's never
 *       possible to make an explicitly read-only object writeable.
 *
 * @param inFlags User provided flags (from the VM_MAP_* constants)
 * @param remote When set, flags relating to remote mappings are allowed
 */
Builds the flag value to be provided to the various system calls to map a virtual memory object
into memory.

@note If _any_ of the permission (RWX) flags are specified, the combination of these flags is
used as a mask on the VM object's base permission flags. This means that it's never
possible to make an explicitly read-only object writeable.

@param inFlags User provided flags (from the VM_MAP_* constants)
@param remote When set, flags relating to remote mappings are allowed
Builds the flag value to be provided to the various system calls to map a virtual memory object into memory . @note If _any_ of the permission ( RWX ) flags are specified the combination of these flags is used as a mask on the VM object ' s base permission flags . This means that it ' s never possible to make an explicitly read - only object writeable . @param inFlags User provided flags ( from the VM_MAP_ * constants ) @param remote When set flags relating to remote mappings are allowed
static uintptr_t BuildSyscallMapFlags(const uintptr_t inFlags, bool remote) {
    uintptr_t temp = 0;
    if(inFlags & VM_MAP_READ) {
        temp |= (1 << 10);
    }
    if(inFlags & VM_MAP_WRITE) {
        temp |= (1 << 11);
    }
    if(inFlags & VM_MAP_EXEC) {
        temp |= (1 << 12);
    }
    if(remote) {
        if(inFlags & VM_MAP_ADOPT) {
            temp |= (1 << 24);
        }
    }
    return temp;
}
static uintptr_t BuildSyscallMapFlags ( const uintptr_t inFlags , bool remote ) { uintptr_t temp = 0 ; if ( inFlags & VM_MAP_READ ) { temp |= ( 1 << 10 ) ; } if ( inFlags & VM_MAP_WRITE ) { temp |= ( 1 << 11 ) ; } if ( inFlags & VM_MAP_EXEC ) { temp |= ( 1 << 12 ) ; } if ( remote ) { if ( inFlags & VM_MAP_ADOPT ) { temp |= ( 1 << 24 ) ; } } return temp ; }
Builds the flag value to be provided to the various system calls to map a virtual memory object
 into memory.
Builds the flag value to be provided to the various system calls to map a virtual memory object into memory .
// permissions for new mapping // remote flags