1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
6 #ifndef _ASM_ARC_UNWIND_H
7 #define _ASM_ARC_UNWIND_H
9 #ifdef CONFIG_ARC_DW2_UNWIND
11 #include <linux/sched.h>
41 unsigned long r27
; /* fp */
42 unsigned long r28
; /* sp */
45 unsigned long r31
; /* blink */
46 unsigned long r63
; /* pc */
49 struct unwind_frame_info
{
50 struct arc700_regs regs
;
51 struct task_struct
*task
;
52 unsigned call_frame
:1;
55 #define UNW_PC(frame) ((frame)->regs.r63)
56 #define UNW_SP(frame) ((frame)->regs.r28)
57 #define UNW_BLINK(frame) ((frame)->regs.r31)
60 #ifdef CONFIG_FRAME_POINTER
61 #define UNW_FP(frame) ((frame)->regs.r27)
62 #define FRAME_RETADDR_OFFSET 4
63 #define FRAME_LINK_OFFSET 0
64 #define STACK_BOTTOM_UNW(tsk) STACK_LIMIT((tsk)->thread.ksp)
65 #define STACK_TOP_UNW(tsk) ((tsk)->thread.ksp)
67 #define UNW_FP(frame) ((void)(frame), 0)
70 #define STACK_LIMIT(ptr) (((ptr) - 1) & ~(THREAD_SIZE - 1))
72 #define UNW_REGISTER_INFO \
107 #define UNW_DEFAULT_RA(raItem, dataAlign) \
108 ((raItem).where == Memory && !((raItem).value * (dataAlign) + 4))
110 extern int arc_unwind(struct unwind_frame_info
*frame
);
111 extern void arc_unwind_init(void);
112 extern void *unwind_add_table(struct module
*module
, const void *table_start
,
113 unsigned long table_size
);
114 extern void unwind_remove_table(void *handle
, int init_only
);
117 arch_unwind_init_running(struct unwind_frame_info
*info
,
118 int (*callback
) (struct unwind_frame_info
*info
,
125 static inline int arch_unw_user_mode(const struct unwind_frame_info
*info
)
130 static inline void arch_unw_init_blocked(struct unwind_frame_info
*info
)
135 static inline void arch_unw_init_frame_info(struct unwind_frame_info
*info
,
136 struct pt_regs
*regs
)
143 #define UNW_PC(frame) ((void)(frame), 0)
144 #define UNW_SP(frame) ((void)(frame), 0)
145 #define UNW_FP(frame) ((void)(frame), 0)
147 static inline void arc_unwind_init(void)
151 #define unwind_add_table(a, b, c)
152 #define unwind_remove_table(a, b)
154 #endif /* CONFIG_ARC_DW2_UNWIND */
156 #endif /* _ASM_ARC_UNWIND_H */