move new files out from platform support patch
[openwrt/openwrt.git] / target / linux / ubicom32 / files / arch / ubicom32 / include / asm / stacktrace.h
1 /*
2 * arch/ubicom32/include/asm/stacktrace.h
3 * Stacktrace functions for the Ubicom32 architecture.
4 *
5 * (C) Copyright 2009, Ubicom, Inc.
6 *
7 * This file is part of the Ubicom32 Linux Kernel Port.
8 *
9 * The Ubicom32 Linux Kernel Port is free software: you can redistribute
10 * it and/or modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation, either version 2 of the
12 * License, or (at your option) any later version.
13 *
14 * The Ubicom32 Linux Kernel Port is distributed in the hope that it
15 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
16 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
17 * the GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with the Ubicom32 Linux Kernel Port. If not,
21 * see <http://www.gnu.org/licenses/>.
22 *
23 * Ubicom32 implementation derived from (with many thanks):
24 * arch/m68knommu
25 * arch/blackfin
26 * arch/parisc
27 */
28 #ifndef _ASM_UBICOM32_STACKTRACE_H
29 #define _ASM_UBICOM32_STACKTRACE_H
30
31 #define between(a, b, c) (( \
32 ((unsigned long) a) >= ((unsigned long) b)) && \
33 (((unsigned long)a) <= ((unsigned long)c)))
34
35 /*
36 * These symbols are filled in by the linker.
37 */
38 extern unsigned long _stext;
39 extern unsigned long _etext;
40
41 /* OCM text goes from __ocm_text_run_begin to __data_begin */
42 extern unsigned long __ocm_text_run_begin;
43 extern unsigned long __data_begin;
44
45 /* Account for OCM case - see stacktrace.c maybe combine(also trap.c) */
46 /*
47 * ubicom32_is_kernel()
48 *
49 * Check to see if the given address belongs to the kernel.
50 * NOMMU does not permit any other means.
51 */
52 static inline int ubicom32_is_kernel(unsigned long addr)
53 {
54 int is_kernel = between(addr, &_stext, &_etext) || \
55 between(addr, &__ocm_text_run_begin, &__data_begin);
56
57 #ifdef CONFIG_MODULES
58 if (!is_kernel)
59 is_kernel = is_module_address(addr);
60 #endif
61 return is_kernel;
62 }
63
64 extern unsigned long stacktrace_iterate(
65 unsigned long **trace,
66 unsigned long stext, unsigned long etext,
67 unsigned long ocm_stext, unsigned long ocm_etext,
68 unsigned long sstack, unsigned long estack);
69 #ifdef CONFIG_STACKTRACE
70 void stacktrace_save_entries(struct task_struct *tsk, struct stack_trace *trace, unsigned long sp);
71 #endif
72 #endif /* _ASM_UBICOM32_STACKTRACE_H */