2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
9 #ifndef _ASM_ARC_UNWIND_H
10 #define _ASM_ARC_UNWIND_H
12 #ifdef CONFIG_ARC_DW2_UNWIND
14 #include <linux/sched.h>
44 unsigned long r27; /* fp */
45 unsigned long r28; /* sp */
48 unsigned long r31; /* blink */
49 unsigned long r63; /* pc */
52 struct unwind_frame_info {
53 struct arc700_regs regs;
54 struct task_struct *task;
55 unsigned call_frame:1;
58 #define UNW_PC(frame) ((frame)->regs.r63)
59 #define UNW_SP(frame) ((frame)->regs.r28)
60 #define UNW_BLINK(frame) ((frame)->regs.r31)
63 #ifdef CONFIG_FRAME_POINTER
64 #define UNW_FP(frame) ((frame)->regs.r27)
65 #define FRAME_RETADDR_OFFSET 4
66 #define FRAME_LINK_OFFSET 0
67 #define STACK_BOTTOM_UNW(tsk) STACK_LIMIT((tsk)->thread.ksp)
68 #define STACK_TOP_UNW(tsk) ((tsk)->thread.ksp)
70 #define UNW_FP(frame) ((void)(frame), 0)
73 #define STACK_LIMIT(ptr) (((ptr) - 1) & ~(THREAD_SIZE - 1))
75 #define UNW_REGISTER_INFO \
110 #define UNW_DEFAULT_RA(raItem, dataAlign) \
111 ((raItem).where == Memory && !((raItem).value * (dataAlign) + 4))
113 extern int arc_unwind(struct unwind_frame_info *frame);
114 extern void arc_unwind_init(void);
115 extern void arc_unwind_setup(void);
116 extern void *unwind_add_table(struct module *module, const void *table_start,
117 unsigned long table_size);
118 extern void unwind_remove_table(void *handle, int init_only);
121 arch_unwind_init_running(struct unwind_frame_info *info,
122 int (*callback) (struct unwind_frame_info *info,
129 static inline int arch_unw_user_mode(const struct unwind_frame_info *info)
134 static inline void arch_unw_init_blocked(struct unwind_frame_info *info)
139 static inline void arch_unw_init_frame_info(struct unwind_frame_info *info,
140 struct pt_regs *regs)
147 #define UNW_PC(frame) ((void)(frame), 0)
148 #define UNW_SP(frame) ((void)(frame), 0)
149 #define UNW_FP(frame) ((void)(frame), 0)
151 static inline void arc_unwind_init(void)
155 static inline void arc_unwind_setup(void)
158 #define unwind_add_table(a, b, c)
159 #define unwind_remove_table(a, b)
161 #endif /* CONFIG_ARC_DW2_UNWIND */
163 #endif /* _ASM_ARC_UNWIND_H */