linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [RFC/PATCH 5/5] powerpc: Allow ptrace write to pt_regs trap
@ 2007-05-29  6:45 Benjamin Herrenschmidt
  2007-05-29 15:41 ` Ulrich Weigand
  0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2007-05-29  6:45 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: ulrich.weigand, Paul Mackerras, Anton Blanchard

This patch allows a ptracer to write to the "trap" word of the
pt_regs. This, along with the previous patch, should enable gdb
to properly handle syscall restarting after executing a separate
function (at least when there's no restart block).

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

 arch/powerpc/kernel/ptrace-common.h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Index: linux-cell/arch/powerpc/kernel/ptrace-common.h
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/ptrace-common.h	2007-05-29 16:22:07.000000000 +1000
+++ linux-cell/arch/powerpc/kernel/ptrace-common.h	2007-05-29 16:42:04.000000000 +1000
@@ -41,10 +41,15 @@ static inline int put_reg(struct task_st
 	if (task->thread.regs == NULL)
 		return -EIO;
 
-	if (regno <= PT_MAX_PUT_REG) {
+	if (regno <= PT_MAX_PUT_REG || regno == PT_TRAP) {
 		if (regno == PT_MSR)
 			data = (data & MSR_DEBUGCHANGE)
 				| (task->thread.regs->msr & ~MSR_DEBUGCHANGE);
+		/* We prevent mucking around with the reserved area of trap
+		 * which are used internally by the kernel
+		 */
+		if (regno == PT_TRAP)
+			data &= 0xff00;
 		((unsigned long *)task->thread.regs)[regno] = data;
 		return 0;
 	}

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-05-30 13:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-29  6:45 [RFC/PATCH 5/5] powerpc: Allow ptrace write to pt_regs trap Benjamin Herrenschmidt
2007-05-29 15:41 ` Ulrich Weigand
2007-05-29 21:41   ` Benjamin Herrenschmidt
2007-05-30 13:08     ` Ulrich Weigand
2007-05-30  4:33   ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).