Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_exec.c
Show First 20 Lines • Show All 1,100 Lines • ▼ Show 20 Lines | |||||
* mapping. In combination with pmap_remove_pages(), which cleans all | * mapping. In combination with pmap_remove_pages(), which cleans all | ||||
* managed mappings in the process' vmspace pmap, no work will be left | * managed mappings in the process' vmspace pmap, no work will be left | ||||
* for pmap_remove(min, max). | * for pmap_remove(min, max). | ||||
*/ | */ | ||||
void | void | ||||
exec_free_abi_mappings(struct proc *p) | exec_free_abi_mappings(struct proc *p) | ||||
{ | { | ||||
struct vmspace *vmspace; | struct vmspace *vmspace; | ||||
struct sysentvec *sv; | |||||
vmspace = p->p_vmspace; | vmspace = p->p_vmspace; | ||||
if (refcount_load(&vmspace->vm_refcnt) != 1) | if (refcount_load(&vmspace->vm_refcnt) != 1) | ||||
return; | return; | ||||
sv = p->p_sysent; | if (!PROC_HAS_SHP(p)) | ||||
if (sv->sv_shared_page_obj == NULL) | |||||
return; | return; | ||||
pmap_remove(vmspace_pmap(vmspace), sv->sv_shared_page_base, | pmap_remove(vmspace_pmap(vmspace), vmspace->vm_shp_base, | ||||
sv->sv_shared_page_base + sv->sv_shared_page_len); | vmspace->vm_shp_base + p->p_sysent->sv_shared_page_len); | ||||
} | } | ||||
/* | /* | ||||
* Run down the current address space and install a new one. Map the shared | * Run down the current address space and install a new one. Map the shared | ||||
* page. | * page. | ||||
*/ | */ | ||||
int | int | ||||
exec_new_vmspace(struct image_params *imgp, struct sysentvec *sv) | exec_new_vmspace(struct image_params *imgp, struct sysentvec *sv) | ||||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | error = vm_map_fixed(map, obj, 0, | ||||
sv->sv_shared_page_base, sv->sv_shared_page_len, | sv->sv_shared_page_base, sv->sv_shared_page_len, | ||||
VM_PROT_READ | VM_PROT_EXECUTE, | VM_PROT_READ | VM_PROT_EXECUTE, | ||||
VM_PROT_READ | VM_PROT_EXECUTE, | VM_PROT_READ | VM_PROT_EXECUTE, | ||||
MAP_INHERIT_SHARE | MAP_ACC_NO_CHARGE); | MAP_INHERIT_SHARE | MAP_ACC_NO_CHARGE); | ||||
if (error != KERN_SUCCESS) { | if (error != KERN_SUCCESS) { | ||||
vm_object_deallocate(obj); | vm_object_deallocate(obj); | ||||
return (vm_mmap_to_errno(error)); | return (vm_mmap_to_errno(error)); | ||||
} | } | ||||
vmspace->vm_shp_base = sv->sv_shared_page_base; | |||||
} | } | ||||
return (sv->sv_onexec != NULL ? sv->sv_onexec(p, imgp) : 0); | return (sv->sv_onexec != NULL ? sv->sv_onexec(p, imgp) : 0); | ||||
} | } | ||||
/* | /* | ||||
* Compute the stack size limit and map the main process stack. | * Compute the stack size limit and map the main process stack. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 425 Lines • ▼ Show 20 Lines | exec_copyout_strings(struct image_params *imgp, uintptr_t *stack_base) | ||||
sysent = p->p_sysent; | sysent = p->p_sysent; | ||||
destp = PROC_PS_STRINGS(p); | destp = PROC_PS_STRINGS(p); | ||||
arginfo = imgp->ps_strings = (void *)destp; | arginfo = imgp->ps_strings = (void *)destp; | ||||
/* | /* | ||||
* Install sigcode. | * Install sigcode. | ||||
*/ | */ | ||||
if (sysent->sv_sigcode_base == 0 && sysent->sv_szsigcode != NULL) { | if (sysent->sv_shared_page_base == 0 && sysent->sv_szsigcode != NULL) { | ||||
szsigcode = *(sysent->sv_szsigcode); | szsigcode = *(sysent->sv_szsigcode); | ||||
destp -= szsigcode; | destp -= szsigcode; | ||||
destp = rounddown2(destp, sizeof(void *)); | destp = rounddown2(destp, sizeof(void *)); | ||||
error = copyout(sysent->sv_sigcode, (void *)destp, szsigcode); | error = copyout(sysent->sv_sigcode, (void *)destp, szsigcode); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 411 Lines • Show Last 20 Lines |