Diff for /src/sys/vm/vm_map.c between versions 1.20 and 1.21

version 1.20, 2004/01/20 05:04:08 version 1.21, 2004/01/20 18:41:52
Line 2965  done: Line 2965  done:
  */   */
   
 void  void
vmspace_exec(struct proc *pvmspace_exec(struct proc *p, struct vmspace *vmcopy) 
 {  {
         struct vmspace *oldvmspace = p->p_vmspace;          struct vmspace *oldvmspace = p->p_vmspace;
         struct vmspace *newvmspace;          struct vmspace *newvmspace;
         vm_map_t map = &p->p_vmspace->vm_map;          vm_map_t map = &p->p_vmspace->vm_map;
   
        newvmspace = vmspace_alloc(map->min_offset, map->max_offset);        /*
        bcopy(&oldvmspace->vm_startcopy, &newvmspace->vm_startcopy,         * If we are execing a resident vmspace we fork it, otherwise
            (caddr_t) (newvmspace + 1) - (caddr_t) &newvmspace->vm_startcopy);         * we create a new vmspace.
          */
         if (vmcopy)  {
             newvmspace = vmspace_fork(vmcopy);
         } else {
             newvmspace = vmspace_alloc(map->min_offset, map->max_offset);
             bcopy(&oldvmspace->vm_startcopy, &newvmspace->vm_startcopy,
                 (caddr_t)(newvmspace+1) - (caddr_t) &newvmspace->vm_startcopy);
         }
 
         /*          /*
          * This code is written like this for prototype purposes.  The           * This code is written like this for prototype purposes.  The
          * goal is to avoid running down the vmspace here, but let the           * goal is to avoid running down the vmspace here, but let the
Line 2981  vmspace_exec(struct proc *p) Line 2990  vmspace_exec(struct proc *p)
          * run it down.  Even though there is little or no chance of blocking           * run it down.  Even though there is little or no chance of blocking
          * here, it is a good idea to keep this form for future mods.           * here, it is a good idea to keep this form for future mods.
          */           */
         vmspace_free(oldvmspace);  
         p->p_vmspace = newvmspace;          p->p_vmspace = newvmspace;
         pmap_pinit2(vmspace_pmap(newvmspace));          pmap_pinit2(vmspace_pmap(newvmspace));
         if (p == curproc)          if (p == curproc)
                 pmap_activate(p);                  pmap_activate(p);
           vmspace_free(oldvmspace);
 }  }
   
 /*  /*
Line 3002  vmspace_unshare(struct proc *p) Line 3011  vmspace_unshare(struct proc *p)
         if (oldvmspace->vm_refcnt == 1)          if (oldvmspace->vm_refcnt == 1)
                 return;                  return;
         newvmspace = vmspace_fork(oldvmspace);          newvmspace = vmspace_fork(oldvmspace);
         vmspace_free(oldvmspace);  
         p->p_vmspace = newvmspace;          p->p_vmspace = newvmspace;
         pmap_pinit2(vmspace_pmap(newvmspace));          pmap_pinit2(vmspace_pmap(newvmspace));
         if (p == curproc)          if (p == curproc)
                 pmap_activate(p);                  pmap_activate(p);
           vmspace_free(oldvmspace);
 }  }
   
 /*  /*

Removed from v.1.20  
changed lines
  Added in v.1.21