svn commit: r281554 - head/sys/arm64/arm64
Andrew Turner
andrew at FreeBSD.org
Wed Apr 15 14:18:27 UTC 2015
Author: andrew
Date: Wed Apr 15 14:18:25 2015
New Revision: 281554
URL: https://svnweb.freebsd.org/changeset/base/281554
Log:
Ensure the userland thread and floating-point state has been saved before
copying the pcb. These values may have been changed just before the call
to fork and without a call to cpu_switch, where they would have been saved.
Sponsored by: The FreeBSD Foundation
Modified:
head/sys/arm64/arm64/vm_machdep.c
Modified: head/sys/arm64/arm64/vm_machdep.c
==============================================================================
--- head/sys/arm64/arm64/vm_machdep.c Wed Apr 15 11:48:41 2015 (r281553)
+++ head/sys/arm64/arm64/vm_machdep.c Wed Apr 15 14:18:25 2015 (r281554)
@@ -47,6 +47,10 @@ __FBSDID("$FreeBSD$");
#include <machine/pcb.h>
#include <machine/frame.h>
+#ifdef VFP
+#include <machine/vfp.h>
+#endif
+
/*
* Finish a fork operation, with process p2 nearly set up.
* Copy and update the pcb, set up the stack so that the child
@@ -61,6 +65,19 @@ cpu_fork(struct thread *td1, struct proc
if ((flags & RFPROC) == 0)
return;
+ if (td1 == curthread) {
+ /*
+ * Save the tpidr_el0 and the vfp state, these normally happen
+ * in cpu_switch, but if userland changes these then forks
+ * this may not have happened.
+ */
+ td1->td_pcb->pcb_tpidr_el0 = READ_SPECIALREG(tpidr_el0);
+#ifdef VFP
+ if ((td1->td_pcb->pcb_fpflags & PCB_FP_STARTED) != 0)
+ vfp_save_state(td1);
+#endif
+ }
+
pcb2 = (struct pcb *)(td2->td_kstack +
td2->td_kstack_pages * PAGE_SIZE) - 1;
More information about the svn-src-all
mailing list