svn commit: r270804 - projects/arm64/sys/arm64/arm64

Andrew Turner andrew at FreeBSD.org
Fri Aug 29 11:02:51 UTC 2014


Author: andrew
Date: Fri Aug 29 11:02:50 2014
New Revision: 270804
URL: http://svnweb.freebsd.org/changeset/base/270804

Log:
  Get cpu_fork working, place the trapframe on the stack and set the
  registers as needed. We also need to stop overwriting the link register
  in fork_trampoline otherwise it will become 0.

Modified:
  projects/arm64/sys/arm64/arm64/swtch.S
  projects/arm64/sys/arm64/arm64/vm_machdep.c

Modified: projects/arm64/sys/arm64/arm64/swtch.S
==============================================================================
--- projects/arm64/sys/arm64/arm64/swtch.S	Fri Aug 29 10:44:58 2014	(r270803)
+++ projects/arm64/sys/arm64/arm64/swtch.S	Fri Aug 29 11:02:50 2014	(r270804)
@@ -174,7 +174,7 @@ ENTRY(fork_trampoline)
 	ldp	x24, x25, [x0, #TF_X + 24 * 8]
 	ldp	x26, x27, [x0, #TF_X + 26 * 8]
 	ldp	x28, x29, [x0, #TF_X + 28 * 8]
-	ldr	x30, [x0, #TF_X + 30 * 8]
+	/* Skip x30 as it was restored above as lr */
 
 	/* Finally x0 and x1 */
 	ldp	x0, x1, [x0, #TF_X + 0 * 8]

Modified: projects/arm64/sys/arm64/arm64/vm_machdep.c
==============================================================================
--- projects/arm64/sys/arm64/arm64/vm_machdep.c	Fri Aug 29 10:44:58 2014	(r270803)
+++ projects/arm64/sys/arm64/arm64/vm_machdep.c	Fri Aug 29 11:02:50 2014	(r270804)
@@ -53,6 +53,7 @@ void
 cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
 {
 	struct pcb *pcb2;
+	struct trapframe *tf;
 
 	if ((flags & RFPROC) == 0)
 		return;
@@ -65,6 +66,14 @@ cpu_fork(struct thread *td1, struct proc
 
 	pmap_activate(td2);
 
+	tf = (struct trapframe *)STACKALIGN((struct trapframe *)pcb2 - 1);
+	bcopy(td1->td_frame, tf, sizeof(*tf));
+	tf->tf_x[0] = 0;
+	tf->tf_x[1] = 0;
+	tf->tf_spsr = 0;
+
+	td2->td_frame = tf;
+
 	/* Set the return value registers for fork() */
 	td2->td_pcb->pcb_x[8] = (uintptr_t)fork_return;
 	td2->td_pcb->pcb_x[9] = (uintptr_t)td2;


More information about the svn-src-projects mailing list