]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
x86: introduce frame_pointer() and stack_pointer()
authorJan Blunck <jblunck@suse.de>
Fri, 19 Oct 2007 18:35:04 +0000 (20:35 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 19 Oct 2007 18:35:04 +0000 (20:35 +0200)
This patch defines frame_pointer() and stack_pointer() similar to the
already defined instruction_pointer(). Thus the oprofile code can be
written in a more readable fashion.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/oprofile/backtrace.c
include/asm-x86/ptrace_32.h
include/asm-x86/ptrace_64.h

index dc59a808009fa7a8593d2fd85d5f1a309fef0ed9..0ed046a187f77fb1d29228780c395f4e8d4636a1 100644 (file)
@@ -76,16 +76,8 @@ dump_user_backtrace(struct frame_head * head)
 void
 x86_backtrace(struct pt_regs * const regs, unsigned int depth)
 {
-       struct frame_head *head;
-       unsigned long stack;
-
-#ifdef CONFIG_X86_64
-       head = (struct frame_head *)regs->rbp;
-       stack = regs->rsp;
-#else
-       head = (struct frame_head *)regs->ebp;
-       stack = regs->esp;
-#endif
+       struct frame_head *head = (struct frame_head *)frame_pointer(regs);
+       unsigned long stack = stack_pointer(regs);
 
        if (!user_mode_vm(regs)) {
                if (depth)
index 6002597b9e12212b8e0986f9b7070d2d0b5ba041..78d063dabe0ae6589dbbe1c0e8613d27058d4b10 100644 (file)
@@ -55,6 +55,8 @@ static inline int v8086_mode(struct pt_regs *regs)
 }
 
 #define instruction_pointer(regs) ((regs)->eip)
+#define frame_pointer(regs) ((regs)->ebp)
+#define stack_pointer(regs) ((regs)->esp)
 #define regs_return_value(regs) ((regs)->eax)
 
 extern unsigned long profile_pc(struct pt_regs *regs);
index 7f166ccb0606786991e931c9995c6dfe9514809b..7bfe61e1b7052c5c1e74b03ae72db585104feb9d 100644 (file)
@@ -40,6 +40,8 @@ struct pt_regs {
 #define user_mode(regs) (!!((regs)->cs & 3))
 #define user_mode_vm(regs) user_mode(regs)
 #define instruction_pointer(regs) ((regs)->rip)
+#define frame_pointer(regs) ((regs)->rbp)
+#define stack_pointer(regs) ((regs)->rsp)
 #define regs_return_value(regs) ((regs)->rax)
 
 extern unsigned long profile_pc(struct pt_regs *regs);