Tim Clem (@tclem) commented about dlls/ntdll/unix/virtual.c:
{ERR( "mach_vm_region failed: %d\n", kr );break;}if (region_address > current_address){ERR( "trying to register unmapped region\n" );break;}assert( info.protection == mach_prot );region_size = (mach_vm_size_t)host_page_size;kr = mach_vm_protect( mach_task_self(), current_address, region_size, 0,mach_prot | VM_PROT_COPY );
Is there a reason to do this page by page? Can you not just do one mach_vm_protect for the whole range?