3 * Copyright IBM Corp. 2005
4 * Author(s): Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
7 #include <linux/oprofile.h>
9 #include <asm/processor.h> /* for struct stack_frame */
12 __show_trace(unsigned int *depth, unsigned long sp,
13 unsigned long low, unsigned long high)
15 struct stack_frame *sf;
19 if (sp < low || sp > high - sizeof(*sf))
21 sf = (struct stack_frame *) sp;
23 oprofile_add_trace(sf->gprs[8]);
25 /* Follow the backchain. */
31 if (sp <= low || sp > high - sizeof(*sf))
33 sf = (struct stack_frame *) sp;
35 oprofile_add_trace(sf->gprs[8]);
42 /* Zero backchain detected, check for interrupt frame. */
43 sp = (unsigned long) (sf + 1);
44 if (sp <= low || sp > high - sizeof(*regs))
46 regs = (struct pt_regs *) sp;
48 oprofile_add_trace(sf->gprs[8]);
55 void s390_backtrace(struct pt_regs * const regs, unsigned int depth)
58 struct stack_frame* head_sf;
63 head = regs->gprs[15];
64 head_sf = (struct stack_frame*)head;
66 if (!head_sf->back_chain)
69 head = head_sf->back_chain;
71 head = __show_trace(&depth, head, S390_lowcore.async_stack - ASYNC_SIZE,
72 S390_lowcore.async_stack);
74 __show_trace(&depth, head, S390_lowcore.thread_info,
75 S390_lowcore.thread_info + THREAD_SIZE);