diff options
author | davidxu <davidxu@FreeBSD.org> | 2008-10-05 02:03:54 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2008-10-05 02:03:54 +0000 |
commit | 8a22cb4e57315c423197fdd8e33d8acc966ce31d (patch) | |
tree | 760995dedfd24f6dc2b1fda1662e7620efc1f198 /sys/amd64 | |
parent | 5a99959accd23f7ebe83e71fb61665cc0d70b22b (diff) | |
download | FreeBSD-src-8a22cb4e57315c423197fdd8e33d8acc966ce31d.zip FreeBSD-src-8a22cb4e57315c423197fdd8e33d8acc966ce31d.tar.gz |
If the current thread 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. Otherwise, the new thread will
receive a (likely unexpected) SIGTRAP when it executes the first
instruction after returning to userland.
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/vm_machdep.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index adddc1c..0cc9b03 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -280,6 +280,14 @@ cpu_set_upcall(struct thread *td, struct thread *td0) */ bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); + /* If the current thread 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. Otherwise, the new thread will + * receive a (likely unexpected) SIGTRAP when it executes the first + * instruction after returning to userland. + */ + td->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. |