if ((tsk->ptrace & (PT_DTRACE|PT_PTRACED)) == PT_DTRACE) goto clear_TF; 
/* * Was the TF flag set by a debugger? If so, clear it now, * so that register information is correct. */ if (tsk->ptrace & PT_DTRACE) { regs->eflags &= ~TF_MASK; tsk->ptrace &= ~PT_DTRACE; } 
asmlinkage void *do_debug(struct pt_regs * regs, unsigned long error_code){	struct pt_regs *pr;	unsigned long condition;	struct task_struct *tsk = current;	siginfo_t info;	pr = (struct pt_regs *)(current->thread.rsp0)-1;	if (regs->cs & 3) {		memcpy(pr, regs, sizeof(struct pt_regs));		regs = pr;	}	#ifdef CONFIG_CHECKING       { 	       /* RED-PEN interaction with debugger - could destroy gs */               unsigned long gs;                struct x8664_pda *pda = cpu_pda + safe_smp_processor_id();                rdmsrl(MSR_GS_BASE, gs);                if (gs != (unsigned long)pda) {                        wrmsrl(MSR_GS_BASE, pda);                        printk("debug handler: wrong gs %lx expected %p\n", gs, pda);               }       }#endif	asm("movq %%db6,%0" : "=r" (condition));	if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code,						SIGTRAP) == NOTIFY_STOP) {		return regs;	}	conditional_sti(regs);	/* Mask out spurious debug traps due to lazy DR7 setting */	if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3)) {		if (!tsk->thread.debugreg7) { 			goto clear_dr7;		}	}	tsk->thread.debugreg6 = condition;	/* Mask out spurious TF errors due to lazy TF clearing */	if ((condition & DR_STEP) &&	    (notify_die(DIE_DEBUGSTEP, "debugstep", regs, condition,			1, SIGTRAP) != NOTIFY_STOP)) {		/*		 * The TF error should be masked out only if the current		 * process is not traced and if the TRAP flag has been set		 * previously by a tracing process (condition detected by		 * the PT_DTRACE flag); remember that the i386 TRAP flag		 * can be modified by the process itself in user mode,		 * allowing programs to debug themselves without the ptrace()		 * interface.		 */                if ((regs->cs & 3) == 0)                       goto clear_TF_reenable;		if ((tsk->ptrace & (PT_DTRACE|PT_PTRACED)) == PT_DTRACE)			goto clear_TF;	}	/* Ok, finally something we can handle */	tsk->thread.trap_no = 1;	tsk->thread.error_code = error_code;	info.si_signo = SIGTRAP;	info.si_errno = 0;	info.si_code = TRAP_BRKPT;	if ((regs->cs & 3) == 0) 		goto clear_dr7; 	info.si_addr = (void __user *)regs->rip;	force_sig_info(SIGTRAP, &info, tsk);	clear_dr7:	asm volatile("movq %0,%%db7"::"r"(0UL));	notify_die(DIE_DEBUG, "debug", regs, condition, 1, SIGTRAP);	return regs;clear_TF_reenable:	set_tsk_thread_flag(tsk, TIF_SINGLESTEP);clear_TF:	/* RED-PEN could cause spurious errors */	if (notify_die(DIE_DEBUG, "debug2", regs, condition, 1, SIGTRAP) 								!= NOTIFY_STOP)	regs->eflags &= ~TF_MASK;	return regs;	}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/be61bff789fe44bfb6d9282d8f7eccc860bdcfb6/traps.c/clean/arch/x86_64/kernel/traps.c