summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2002-01-10 11:49:55 +0000
committerbde <bde@FreeBSD.org>2002-01-10 11:49:55 +0000
commit4bc93bce9562a8b9fef41567055aa1f18006ced3 (patch)
tree7871d96b3c7a4dfee1d7378681c22b9b12eb2708 /sys/i386
parentf267ba5cc73797843de3904ea9c79682ad9674ad (diff)
downloadFreeBSD-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/i386')
-rw-r--r--sys/i386/i386/machdep.c10
-rw-r--r--sys/i386/i386/trap.c4
-rw-r--r--sys/i386/linux/linux_sysvec.c4
-rw-r--r--sys/i386/svr4/svr4_machdep.c1
4 files changed, 10 insertions, 9 deletions
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index 7938159..d361a27 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/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/i386/i386/trap.c b/sys/i386/i386/trap.c
index 44bb000..07067c4 100644
--- a/sys/i386/i386/trap.c
+++ b/sys/i386/i386/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);
}
diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c
index 0247c58..bddc42d 100644
--- a/sys/i386/linux/linux_sysvec.c
+++ b/sys/i386/linux/linux_sysvec.c
@@ -385,7 +385,7 @@ linux_rt_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
regs->tf_esp = (int)fp;
regs->tf_eip = PS_STRINGS - *(p->p_sysent->sv_szsigcode) +
linux_sznonrtsigcode;
- regs->tf_eflags &= ~PSL_VM;
+ regs->tf_eflags &= ~(PSL_T | PSL_VM);
regs->tf_cs = _ucodesel;
regs->tf_ds = _udatasel;
regs->tf_es = _udatasel;
@@ -519,7 +519,7 @@ linux_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
*/
regs->tf_esp = (int)fp;
regs->tf_eip = PS_STRINGS - *(p->p_sysent->sv_szsigcode);
- regs->tf_eflags &= ~PSL_VM;
+ regs->tf_eflags &= ~(PSL_T | PSL_VM);
regs->tf_cs = _ucodesel;
regs->tf_ds = _udatasel;
regs->tf_es = _udatasel;
diff --git a/sys/i386/svr4/svr4_machdep.c b/sys/i386/svr4/svr4_machdep.c
index 9355772..42e565c 100644
--- a/sys/i386/svr4/svr4_machdep.c
+++ b/sys/i386/svr4/svr4_machdep.c
@@ -492,6 +492,7 @@ svr4_sendsig(catcher, sig, mask, code)
#else
tf->tf_esp = (int)fp;
tf->tf_eip = (int)(((char *)PS_STRINGS) - *(p->p_sysent->sv_szsigcode));
+ tf->tf_eflags &= ~PSL_T;
tf->tf_cs = _ucodesel;
tf->tf_ds = _udatasel;
tf->tf_es = _udatasel;
OpenPOWER on IntegriCloud