diff options
author | bde <bde@FreeBSD.org> | 2002-01-10 11:49:55 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 2002-01-10 11:49:55 +0000 |
commit | 4bc93bce9562a8b9fef41567055aa1f18006ced3 (patch) | |
tree | 7871d96b3c7a4dfee1d7378681c22b9b12eb2708 /sys/amd64 | |
parent | f267ba5cc73797843de3904ea9c79682ad9674ad (diff) | |
download | FreeBSD-src-4bc93bce9562a8b9fef41567055aa1f18006ced3.zip FreeBSD-src-4bc93bce9562a8b9fef41567055aa1f18006ced3.tar.gz |
Clear the single-step flag for signal handlers. This fixes bogus trace
traps on the first instruction of signal handlers.
In trap.c:syscall(), fake a trace trap if the single-step flag was set
on entry to the kernel, not if it will be set on exit from the kernel.
This fixes bogus trace traps after the last instruction of signal handlers.
gdb-4.18 (the version in FreeBSD) still has problems with the program in
the PR. These seem to be due to bugs in gdb and not in FreeBSD, and are
fixed in gdb-5.1 (the distribution version).
PR: 33262
Tested by: k Macy <kip_macy@yahoo.com>
MFC after: 1 day
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/machdep.c | 10 | ||||
-rw-r--r-- | sys/amd64/amd64/trap.c | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 7938159..d361a27 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -401,7 +401,7 @@ osendsig(catcher, sig, mask, code) (vm86->vm86_eflags & (PSL_VIF | PSL_VIP)); /* See sendsig() for comments. */ - tf->tf_eflags &= ~(PSL_VM | PSL_NT | PSL_T | PSL_VIF | PSL_VIP); + tf->tf_eflags &= ~(PSL_VM | PSL_NT | PSL_VIF | PSL_VIP); } /* Copy the sigframe out to the user's stack. */ @@ -417,6 +417,7 @@ osendsig(catcher, sig, mask, code) regs->tf_esp = (int)fp; regs->tf_eip = PS_STRINGS - szosigcode; + regs->tf_eflags &= ~PSL_T; regs->tf_cs = _ucodesel; regs->tf_ds = _udatasel; regs->tf_es = _udatasel; @@ -546,17 +547,13 @@ sendsig(catcher, sig, mask, code) (vm86->vm86_eflags & (PSL_VIF | PSL_VIP)); /* - * We should never have PSL_T set when returning from vm86 - * mode. It may be set here if we deliver a signal before - * getting to vm86 mode, so turn it off. - * * Clear PSL_NT to inhibit T_TSSFLT faults on return from * syscalls made by the signal handler. This just avoids * wasting time for our lazy fixup of such faults. PSL_NT * does nothing in vm86 mode, but vm86 programs can set it * almost legitimately in probes for old cpu types. */ - tf->tf_eflags &= ~(PSL_VM | PSL_NT | PSL_T | PSL_VIF | PSL_VIP); + tf->tf_eflags &= ~(PSL_VM | PSL_NT | PSL_VIF | PSL_VIP); } /* Copy the sigframe out to the user's stack. */ @@ -572,6 +569,7 @@ sendsig(catcher, sig, mask, code) regs->tf_esp = (int)sfp; regs->tf_eip = PS_STRINGS - *(p->p_sysent->sv_szsigcode); + regs->tf_eflags &= ~PSL_T; regs->tf_cs = _ucodesel; regs->tf_ds = _udatasel; regs->tf_es = _udatasel; diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 44bb000..07067c4 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -933,6 +933,7 @@ syscall(frame) struct sysent *callp; struct thread *td = curthread; struct proc *p = td->td_proc; + register_t orig_tf_eflags; u_int sticks; int error; int narg; @@ -958,6 +959,7 @@ syscall(frame) PROC_UNLOCK(p); params = (caddr_t)frame.tf_esp + sizeof(int); code = frame.tf_eax; + orig_tf_eflags = frame.tf_eflags; if (p->p_sysent->sv_prepsyscall) { /* @@ -1065,7 +1067,7 @@ bad: /* * Traced syscall. */ - if ((frame.tf_eflags & PSL_T) && !(frame.tf_eflags & PSL_VM)) { + if ((orig_tf_eflags & PSL_T) && !(orig_tf_eflags & PSL_VM)) { frame.tf_eflags &= ~PSL_T; trapsignal(p, SIGTRAP, 0); } |