svn commit: r270452 - projects/arm64/sys/arm64/arm64
Andrew Turner
andrew at FreeBSD.org
Sun Aug 24 10:36:05 UTC 2014
Author: andrew
Date: Sun Aug 24 10:36:04 2014
New Revision: 270452
URL: http://svnweb.freebsd.org/changeset/base/270452
Log:
Return to userland at the end of fork_trampoline. Signal handling is
missing as we don't yet support signals.
Modified:
projects/arm64/sys/arm64/arm64/genassym.c
projects/arm64/sys/arm64/arm64/swtch.S
Modified: projects/arm64/sys/arm64/arm64/genassym.c
==============================================================================
--- projects/arm64/sys/arm64/arm64/genassym.c Sun Aug 24 10:33:54 2014 (r270451)
+++ projects/arm64/sys/arm64/arm64/genassym.c Sun Aug 24 10:36:04 2014 (r270452)
@@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
#include <sys/pcpu.h>
#include <sys/proc.h>
+#include <machine/frame.h>
#include <machine/pcb.h>
#include <machine/vmparam.h>
@@ -49,3 +50,4 @@ ASSYM(PCB_L1ADDR, offsetof(struct pcb, p
ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
ASSYM(TD_LOCK, offsetof(struct thread, td_lock));
+ASSYM(TF_X, offsetof(struct trapframe, tf_x));
Modified: projects/arm64/sys/arm64/arm64/swtch.S
==============================================================================
--- projects/arm64/sys/arm64/arm64/swtch.S Sun Aug 24 10:33:54 2014 (r270451)
+++ projects/arm64/sys/arm64/arm64/swtch.S Sun Aug 24 10:36:04 2014 (r270452)
@@ -146,7 +146,40 @@ ENTRY(fork_trampoline)
mov x2, sp
bl _C_LABEL(fork_exit)
- brk 1
+ /* Back up the stack pointer */
+ mov x0, sp
+
+ /* Restore sp and lr */
+ ldp x2, x3, [x0]
+ msr sp_el0, x2
+ mov lr, x3
+
+ /* Restore elr and spsr */
+ ldp x2, x3, [x0, #16]
+ msr elr_el1, x2
+ msr spsr_el1, x3
+
+ /* Restore the registers other than x0 and x1 */
+ ldp x2, x3, [x0, #TF_X + 2 * 8]
+ ldp x4, x5, [x0, #TF_X + 4 * 8]
+ ldp x6, x7, [x0, #TF_X + 6 * 8]
+ ldp x8, x9, [x0, #TF_X + 8 * 8]
+ ldp x10, x11, [x0, #TF_X + 10 * 8]
+ ldp x12, x13, [x0, #TF_X + 12 * 8]
+ ldp x14, x15, [x0, #TF_X + 14 * 8]
+ ldp x16, x17, [x0, #TF_X + 16 * 8]
+ ldp x18, x19, [x0, #TF_X + 18 * 8]
+ ldp x20, x21, [x0, #TF_X + 20 * 8]
+ ldp x22, x23, [x0, #TF_X + 22 * 8]
+ 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]
+
+ /* Finally x0 and x1 */
+ ldp x0, x1, [x0, #TF_X + 0 * 8]
+
+ eret
END(fork_trampoline)
More information about the svn-src-projects
mailing list