aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/oprofile/backtrace.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/arch/i386/oprofile/backtrace.c b/arch/i386/oprofile/backtrace.c
index acc18138fb22..c049ce414f01 100644
--- a/arch/i386/oprofile/backtrace.c
+++ b/arch/i386/oprofile/backtrace.c
@@ -20,7 +20,20 @@ struct frame_head {
20} __attribute__((packed)); 20} __attribute__((packed));
21 21
22static struct frame_head * 22static struct frame_head *
23dump_backtrace(struct frame_head * head) 23dump_kernel_backtrace(struct frame_head * head)
24{
25 oprofile_add_trace(head->ret);
26
27 /* frame pointers should strictly progress back up the stack
28 * (towards higher addresses) */
29 if (head >= head->ebp)
30 return NULL;
31
32 return head->ebp;
33}
34
35static struct frame_head *
36dump_user_backtrace(struct frame_head * head)
24{ 37{
25 struct frame_head bufhead[2]; 38 struct frame_head bufhead[2];
26 39
@@ -105,10 +118,10 @@ x86_backtrace(struct pt_regs * const regs, unsigned int depth)
105 118
106 if (!user_mode_vm(regs)) { 119 if (!user_mode_vm(regs)) {
107 while (depth-- && valid_kernel_stack(head, regs)) 120 while (depth-- && valid_kernel_stack(head, regs))
108 head = dump_backtrace(head); 121 head = dump_kernel_backtrace(head);
109 return; 122 return;
110 } 123 }
111 124
112 while (depth-- && head) 125 while (depth-- && head)
113 head = dump_backtrace(head); 126 head = dump_user_backtrace(head);
114} 127}