user/lib/libsystem/src/sys/vm.c
/**
 * Gets info on an existing virtual memory region from the perspective of the given task. If the
 * task does not map the given region, an error is returned.
 *
 * @param regionHandle Handle to a virtual memory region
 * @param task Handle to a task, or 0 to reference the current task
 */
Gets info on an existing virtual memory region from the perspective of the given task. If the
task does not map the given region, an error is returned.

@param regionHandle Handle to a virtual memory region
@param task Handle to a task, or 0 to reference the current task
Gets info on an existing virtual memory region from the perspective of the given task . If the task does not map the given region an error is returned . @param regionHandle Handle to a virtual memory region @param task Handle to a task or 0 to reference the current task
int VirtualRegionGetInfoFor(const uintptr_t regionHandle, const uintptr_t taskHandle,
        uintptr_t *baseAddr, uintptr_t *length, uintptr_t *flags) {
    intptr_t err;
    struct VmInfoStruct info;
    InternalMemset(&info, 0, sizeof(info));
    err = __do_syscall4(regionHandle, taskHandle, (uintptr_t) &info, sizeof(info),
            SYS_VM_GET_INFO);
    if(err != 0) {
        return err;
    }
    if(baseAddr) *baseAddr = info.virtualBase;
    if(length) *length = info.length;
    if(flags) *flags = ConvertSyscallFlags(info.flags);
    return 0;
}
int VirtualRegionGetInfoFor ( const uintptr_t regionHandle , const uintptr_t taskHandle , uintptr_t * baseAddr , uintptr_t * length , uintptr_t * flags ) { intptr_t err ; struct VmInfoStruct info ; InternalMemset ( & info , 0 , sizeof ( info ) ) ; err = __do_syscall4 ( regionHandle , taskHandle , ( uintptr_t ) & info , sizeof ( info ) , SYS_VM_GET_INFO ) ; if ( err != 0 ) { return err ; } if ( baseAddr ) * baseAddr = info . virtualBase ; if ( length ) * length = info . length ; if ( flags ) * flags = ConvertSyscallFlags ( info . flags ) ; return 0 ; }
Gets info on an existing virtual memory region from the perspective of the given task.
Gets info on an existing virtual memory region from the perspective of the given task .
// make the call to populate temporary struct // bail immediately if error // otherwise, extract the fields