Skip to contentSkip to conversation

power: add kernel_trap_sp()

RFC PATCH Superseded Masami Hiramatsu 3 participants 4 messages Mar 19, 2009 – Mar 20, 2009

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 4/9 power: add kernel_trap_sp()

Add kernel_trap_sp() on powerpc, based on systemtap's runtime/regs.h.

---
 arch/powerpc/include/asm/ptrace.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/powerpc/include/asm/ptrace.h +1 -0
index c9c678f..0ac366c 100644
@@ -83,6 +83,7 @@ struct pt_regs {
 
 #define instruction_pointer(regs) ((regs)->nip)
 #define user_stack_pointer(regs) ((regs)->gpr[1])
+#define kernel_trap_sp(regs) (user_stack_pointer(regs))
 #define regs_return_value(regs) ((regs)->gpr[3])
 
 #ifdef CONFIG_SMP
Signature · 7 lines
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: [email protected]
#1 lore raw
Quoted 3 lines · Masami Hiramatsu

Add kernel_trap_sp() on powerpc, based on systemtap's runtime/regs.h.

I haven't looked at the usage of it, but it's weird to have something call "kernel_trap_sp" that returns the -user- stack pointer... is this really what's expected here ?

Quoted 16 lines
---
 arch/powerpc/include/asm/ptrace.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/powerpc/include/asm/ptrace.h +1 -0
index c9c678f..0ac366c 100644
@@ -83,6 +83,7 @@ struct pt_regs {
 
 #define instruction_pointer(regs) ((regs)->nip)
 #define user_stack_pointer(regs) ((regs)->gpr[1])
+#define kernel_trap_sp(regs) (user_stack_pointer(regs))
 #define regs_return_value(regs) ((regs)->gpr[3])
 
 #ifdef CONFIG_SMP
#2 lore raw
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 3 lines · Masami Hiramatsu

Add kernel_trap_sp() on powerpc, based on systemtap's runtime/regs.h.

I haven't looked at the usage of it, but it's weird to have something call "kernel_trap_sp" that returns the -user- stack pointer... is this really what's expected here ?

In the current usage scenario, this gets called only with a pt_regs snapshot from in kernel. user_stack_pointer() is a misnomer though; all this macro needs is to return the stack pointer from the given pt_regs.

Ananth

#3 lore raw
Quoted 5 lines · Ananth N Mavinakayanahalli
Quoted 4 lines · Benjamin Herrenschmidt
Quoted 3 lines · Masami Hiramatsu

Add kernel_trap_sp() on powerpc, based on systemtap's runtime/regs.h.

Quoted 8 lines
Quoted 3 lines

I haven't looked at the usage of it, but it's weird to have something call "kernel_trap_sp" that returns the -user- stack pointer... is this really what's expected here ?

In the current usage scenario, this gets called only with a pt_regs snapshot from in kernel. user_stack_pointer() is a misnomer though; all this macro needs is to return the stack pointer from the given pt_regs.

Indeed,
I expect kernel_trap_sp() returns the top of stack from pt_regs in the kernel. Why I'm using user_stack_pointer() for kernel_trap_sp() is just that the definitions of both are same...

Perhaps, should I define as below, even it is same as user_stack_pointer()? #define kernel_trap_sp(regs) ((regs)->gpr[1])

Thank you,

Quoted 7 lines

Ananth
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 7 lines
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: [email protected]