# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.155 -> 1.156 # arch/i386/kernel/traps.c 1.11 -> 1.12 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 02/02/22 hch@sb.bsdonline.org 1.156 # Clear TF flag when the kernel was entered using lcall7. # (Patch from Stephan Springl) # -------------------------------------------- # diff -Nru a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c --- a/arch/i386/kernel/traps.c Mon Feb 25 20:14:35 2002 +++ b/arch/i386/kernel/traps.c Mon Feb 25 20:14:35 2002 @@ -478,9 +478,29 @@ { unsigned int condition; struct task_struct *tsk = current; + unsigned long eip = regs->eip; siginfo_t info; __asm__ __volatile__("movl %%db6,%0" : "=r" (condition)); + + /* + * Entering the kernel via lcall7 or lcall27 does not clear the TF bit. + * Leaving it set in kernel code will stop the machine. The first + * instructions of lcall7 and lcall27 in entry.S save the CPU flags. + * The saved flags should have the TF bit set, so we ignore this trap. + */ + if (eip == (unsigned long)&lcall7 || eip == (unsigned long)&lcall27) + return; + + /* + * After having saved the flags, TF will fire the single step trap + * again. This time TF should be cleared. It will be restored by the + * iret instruction returning to user mode. This way, the very next + * instruction after lcall in the user programm will not be stopped at. + */ + eip--; /* pushfl is a one-byte opcode */ + if (eip == (unsigned long)&lcall7 || eip == (unsigned long)&lcall27) + goto clear_TF; /* Mask out spurious debug traps due to lazy DR7 setting */ if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3)) {