powerpc: Make syscall tracing use tracehook.h helpers

Previous thread: powerpc: Enable tracehook for the architecture by Linux Kernel Mailing List on Monday, July 28, 2008 - 10:10 am. (1 message)

Next thread: powerpc: Add asm/syscall.h with the tracehook entry points by Linux Kernel Mailing List on Monday, July 28, 2008 - 10:09 am. (1 message)
From: Linux Kernel Mailing List
Date: Monday, July 28, 2008 - 10:09 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4f72c4...
Commit:     4f72c4279eab1e5f3ed1ac4e55d4527617582392
Parent:     6558ba2b5cc3a2f22039db30616fcd07c1b28ac8
Author:     Roland McGrath <roland@redhat.com>
AuthorDate: Sun Jul 27 16:51:03 2008 +1000
Committer:  Benjamin Herrenschmidt <benh@kernel.crashing.org>
CommitDate: Mon Jul 28 16:30:49 2008 +1000

    powerpc: Make syscall tracing use tracehook.h helpers
    
    This changes powerpc syscall tracing to use the new tracehook.h entry
    points.  There is no change, only cleanup.
    
    In addition, the assembly changes allow do_syscall_trace_enter() to
    abort the syscall without losing the information about the original
    r0 value.
    
    Signed-off-by: Roland McGrath <roland@redhat.com>
    Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 arch/powerpc/kernel/entry_32.S |    7 +++++-
 arch/powerpc/kernel/entry_64.S |    7 +++++-
 arch/powerpc/kernel/ptrace.c   |   47 ++++++++++++++++++---------------------
 3 files changed, 34 insertions(+), 27 deletions(-)

diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index da52269..e6fca6a 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -343,7 +343,12 @@ syscall_dotrace:
 	stw	r0,_TRAP(r1)
 	addi	r3,r1,STACK_FRAME_OVERHEAD
 	bl	do_syscall_trace_enter
-	lwz	r0,GPR0(r1)	/* Restore original registers */
+	/*
+	 * Restore argument registers possibly just changed.
+	 * We use the return value of do_syscall_trace_enter
+	 * for call number to look up in the table (r0).
+	 */
+	mr	r0,r3
 	lwz	r3,GPR3(r1)
 	lwz	r4,GPR4(r1)
 	lwz	r5,GPR5(r1)
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index d736924..79c089e 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -214,7 +214,12 @@ syscall_dotrace:
 	bl	.save_nvgprs
 ...
Previous thread: powerpc: Enable tracehook for the architecture by Linux Kernel Mailing List on Monday, July 28, 2008 - 10:10 am. (1 message)

Next thread: powerpc: Add asm/syscall.h with the tracehook entry points by Linux Kernel Mailing List on Monday, July 28, 2008 - 10:09 am. (1 message)