From owner-p4-projects@FreeBSD.ORG Fri Mar 12 15:09:31 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2200B16A4D1; Fri, 12 Mar 2004 15:09:31 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BCD1D16A4CE for ; Fri, 12 Mar 2004 15:09:30 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6C07143D2F for ; Fri, 12 Mar 2004 15:09:30 -0800 (PST) (envelope-from jmallett@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id i2CN9UGe017296 for ; Fri, 12 Mar 2004 15:09:30 -0800 (PST) (envelope-from jmallett@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id i2CN9ToM017293 for perforce@freebsd.org; Fri, 12 Mar 2004 15:09:29 -0800 (PST) (envelope-from jmallett@freebsd.org) Date: Fri, 12 Mar 2004 15:09:29 -0800 (PST) Message-Id: <200403122309.i2CN9ToM017293@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jmallett@freebsd.org using -f From: Juli Mallett To: Perforce Change Reviews Subject: PERFORCE change 48831 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2004 23:09:31 -0000 http://perforce.freebsd.org/chv.cgi?CH=48831 Change 48831 by jmallett@jmallett_oingo on 2004/03/12 15:08:44 Attempt to do cpu_fork, remove stuff now in swtch.S... Note that cpu_fork has two debugging printfs that i can't be bothered to clean out right now, until i have time to look at some other weirdness. Affected files ... .. //depot/projects/mips/sys/mips/mips/vm_machdep.c#9 edit Differences ... ==== //depot/projects/mips/sys/mips/mips/vm_machdep.c#9 (text+ko) ==== @@ -33,9 +33,11 @@ #include #include #include +#include #include #include #include +#include #include #include @@ -54,78 +56,114 @@ void cpu_exit(struct thread *td) { + panic("%s", __func__); } void cpu_fork(struct thread *td, struct proc *p2, struct thread *td2, int flags) { -} + struct trapframe *tf; + + if ((flags & RFPROC) == 0) + return; + + cpu_thread_setup(td2); + + /* Copy the pcb */ + printf("cpu_fork: copy from %p to %p\n", td->td_pcb, td2->td_pcb); + 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; + printf("cpu_fork: copy from fr %p to tf %p\n", td->td_frame, tf); + bcopy(td->td_frame, tf, sizeof(*tf)); + + /* Set up trap frame. */ + td2->td_frame = tf; -void -cpu_sched_exit(struct thread *td) -{ -} + /* + * Call fork_trampoline into fork_return via the pcb. + */ + 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; -void -cpu_switch(struct thread *old, struct thread *new) -{ + /* + * Now cpu_switch() can schedule the new process. + */ } void -cpu_throw(struct thread *old, struct thread *new) +cpu_sched_exit(struct thread *td) { - panic("cpu_throw"); + panic("%s", __func__); } void cpu_thread_exit(struct thread *td) { + panic("%s", __func__); } void cpu_thread_clean(struct thread *td) { + panic("%s", __func__); } void cpu_thread_setup(struct thread *td) { + td->td_pcb = + (struct pcb *)(td->td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; } void cpu_set_fork_handler(struct thread *td, void (*func)(void *), void *arg) { + panic("%s", __func__); } void cpu_thread_swapin(struct thread *td) { + panic("%s", __func__); } void cpu_thread_swapout(struct thread *td) { + panic("%s", __func__); } void cpu_set_upcall(struct thread *td, struct thread *td0) { + panic("%s", __func__); } void cpu_set_upcall_kse(struct thread *td, struct kse_upcall *ku) { + panic("%s", __func__); } struct sf_buf * sf_buf_alloc(struct vm_page *m) { + panic("%s", __func__); return (NULL); } void sf_buf_free(void *addr, void *args) { + panic("%s", __func__); } void