summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2008-10-05 02:03:54 +0000
committerdavidxu <davidxu@FreeBSD.org>2008-10-05 02:03:54 +0000
commit8a22cb4e57315c423197fdd8e33d8acc966ce31d (patch)
tree760995dedfd24f6dc2b1fda1662e7620efc1f198 /sys/amd64
parent5a99959accd23f7ebe83e71fb61665cc0d70b22b (diff)
downloadFreeBSD-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.c8
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.
OpenPOWER on IntegriCloud