Date: Sat, 13 Mar 2004 17:57:02 -0800 (PST) From: Juli Mallett <jmallett@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 48933 for review Message-ID: <200403140157.i2E1v24S019278@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=48933 Change 48933 by jmallett@jmallett_oingo on 2004/03/13 17:56:46 Fumble around looking for what could be wrong... Affected files ... .. //depot/projects/mips/sys/mips/mips/vm_machdep.c#12 edit Differences ... ==== //depot/projects/mips/sys/mips/mips/vm_machdep.c#12 (text+ko) ==== @@ -62,7 +62,6 @@ void cpu_fork(struct thread *td, struct proc *p2, struct thread *td2, int flags) { - struct trapframe *tf; if ((flags & RFPROC) == 0) return; @@ -73,15 +72,13 @@ bcopy(td->td_pcb, td2->td_pcb, sizeof(struct pcb)); /* - * Create a fresh stack for the new process. * Copy the trap frame for the return to user mode as if from a * syscall. This copies most of the user mode register values. */ - tf = (struct trapframe *)td2->td_pcb - 1; - bcopy(td->td_frame, tf, sizeof(*tf)); + bcopy(td->td_frame, td2->td_frame, sizeof *td2->td_frame); - /* Set up trap frame. */ - td2->td_frame = tf; + /* And lastly, stack pointer, begin a trapframe below frame. */ + td2->td_pcb->pcb_regs[8] = (register_t)_ALIGN(td2->td_frame - 1); /* * Call fork_trampoline into fork_return via the pcb. @@ -89,7 +86,7 @@ td2->td_pcb->pcb_regs[10] = (register_t)fork_trampoline; td2->td_pcb->pcb_regs[0] = (register_t)fork_return; td2->td_pcb->pcb_regs[1] = (register_t)td2; - td2->td_pcb->pcb_regs[2] = (register_t)tf; + td2->td_pcb->pcb_regs[2] = (register_t)td2->td_frame; /* * Now cpu_switch() can schedule the new process. @@ -135,8 +132,9 @@ void cpu_set_fork_handler(struct thread *td, void (*func)(void *), void *arg) { - td->td_pcb->pcb_regs[10] = (register_t)func; - td->td_pcb->pcb_regs[0] = (register_t)arg; + if (savectx(td->td_pcb)) { + (*func)(arg); + } } void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200403140157.i2E1v24S019278>