| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * arch/sh/kernel/stacktrace.c |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Stack trace management functions |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Copyright (C) 2006 - 2008 Paul Mundt |
|---|
| 7 | | - * |
|---|
| 8 | | - * This file is subject to the terms and conditions of the GNU General Public |
|---|
| 9 | | - * License. See the file "COPYING" in the main directory of this archive |
|---|
| 10 | | - * for more details. |
|---|
| 11 | 8 | */ |
|---|
| 12 | 9 | #include <linux/sched.h> |
|---|
| 13 | 10 | #include <linux/sched/debug.h> |
|---|
| .. | .. |
|---|
| 17 | 14 | #include <asm/unwinder.h> |
|---|
| 18 | 15 | #include <asm/ptrace.h> |
|---|
| 19 | 16 | #include <asm/stacktrace.h> |
|---|
| 20 | | - |
|---|
| 21 | | -static int save_stack_stack(void *data, char *name) |
|---|
| 22 | | -{ |
|---|
| 23 | | - return 0; |
|---|
| 24 | | -} |
|---|
| 25 | 17 | |
|---|
| 26 | 18 | /* |
|---|
| 27 | 19 | * Save stack-backtrace addresses into a stack_trace buffer. |
|---|
| .. | .. |
|---|
| 43 | 35 | } |
|---|
| 44 | 36 | |
|---|
| 45 | 37 | static const struct stacktrace_ops save_stack_ops = { |
|---|
| 46 | | - .stack = save_stack_stack, |
|---|
| 47 | 38 | .address = save_stack_address, |
|---|
| 48 | 39 | }; |
|---|
| 49 | 40 | |
|---|
| .. | .. |
|---|
| 52 | 43 | unsigned long *sp = (unsigned long *)current_stack_pointer; |
|---|
| 53 | 44 | |
|---|
| 54 | 45 | unwind_stack(current, NULL, sp, &save_stack_ops, trace); |
|---|
| 55 | | - if (trace->nr_entries < trace->max_entries) |
|---|
| 56 | | - trace->entries[trace->nr_entries++] = ULONG_MAX; |
|---|
| 57 | 46 | } |
|---|
| 58 | 47 | EXPORT_SYMBOL_GPL(save_stack_trace); |
|---|
| 59 | 48 | |
|---|
| .. | .. |
|---|
| 78 | 67 | } |
|---|
| 79 | 68 | |
|---|
| 80 | 69 | static const struct stacktrace_ops save_stack_ops_nosched = { |
|---|
| 81 | | - .stack = save_stack_stack, |
|---|
| 82 | 70 | .address = save_stack_address_nosched, |
|---|
| 83 | 71 | }; |
|---|
| 84 | 72 | |
|---|
| .. | .. |
|---|
| 87 | 75 | unsigned long *sp = (unsigned long *)tsk->thread.sp; |
|---|
| 88 | 76 | |
|---|
| 89 | 77 | unwind_stack(current, NULL, sp, &save_stack_ops_nosched, trace); |
|---|
| 90 | | - if (trace->nr_entries < trace->max_entries) |
|---|
| 91 | | - trace->entries[trace->nr_entries++] = ULONG_MAX; |
|---|
| 92 | 78 | } |
|---|
| 93 | 79 | EXPORT_SYMBOL_GPL(save_stack_trace_tsk); |
|---|