From patchwork Wed Jul 8 23:46:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Kleikamp X-Patchwork-Id: 29616 Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id E8DD2B7090 for ; Thu, 9 Jul 2009 09:46:50 +1000 (EST) Received: by ozlabs.org (Postfix) id DAAB6DDDE9; Thu, 9 Jul 2009 09:46:50 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (bilbo.ozlabs.org [203.10.76.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "bilbo.ozlabs.org", Issuer "CAcert Class 3 Root" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id D862EDDDE6 for ; Thu, 9 Jul 2009 09:46:50 +1000 (EST) Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by bilbo.ozlabs.org (Postfix) with ESMTP id F14C9B730B for ; Thu, 9 Jul 2009 09:46:30 +1000 (EST) Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4843AB708E for ; Thu, 9 Jul 2009 09:46:25 +1000 (EST) Received: by ozlabs.org (Postfix) id 37945DDDE9; Thu, 9 Jul 2009 09:46:25 +1000 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from e38.co.us.ibm.com (e38.co.us.ibm.com [32.97.110.159]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "e38.co.us.ibm.com", Issuer "Equifax" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id CD4E2DDDE1 for ; Thu, 9 Jul 2009 09:46:24 +1000 (EST) Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e38.co.us.ibm.com (8.13.1/8.13.1) with ESMTP id n68Nh6nn018361 for ; Wed, 8 Jul 2009 17:43:06 -0600 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n68NkKjQ257498 for ; Wed, 8 Jul 2009 17:46:21 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n68NkKRB021871 for ; Wed, 8 Jul 2009 17:46:20 -0600 Received: from [9.65.220.93] (sig-9-65-220-93.mts.ibm.com [9.65.220.93]) by d03av04.boulder.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n68NkJQE021852; Wed, 8 Jul 2009 17:46:20 -0600 Subject: [PATCH] powerpc: fix booke user_disable_single_step() From: Dave Kleikamp To: Benjamin Herrenschmidt Date: Wed, 08 Jul 2009 18:46:18 -0500 Message-Id: <1247096778.22069.1.camel@norville.austin.ibm.com> Mime-Version: 1.0 X-Mailer: Evolution 2.24.5 Cc: ppc-dev X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org On booke processors, gdb is seeing spurious SIGTRAPs when setting a watchpoint. user_disable_single_step() simply quits when the DAC is non-zero. It should be clearing the DBCR0_IC and DBCR0_BT bits from the dbcr0 register and TIF_SINGLESTEP from the thread flag. Signed-off-by: Dave Kleikamp diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index 9fa2c7d..ef14988 100644 --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c @@ -736,15 +736,16 @@ void user_disable_single_step(struct task_struct *task) { struct pt_regs *regs = task->thread.regs; - -#if defined(CONFIG_BOOKE) - /* If DAC then do not single step, skip */ - if (task->thread.dabr) - return; -#endif - if (regs != NULL) { -#if defined(CONFIG_40x) || defined(CONFIG_BOOKE) +#if defined(CONFIG_BOOKE) + /* If DAC don't clear DBCRO_IDM or MSR_DE */ + if (task->thread.dabr) + task->thread.dbcr0 &= ~(DBCR0_IC | DBCR0_BT); + else { + task->thread.dbcr0 &= ~(DBCR0_IC | DBCR0_BT | DBCR0_IDM); + regs->msr &= ~MSR_DE; + } +#elif defined(CONFIG_40x) task->thread.dbcr0 &= ~(DBCR0_IC | DBCR0_BT | DBCR0_IDM); regs->msr &= ~MSR_DE; #else