From: "Suzuki K. Poulose" <suzuki@in.ibm.com>
To: bigeasy@linutronix.de, oleg@redhat.com, ananth@in.ibm.com,
srikar@linux.vnet.ibm.com
Cc: peterz@infradead.org, benh@kernel.crashing.org, mingo@elte.hu,
anton@redhat.com, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] uprobes/powerpc: Make use of generic routines to enable single step
Date: Mon, 26 Nov 2012 16:36:56 +0530 [thread overview]
Message-ID: <20121126110548.6545.53281.stgit@suzukikp.in.ibm.com> (raw)
In-Reply-To: <20121126110007.6545.43875.stgit@suzukikp.in.ibm.com>
From: Suzuki K. Poulose <suzuki@in.ibm.com>
Replace the ptrace helpers with the powerpc generic routines to
enable/disable single step. We save/restore the MSR (and DCBR for BookE)
across for the operation.
Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
---
arch/powerpc/include/asm/uprobes.h | 4 ++++
arch/powerpc/kernel/uprobes.c | 11 +++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/uprobes.h b/arch/powerpc/include/asm/uprobes.h
index b532060..884be93 100644
--- a/arch/powerpc/include/asm/uprobes.h
+++ b/arch/powerpc/include/asm/uprobes.h
@@ -43,6 +43,10 @@ struct arch_uprobe {
struct arch_uprobe_task {
unsigned long saved_trap_nr;
+ unsigned long saved_msr;
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
+ unsigned long saved_dbcr;
+#endif
};
extern int arch_uprobe_analyze_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long addr);
diff --git a/arch/powerpc/kernel/uprobes.c b/arch/powerpc/kernel/uprobes.c
index bc77834..c407c07 100644
--- a/arch/powerpc/kernel/uprobes.c
+++ b/arch/powerpc/kernel/uprobes.c
@@ -62,10 +62,14 @@ int arch_uprobe_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
struct arch_uprobe_task *autask = ¤t->utask->autask;
autask->saved_trap_nr = current->thread.trap_nr;
+ autask->saved_msr = regs->msr;
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
+ autask->saved_dbcr = mfspr(SPRN_DBCR0);
+#endif
current->thread.trap_nr = UPROBE_TRAP_NR;
regs->nip = current->utask->xol_vaddr;
- user_enable_single_step(current);
+ enable_single_step(regs);
return 0;
}
@@ -121,8 +125,11 @@ int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
* to be executed.
*/
regs->nip = utask->vaddr + MAX_UINSN_BYTES;
+ regs->msr = utask->autask.saved_msr;
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
+ mtspr(SPRN_DBCR0, utask->autask.saved_dbcr);
+#endif
- user_disable_single_step(current);
return 0;
}
next prev parent reply other threads:[~2012-11-26 11:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-26 11:04 [PATCH 0/2] uprobes/powerpc: Replace ptrace single step helpers Suzuki K. Poulose
2012-11-26 11:05 ` [PATCH 1/2] powerpc: Move the single step enable code to a generic path Suzuki K. Poulose
2012-11-26 18:10 ` Sebastian Andrzej Siewior
2012-11-27 9:18 ` Suzuki K. Poulose
2012-11-26 11:06 ` Suzuki K. Poulose [this message]
2012-11-26 17:01 ` [PATCH 2/2] uprobes/powerpc: Make use of generic routines to enable single step Oleg Nesterov
2012-11-27 4:56 ` Suzuki K. Poulose
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121126110548.6545.53281.stgit@suzukikp.in.ibm.com \
--to=suzuki@in.ibm.com \
--cc=ananth@in.ibm.com \
--cc=anton@redhat.com \
--cc=benh@kernel.crashing.org \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=srikar@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®