Allow the kernel to start earlier than VM_MAX_ADDRESS --- dl-sysdep.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) --- a/sysdeps/mach/hurd/dl-sysdep.c 2008-07-07 20:11:39.000000000 +0200 +++ b/sysdeps/mach/hurd/dl-sysdep.c 2009-10-21 00:56:09.000000000 +0200 @@ -102,12 +102,26 @@ static void fmh(void) { max=a; break;} fmha=a+=fmhs;} if (err) assert(err==KERN_NO_SPACE); - if (!fmha)fmhs=0;else{ - fmhs=max-fmha; - err = __vm_map (__mach_task_self (), - &fmha, fmhs, 0, 0, MACH_PORT_NULL, 0, 1, - VM_PROT_NONE, VM_PROT_NONE, VM_INHERIT_COPY); - assert_perror(err);} + if (!fmha) + fmhs=0; + else + while (1) { + fmhs=max-fmha; + err = __vm_map (__mach_task_self (), + &fmha, fmhs, 0, 0, MACH_PORT_NULL, 0, 1, + VM_PROT_NONE, VM_PROT_NONE, VM_INHERIT_COPY); + if (!err) + break; + if (err != KERN_INVALID_ADDRESS && err != KERN_NO_SPACE) + assert_perror(err); + vm_address_t new_max = (max - 1) & 0xf0000000U; + if (new_max >= max) { + fmhs = 0; + fmha = 0; + break; + } + max = new_max; + } } /* XXX loser kludge for vm_map kernel bug */ #endif