2 * Stack trace support for Microblaze.
4 * Copyright (C) 2009 Michal Simek <monstr@monstr.eu>
5 * Copyright (C) 2009 PetaLogix
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
12 #include <linux/sched.h>
13 #include <linux/stacktrace.h>
14 #include <linux/thread_info.h>
15 #include <linux/ptrace.h>
16 #include <linux/module.h>
18 /* FIXME initial support */
19 void save_stack_trace(struct stack_trace *trace)
23 asm("addik %0, r1, 0" : "=r" (sp));
25 while (!kstack_end(sp)) {
27 if (__kernel_text_address(addr)) {
31 trace->entries[trace->nr_entries++] = addr;
33 if (trace->nr_entries >= trace->max_entries)
38 EXPORT_SYMBOL_GPL(save_stack_trace);
40 void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
45 struct thread_info *ti = task_thread_info(tsk);
48 asm("addik %0, r1, 0" : "=r" (sp));
50 sp = (unsigned int *)ti->cpu_context.r1;
52 while (!kstack_end(sp)) {
54 if (__kernel_text_address(addr)) {
58 trace->entries[trace->nr_entries++] = addr;
60 if (trace->nr_entries >= trace->max_entries)
65 EXPORT_SYMBOL_GPL(save_stack_trace_tsk);