summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2005-01-21 05:57:45 +0000
committerpeter <peter@FreeBSD.org>2005-01-21 05:57:45 +0000
commit63c4d6030676332d662005c8750ef471df3e8bfe (patch)
tree5006e894340be91f6e5add0732fbe242fe54276f
parente6f6e38169350b9e71bfe8309e0c4c989925a7c2 (diff)
downloadFreeBSD-src-63c4d6030676332d662005c8750ef471df3e8bfe.zip
FreeBSD-src-63c4d6030676332d662005c8750ef471df3e8bfe.tar.gz
MFi386: handle PSL_T properly across fork. Typo fix.
-rw-r--r--sys/amd64/amd64/vm_machdep.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index d784d02..9b99812 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/mutex.h>
+#include <sys/pioctl.h>
#include <sys/proc.h>
#include <sys/sf_buf.h>
#include <sys/smp.h>
@@ -133,6 +134,17 @@ cpu_fork(td1, p2, td2, flags)
td2->td_frame->tf_rdx = 1;
/*
+ * If the parent process has the trap bit set (i.e. a debugger had
+ * single stepped the process to the system call), we need to clear
+ * the trap flag from the new frame unless the debugger had set PF_FORK
+ * on the parent. Otherwise, the child will receive a (likely
+ * unexpected) SIGTRAP when it executes the first instruction after
+ * returning to userland.
+ */
+ if ((p1->p_pfsflags & PF_FORK) == 0)
+ td2->td_frame->tf_rflags &= ~PSL_T;
+
+ /*
* Set registers for trampoline to user mode. Leave space for the
* return address on stack. These are the kernel mode register values.
*/
@@ -227,7 +239,7 @@ cpu_thread_setup(struct thread *td)
/*
* Initialize machine state (pcb and trap frame) for a new thread about to
- * upcall. Pu t enough state in the new thread's PCB to get it to go back
+ * upcall. Put enough state in the new thread's PCB to get it to go back
* userret(), where we can intercept it again to set the return (upcall)
* Address and stack, along with those from upcals that are from other sources
* such as those generated in thread_userret() itself.
OpenPOWER on IntegriCloud