|
|
| version 1.18, 2004/01/08 18:39:18 | version 1.19, 2004/01/20 18:41:51 |
|---|---|
| Line 147 kern_execve(struct nameidata *ndp, struc | Line 147 kern_execve(struct nameidata *ndp, struc |
| imgp->args = args; | imgp->args = args; |
| imgp->attr = &attr; | imgp->attr = &attr; |
| imgp->entry_addr = 0; | imgp->entry_addr = 0; |
| imgp->resident = 0; | |
| imgp->vmspace_destroyed = 0; | imgp->vmspace_destroyed = 0; |
| imgp->interpreted = 0; | imgp->interpreted = 0; |
| imgp->interpreter_name[0] = 0; | imgp->interpreter_name[0] = 0; |
| Line 210 interpret: | Line 211 interpret: |
| error = img_first(imgp); | error = img_first(imgp); |
| /* | /* |
| * If the vnode has a registered vmspace, exec the vmspace | |
| */ | |
| if (error == -1 && imgp->vp->v_resident) { | |
| error = exec_resident_imgact(imgp); | |
| } | |
| /* | |
| * Loop through the list of image activators, calling each one. | * Loop through the list of image activators, calling each one. |
| * An activator returns -1 if there is no match, 0 on success, | * An activator returns -1 if there is no match, 0 on success, |
| * and an error otherwise. | * and an error otherwise. |
| Line 252 interpret: | Line 260 interpret: |
| /* | /* |
| * If custom stack fixup routine present for this process | * If custom stack fixup routine present for this process |
| * let it do the stack setup. | * let it do the stack setup. If we are running a resident |
| * image there is no auxinfo or other image activator context | |
| * so don't try to add fixups to the stack. | |
| * | |
| * Else stuff argument count as first item on stack | * Else stuff argument count as first item on stack |
| */ | */ |
| if (p->p_sysent->sv_fixup) | if (p->p_sysent->sv_fixup && imgp->resident == 0) |
| (*p->p_sysent->sv_fixup)(&stack_base, imgp); | (*p->p_sysent->sv_fixup)(&stack_base, imgp); |
| else | else |
| suword(--stack_base, imgp->args->argc); | suword(--stack_base, imgp->args->argc); |
| Line 566 exec_unmap_first_page(imgp) | Line 577 exec_unmap_first_page(imgp) |
| * automatically in trap.c. | * automatically in trap.c. |
| */ | */ |
| int | int |
| exec_new_vmspace(imgp) | exec_new_vmspace(struct image_params *imgp, struct vmspace *vmcopy) |
| struct image_params *imgp; | |
| { | { |
| int error; | int error; |
| struct vmspace *vmspace = imgp->proc->p_vmspace; | struct vmspace *vmspace = imgp->proc->p_vmspace; |
| vm_offset_t stack_addr = USRSTACK - maxssiz; | vm_offset_t stack_addr = USRSTACK - maxssiz; |
| vm_map_t map = &vmspace->vm_map; | vm_map_t map; |
| imgp->vmspace_destroyed = 1; | imgp->vmspace_destroyed = 1; |
| Line 584 exec_new_vmspace(imgp) | Line 594 exec_new_vmspace(imgp) |
| /* | /* |
| * Blow away entire process VM, if address space not shared, | * Blow away entire process VM, if address space not shared, |
| * otherwise, create a new VM space so that other threads are | * otherwise, create a new VM space so that other threads are |
| * not disrupted | * not disrupted. If we are execing a resident vmspace we |
| * create a duplicate of it and remap the stack. | |
| */ | */ |
| if (vmspace->vm_refcnt == 1) { | map = &vmspace->vm_map; |
| if (vmcopy) { | |
| vmspace_exec(imgp->proc, vmcopy); | |
| vmspace = imgp->proc->p_vmspace; | |
| pmap_remove_pages(vmspace_pmap(vmspace), stack_addr, USRSTACK); | |
| map = &vmspace->vm_map; | |
| } else if (vmspace->vm_refcnt == 1) { | |
| shmexit(vmspace); | shmexit(vmspace); |
| pmap_remove_pages(vmspace_pmap(vmspace), 0, VM_MAXUSER_ADDRESS); | pmap_remove_pages(vmspace_pmap(vmspace), 0, VM_MAXUSER_ADDRESS); |
| vm_map_remove(map, 0, VM_MAXUSER_ADDRESS); | vm_map_remove(map, 0, VM_MAXUSER_ADDRESS); |
| } else { | } else { |
| vmspace_exec(imgp->proc); | vmspace_exec(imgp->proc, NULL); |
| vmspace = imgp->proc->p_vmspace; | vmspace = imgp->proc->p_vmspace; |
| map = &vmspace->vm_map; | map = &vmspace->vm_map; |
| } | } |