Date: Sun, 1 Jun 2014 21:33:03 +0000 (UTC) From: Andrew Turner <andrew@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r266957 - in projects/arm64/sys/arm64: arm64 include Message-ID: <201406012133.s51LX3I2091688@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <sys/proc.h> #include <sys/sf_buf.h> #include <sys/signal.h> +#include <sys/unistd.h> #include <vm/vm.h> #include <vm/vm_page.h> @@ -40,6 +41,8 @@ __FBSDID("$FreeBSD$"); #include <vm/uma_int.h> #include <machine/cpu.h> +#include <machine/pcb.h> +#include <machine/frame.h> /* * 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 <machine/_align.h> +#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 <machine/utrap.h> +#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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406012133.s51LX3I2091688>