From owner-svn-src-projects@FreeBSD.ORG Sun Jun 1 21:33:04 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 304C531C; Sun, 1 Jun 2014 21:33:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1DD5322F0; Sun, 1 Jun 2014 21:33:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s51LX3Jh091693; Sun, 1 Jun 2014 21:33:03 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s51LX3I2091688; Sun, 1 Jun 2014 21:33:03 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201406012133.s51LX3I2091688@svn.freebsd.org> From: Andrew Turner Date: Sun, 1 Jun 2014 21:33:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r266957 - in projects/arm64/sys/arm64: arm64 include X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jun 2014 21:33:04 -0000 Author: andrew Date: Sun Jun 1 21:33:02 2014 New Revision: 266957 URL: http://svnweb.freebsd.org/changeset/base/266957 Log: Add cpu_thread_alloc and start on cpu_fork Modified: projects/arm64/sys/arm64/arm64/vm_machdep.c projects/arm64/sys/arm64/include/frame.h projects/arm64/sys/arm64/include/param.h projects/arm64/sys/arm64/include/proc.h Modified: projects/arm64/sys/arm64/arm64/vm_machdep.c ============================================================================== --- projects/arm64/sys/arm64/arm64/vm_machdep.c Sun Jun 1 21:30:45 2014 (r266956) +++ projects/arm64/sys/arm64/arm64/vm_machdep.c Sun Jun 1 21:33:02 2014 (r266957) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -40,6 +41,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include /* * Finish a fork operation, with process p2 nearly set up. @@ -49,8 +52,21 @@ __FBSDID("$FreeBSD$"); void cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) { + struct pcb *pcb2; - panic("cpu_fork"); + if ((flags & RFPROC) == 0) + return; + + pcb2 = (struct pcb *)(td2->td_kstack + + td2->td_kstack_pages * PAGE_SIZE) - 1; + + td2->td_pcb = pcb2; + bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); + + /* Set the return value registers for fork() */ + td1->td_frame->tf_x[0] = 0; + + printf("TODO: cpu_fork"); } void @@ -120,7 +136,10 @@ void cpu_thread_alloc(struct thread *td) { - panic("cpu_thread_alloc"); + td->td_pcb = (struct pcb *)(td->td_kstack + + td->td_kstack_pages * PAGE_SIZE) - 1; + td->td_frame = (struct trapframe *)STACKALIGN( + td->td_pcb - 1); } void Modified: projects/arm64/sys/arm64/include/frame.h ============================================================================== --- projects/arm64/sys/arm64/include/frame.h Sun Jun 1 21:30:45 2014 (r266956) +++ projects/arm64/sys/arm64/include/frame.h Sun Jun 1 21:33:02 2014 (r266957) @@ -35,7 +35,7 @@ * NOTE: keep this structure in sync with struct reg and struct mcontext. */ struct trapframe { - uint64_t tf_x0[31]; + uint64_t tf_x[31]; uint64_t tf_sp; uint64_t tf_pc; uint64_t tf_spsr; Modified: projects/arm64/sys/arm64/include/param.h ============================================================================== --- projects/arm64/sys/arm64/include/param.h Sun Jun 1 21:30:45 2014 (r266956) +++ projects/arm64/sys/arm64/include/param.h Sun Jun 1 21:33:02 2014 (r266957) @@ -39,6 +39,9 @@ #include +#define STACKALIGNBYTES (16 - 1) +#define STACKALIGN(p) ((uint64_t)(p) & ~STACKALIGNBYTES) + #ifndef MACHINE #define MACHINE "arm64" #endif Modified: projects/arm64/sys/arm64/include/proc.h ============================================================================== --- projects/arm64/sys/arm64/include/proc.h Sun Jun 1 21:30:45 2014 (r266956) +++ projects/arm64/sys/arm64/include/proc.h Sun Jun 1 21:33:02 2014 (r266957) @@ -36,10 +36,12 @@ #include +#if 0 struct md_utrap { utrap_entry_t *ut_precise[UT_MAX]; /* must be first */ int ut_refcnt; }; +#endif struct mdthread { int md_spinlock_count; /* (k) */ @@ -47,8 +49,7 @@ struct mdthread { }; struct mdproc { - struct md_utrap *md_utrap; - void *md_sigtramp; + int dummy; }; #define KINFO_PROC_SIZE 1088