mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][PPC64] Single-stepping emulated instructions
@ 2004-06-08 12:11 Paul Mackerras
  0 siblings, 0 replies; only message in thread
From: Paul Mackerras @ 2004-06-08 12:11 UTC (permalink / raw)
  To: akpm; +Cc: torvalds, linux-kernel, anton

Occasionally the ppc64 kernel emulates a usermode instruction, for
example in the alignment exception handler.  Kumar Gala pointed out
(in the context of the ppc32 kernel) that if the instruction was being
single-stepped, and we end up emulating the instruction, we should
then send the process a SIGTRAP as if it had not been emulated and the
process had then taken a single-step exception.  This patch implements
this for ppc64.

Signed-off-by: Paul Mackerras <paulus@samba.org>

diff -urN linux-2.5/arch/ppc64/kernel/traps.c b/arch/ppc64/kernel/traps.c
--- linux-2.5/arch/ppc64/kernel/traps.c	2004-06-08 21:37:05.344964616 +1000
+++ b/arch/ppc64/kernel/traps.c	2004-06-08 15:31:36.000000000 +1000
@@ -500,6 +500,18 @@
 	_exception(SIGTRAP, &info, regs);	
 }
 
+/*
+ * After we have successfully emulated an instruction, we have to
+ * check if the instruction was being single-stepped, and if so,
+ * pretend we got a single-step exception.  This was pointed out
+ * by Kumar Gala.  -- paulus
+ */
+static inline void emulate_single_step(struct pt_regs *regs)
+{
+	if (regs->msr & MSR_SE)
+		SingleStepException(regs);
+}
+
 static void dummy_perf(struct pt_regs *regs)
 {
 }
@@ -521,10 +533,8 @@
 	fixed = fix_alignment(regs);
 
 	if (fixed == 1) {
-		if (!user_mode(regs))
-			PPCDBG(PPCDBG_ALIGNFIXUP, "fix alignment at %lx\n",
-			       regs->nip);
 		regs->nip += 4;	/* skip over emulated instruction */
+		emulate_single_step(regs);
 		return;
 	}
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-06-08 12:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-08 12:11 [PATCH][PPC64] Single-stepping emulated instructions Paul Mackerras

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®