1*b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0 285718faeSTony Luck /* 385718faeSTony Luck * arch/ia64/kernel/stacktrace.c 485718faeSTony Luck * 585718faeSTony Luck * Stack trace management functions 685718faeSTony Luck * 785718faeSTony Luck */ 885718faeSTony Luck #include <linux/sched.h> 985718faeSTony Luck #include <linux/stacktrace.h> 1085718faeSTony Luck #include <linux/module.h> 1185718faeSTony Luck 1285718faeSTony Luck static void ia64_do_save_stack(struct unw_frame_info * info,void * arg)1385718faeSTony Luckia64_do_save_stack(struct unw_frame_info *info, void *arg) 1485718faeSTony Luck { 1585718faeSTony Luck struct stack_trace *trace = arg; 1685718faeSTony Luck unsigned long ip; 1785718faeSTony Luck int skip = trace->skip; 1885718faeSTony Luck 1985718faeSTony Luck trace->nr_entries = 0; 2085718faeSTony Luck do { 2185718faeSTony Luck unw_get_ip(info, &ip); 2285718faeSTony Luck if (ip == 0) 2385718faeSTony Luck break; 2485718faeSTony Luck if (skip == 0) { 2585718faeSTony Luck trace->entries[trace->nr_entries++] = ip; 2685718faeSTony Luck if (trace->nr_entries == trace->max_entries) 2785718faeSTony Luck break; 2885718faeSTony Luck } else 2985718faeSTony Luck skip--; 3085718faeSTony Luck } while (unw_unwind(info) >= 0); 3185718faeSTony Luck } 3285718faeSTony Luck 3385718faeSTony Luck /* 3485718faeSTony Luck * Save stack-backtrace addresses into a stack_trace buffer. 3585718faeSTony Luck */ save_stack_trace(struct stack_trace * trace)3685718faeSTony Luckvoid save_stack_trace(struct stack_trace *trace) 3785718faeSTony Luck { 3885718faeSTony Luck unw_init_running(ia64_do_save_stack, trace); 3985718faeSTony Luck } 4085718faeSTony Luck EXPORT_SYMBOL(save_stack_trace); 41