From patchwork Wed Apr 1 21:59:03 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland McGrath X-Patchwork-Id: 25501 X-Patchwork-Delegate: benh@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 652BBDE057 for ; Thu, 2 Apr 2009 08:59:48 +1100 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from mx1.redhat.com (mx1.redhat.com [66.187.233.31]) by ozlabs.org (Postfix) with ESMTP id 0ABA8DDE06 for ; Thu, 2 Apr 2009 08:59:09 +1100 (EST) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n31Lx7BW027293; Wed, 1 Apr 2009 17:59:07 -0400 Received: from gateway.sf.frob.com (vpn-13-23.rdu.redhat.com [10.11.13.23]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n31Lx7Vh021175; Wed, 1 Apr 2009 17:59:08 -0400 Received: from magilla.sf.frob.com (magilla.sf.frob.com [198.49.250.228]) by gateway.sf.frob.com (Postfix) with ESMTP id 24000357B; Wed, 1 Apr 2009 13:59:04 -0800 (PST) Received: by magilla.sf.frob.com (Postfix, from userid 5281) id DE872FC3AB; Wed, 1 Apr 2009 14:59:03 -0700 (PDT) MIME-Version: 1.0 From: Roland McGrath To: Maynard Johnson X-Fcc: ~/Mail/linus Subject: [PATCH] powerpc ptrace block-step X-zippy-says: Talking Pinhead Blues: Oh, I LOST my ``HELLO KITTY'' DOLL and I get BAD reception on channel TWENTY-SIX!! Th'HOSTESS FACTORY is closin' down and I just heard ZASU PITTS has been DEAD for YEARS.. (sniff) My PLATFORM SHOE collection was CHEWED up by th'dog, ALEXANDER HAIG won't let me take a SHOWER 'til Easter.. (snurf) So I went to the kitchen, but WALNUT PANELING whup me upside mah HAID!! (on no, no, no.. Heh, heh) Message-Id: <20090401215903.DE872FC3AB@magilla.sf.frob.com> Date: Wed, 1 Apr 2009 14:59:03 -0700 (PDT) X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Cc: linuxppc-dev@ozlabs.org, utrace-devel@redhat.com X-BeenThere: linuxppc-dev@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@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Maynard asked about user_enable_block_step() support on powerpc. This is the old patch I've posted before. I haven't even tried to compile it lately, but it rebased cleanly. AFAIK the only reason this didn't go in several months ago was waiting for someone to decide what the right arch_has_block_step() condition was, i.e. if it needs to check some cpu_feature or chip identifier bits. I had hoped that I had passed the buck then to ppc folks to figure that out and make it so. But it does not appear to have happened. Note you can drop the #define PTRACE_SINGLEBLOCK if you want to be conservative and not touch the user (ptrace) ABI yet. Then Maynard could beat on it with internal uses (utrace) before you worry about whether userland expects the new ptrace request macro to exist. Thanks, Roland --- From 2482ed1a0ced9caf964275889ea2315916e84ada Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 1 May 2008 23:40:58 -0700 Subject: [PATCH] powerpc ptrace block-step This adds block-step support on powerpc, including a PTRACE_SINGLEBLOCK request for ptrace. Signed-off-by: Roland McGrath --- arch/powerpc/include/asm/ptrace.h | 4 ++++ arch/powerpc/kernel/ptrace.c | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h index c9c678f..d7692b8 100644 --- a/arch/powerpc/include/asm/ptrace.h +++ b/arch/powerpc/include/asm/ptrace.h @@ -135,7 +135,9 @@ do { \ * These are defined as per linux/ptrace.h, which see. */ #define arch_has_single_step() (1) +#define arch_has_block_step() (1) extern void user_enable_single_step(struct task_struct *); +extern void user_enable_block_step(struct task_struct *); extern void user_disable_single_step(struct task_struct *); #endif /* __ASSEMBLY__ */ @@ -288,4 +290,6 @@ extern void user_disable_single_step(struct task_struct *); #define PPC_PTRACE_PEEKUSR_3264 0x91 #define PPC_PTRACE_POKEUSR_3264 0x90 +#define PTRACE_SINGLEBLOCK 0x100 /* resume execution until next branch */ + #endif /* _ASM_POWERPC_PTRACE_H */ diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index 3635be6..656fea2 100644 --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c @@ -707,12 +707,29 @@ void user_enable_single_step(struct task_struct *task) task->thread.dbcr0 |= DBCR0_IDM | DBCR0_IC; regs->msr |= MSR_DE; #else + regs->msr &= ~MSR_BE; regs->msr |= MSR_SE; #endif } set_tsk_thread_flag(task, TIF_SINGLESTEP); } +void user_enable_block_step(struct task_struct *task) +{ + struct pt_regs *regs = task->thread.regs; + + if (regs != NULL) { +#if defined(CONFIG_40x) || defined(CONFIG_BOOKE) + task->thread.dbcr0 = DBCR0_IDM | DBCR0_BT; + regs->msr |= MSR_DE; +#else + regs->msr &= ~MSR_SE; + regs->msr |= MSR_BE; +#endif + } + set_tsk_thread_flag(task, TIF_SINGLESTEP); +} + void user_disable_single_step(struct task_struct *task) { struct pt_regs *regs = task->thread.regs; @@ -729,7 +746,7 @@ void user_disable_single_step(struct task_struct *task) task->thread.dbcr0 &= ~(DBCR0_IC | DBCR0_IDM); regs->msr &= ~MSR_DE; #else - regs->msr &= ~MSR_SE; + regs->msr &= ~(MSR_SE | MSR_BE); #endif } clear_tsk_thread_flag(task, TIF_SINGLESTEP);