Index: sys/arch/hppa/hppa/trap.c =================================================================== RCS file: /cvsroot/src/sys/arch/hppa/hppa/trap.c,v retrieving revision 1.97 diff -u -p -u -r1.97 trap.c --- sys/arch/hppa/hppa/trap.c 13 Feb 2012 01:07:37 -0000 1.97 +++ sys/arch/hppa/hppa/trap.c 7 Mar 2012 18:45:32 -0000 @@ -1009,6 +1009,27 @@ child_return(void *arg) void cpu_spawn_return(struct lwp *l) { + struct proc *p = l->l_proc; + pmap_t pmap = p->p_vmspace->vm_map.pmap; + pa_space_t space = pmap->pm_space; + struct trapframe *tf = l->l_md.md_regs; + + /* Load all of the user's space registers. */ + tf->tf_sr0 = tf->tf_sr1 = tf->tf_sr3 = tf->tf_sr2 = + tf->tf_sr4 = tf->tf_sr5 = tf->tf_sr6 = space; + tf->tf_iisq_head = tf->tf_iisq_tail = space; + + /* Load the protection registers */ + tf->tf_pidr1 = tf->tf_pidr2 = pmap->pm_pid; + + /* + * theoretically these could be inherited from the father, + * but just in case. + */ + tf->tf_sr7 = HPPA_SID_KERNEL; + mfctl(CR_EIEM, tf->tf_eiem); + tf->tf_ipsw = PSW_C | PSW_Q | PSW_P | PSW_D | PSW_I /* | PSW_L */ | + (curcpu()->ci_psw & PSW_O); userret(l, l->l_md.md_regs->tf_iioq_head, 0); #ifdef DEBUG Index: sys/arch/hppa/hppa/vm_machdep.c =================================================================== RCS file: /cvsroot/src/sys/arch/hppa/hppa/vm_machdep.c,v retrieving revision 1.49 diff -u -p -u -r1.49 vm_machdep.c --- sys/arch/hppa/hppa/vm_machdep.c 24 Feb 2011 04:28:45 -0000 1.49 +++ sys/arch/hppa/hppa/vm_machdep.c 7 Mar 2012 18:45:32 -0000 @@ -81,9 +81,6 @@ void cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize, void (*func)(void *), void *arg) { - struct proc *p = l2->l_proc; - pmap_t pmap = p->p_vmspace->vm_map.pmap; - pa_space_t space = pmap->pm_space; struct pcb *pcb1, *pcb2; struct trapframe *tf; register_t sp, osp; @@ -128,22 +125,28 @@ cpu_lwp_fork(struct lwp *l1, struct lwp /* Fill out all the PAs we are going to need in locore. */ cpu_activate_pcb(l2); - /* Load all of the user's space registers. */ - tf->tf_sr0 = tf->tf_sr1 = tf->tf_sr3 = tf->tf_sr2 = - tf->tf_sr4 = tf->tf_sr5 = tf->tf_sr6 = space; - tf->tf_iisq_head = tf->tf_iisq_tail = space; - - /* Load the protection registers */ - tf->tf_pidr1 = tf->tf_pidr2 = pmap->pm_pid; - - /* - * theoretically these could be inherited from the father, - * but just in case. - */ - tf->tf_sr7 = HPPA_SID_KERNEL; - mfctl(CR_EIEM, tf->tf_eiem); - tf->tf_ipsw = PSW_C | PSW_Q | PSW_P | PSW_D | PSW_I /* | PSW_L */ | - (curcpu()->ci_psw & PSW_O); + if (__predict_true(l2->l_proc->p_vmspace != NULL)) { + struct proc *p = l2->l_proc; + pmap_t pmap = p->p_vmspace->vm_map.pmap; + pa_space_t space = pmap->pm_space; + + /* Load all of the user's space registers. */ + tf->tf_sr0 = tf->tf_sr1 = tf->tf_sr3 = tf->tf_sr2 = + tf->tf_sr4 = tf->tf_sr5 = tf->tf_sr6 = space; + tf->tf_iisq_head = tf->tf_iisq_tail = space; + + /* Load the protection registers */ + tf->tf_pidr1 = tf->tf_pidr2 = pmap->pm_pid; + + /* + * theoretically these could be inherited from the father, + * but just in case. + */ + tf->tf_sr7 = HPPA_SID_KERNEL; + mfctl(CR_EIEM, tf->tf_eiem); + tf->tf_ipsw = PSW_C | PSW_Q | PSW_P | PSW_D | PSW_I /* | PSW_L */ | + (curcpu()->ci_psw & PSW_O); + } /* * Set up return value registers as libc:fork() expects