if (!argv_extra[1]) {
// If loading a statically linked file, then heap remapping we can do,
// otherwise delayed.
- create_heap(vmspace(proc), va_align(container->exe.end));
+ create_heap(vmspace(proc), page_aligned(container->exe.end));
}
if (container->vms_mnt == VMS_SELF) {
memcpy((void*)ustack, (const void*)envp, envp_len);
ustack = copy_to_ustack(ustack, (ptr_t*)ustack);
+ } else {
+ ustack -= sizeof(ptr_t);
+ *((ptr_t*)ustack) = 0;
}
if (argv) {
ustack -= argv_len;
memcpy((void*)ustack, (const void**)argv, argv_len);
+ } else {
+ ustack -= sizeof(ptr_t);
+ *((ptr_t*)ustack) = 0;
}
for (size_t i = 0; i < 2 && argv_extra[i]; i++) {