Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f1df280f53d7c3ce8613a3b25d1efe009b9860dd
Commit:     f1df280f53d7c3ce8613a3b25d1efe009b9860dd
Parent:     ab483570a13be2a34c0502b166df8f8b26802103
Author:     Jan Blunck <[EMAIL PROTECTED]>
AuthorDate: Fri Oct 19 20:35:04 2007 +0200
Committer:  Thomas Gleixner <[EMAIL PROTECTED]>
CommitDate: Fri Oct 19 20:35:04 2007 +0200

    x86: introduce frame_pointer() and stack_pointer()
    
    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 <[EMAIL PROTECTED]>
    Signed-off-by: Andi Kleen <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
    Signed-off-by: Thomas Gleixner <[EMAIL PROTECTED]>
---
 arch/x86/oprofile/backtrace.c |   12 ++----------
 include/asm-x86/ptrace_32.h   |    2 ++
 include/asm-x86/ptrace_64.h   |    2 ++
 3 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/arch/x86/oprofile/backtrace.c b/arch/x86/oprofile/backtrace.c
index dc59a80..0ed046a 100644
--- a/arch/x86/oprofile/backtrace.c
+++ b/arch/x86/oprofile/backtrace.c
@@ -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)
diff --git a/include/asm-x86/ptrace_32.h b/include/asm-x86/ptrace_32.h
index 6002597..78d063d 100644
--- a/include/asm-x86/ptrace_32.h
+++ b/include/asm-x86/ptrace_32.h
@@ -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);
diff --git a/include/asm-x86/ptrace_64.h b/include/asm-x86/ptrace_64.h
index 7f166cc..7bfe61e 100644
--- a/include/asm-x86/ptrace_64.h
+++ b/include/asm-x86/ptrace_64.h
@@ -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);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to