MFi386: handle PSL_T properly across fork. Typo fix.
This commit is contained in:
parent
ba2426ff44
commit
4fe91893a6
@ -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>
|
||||
@ -132,6 +133,17 @@ cpu_fork(td1, p2, td2, flags)
|
||||
td2->td_frame->tf_rflags &= ~PSL_C; /* success */
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user