162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) 462306a36Sopenharmony_ci */ 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#ifndef _ASM_ARC_UNWIND_H 762306a36Sopenharmony_ci#define _ASM_ARC_UNWIND_H 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#ifdef CONFIG_ARC_DW2_UNWIND 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#include <linux/sched.h> 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_cistruct arc700_regs { 1462306a36Sopenharmony_ci unsigned long r0; 1562306a36Sopenharmony_ci unsigned long r1; 1662306a36Sopenharmony_ci unsigned long r2; 1762306a36Sopenharmony_ci unsigned long r3; 1862306a36Sopenharmony_ci unsigned long r4; 1962306a36Sopenharmony_ci unsigned long r5; 2062306a36Sopenharmony_ci unsigned long r6; 2162306a36Sopenharmony_ci unsigned long r7; 2262306a36Sopenharmony_ci unsigned long r8; 2362306a36Sopenharmony_ci unsigned long r9; 2462306a36Sopenharmony_ci unsigned long r10; 2562306a36Sopenharmony_ci unsigned long r11; 2662306a36Sopenharmony_ci unsigned long r12; 2762306a36Sopenharmony_ci unsigned long r13; 2862306a36Sopenharmony_ci unsigned long r14; 2962306a36Sopenharmony_ci unsigned long r15; 3062306a36Sopenharmony_ci unsigned long r16; 3162306a36Sopenharmony_ci unsigned long r17; 3262306a36Sopenharmony_ci unsigned long r18; 3362306a36Sopenharmony_ci unsigned long r19; 3462306a36Sopenharmony_ci unsigned long r20; 3562306a36Sopenharmony_ci unsigned long r21; 3662306a36Sopenharmony_ci unsigned long r22; 3762306a36Sopenharmony_ci unsigned long r23; 3862306a36Sopenharmony_ci unsigned long r24; 3962306a36Sopenharmony_ci unsigned long r25; 4062306a36Sopenharmony_ci unsigned long r26; 4162306a36Sopenharmony_ci unsigned long r27; /* fp */ 4262306a36Sopenharmony_ci unsigned long r28; /* sp */ 4362306a36Sopenharmony_ci unsigned long r29; 4462306a36Sopenharmony_ci unsigned long r30; 4562306a36Sopenharmony_ci unsigned long r31; /* blink */ 4662306a36Sopenharmony_ci unsigned long r63; /* pc */ 4762306a36Sopenharmony_ci}; 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_cistruct unwind_frame_info { 5062306a36Sopenharmony_ci struct arc700_regs regs; 5162306a36Sopenharmony_ci struct task_struct *task; 5262306a36Sopenharmony_ci unsigned call_frame:1; 5362306a36Sopenharmony_ci}; 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci#define UNW_PC(frame) ((frame)->regs.r63) 5662306a36Sopenharmony_ci#define UNW_SP(frame) ((frame)->regs.r28) 5762306a36Sopenharmony_ci#define UNW_BLINK(frame) ((frame)->regs.r31) 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci/* Rajesh FIXME */ 6062306a36Sopenharmony_ci#ifdef CONFIG_FRAME_POINTER 6162306a36Sopenharmony_ci#define UNW_FP(frame) ((frame)->regs.r27) 6262306a36Sopenharmony_ci#define FRAME_RETADDR_OFFSET 4 6362306a36Sopenharmony_ci#define FRAME_LINK_OFFSET 0 6462306a36Sopenharmony_ci#define STACK_BOTTOM_UNW(tsk) STACK_LIMIT((tsk)->thread.ksp) 6562306a36Sopenharmony_ci#define STACK_TOP_UNW(tsk) ((tsk)->thread.ksp) 6662306a36Sopenharmony_ci#else 6762306a36Sopenharmony_ci#define UNW_FP(frame) ((void)(frame), 0) 6862306a36Sopenharmony_ci#endif 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci#define STACK_LIMIT(ptr) (((ptr) - 1) & ~(THREAD_SIZE - 1)) 7162306a36Sopenharmony_ci 7262306a36Sopenharmony_ci#define UNW_REGISTER_INFO \ 7362306a36Sopenharmony_ci PTREGS_INFO(r0), \ 7462306a36Sopenharmony_ci PTREGS_INFO(r1), \ 7562306a36Sopenharmony_ci PTREGS_INFO(r2), \ 7662306a36Sopenharmony_ci PTREGS_INFO(r3), \ 7762306a36Sopenharmony_ci PTREGS_INFO(r4), \ 7862306a36Sopenharmony_ci PTREGS_INFO(r5), \ 7962306a36Sopenharmony_ci PTREGS_INFO(r6), \ 8062306a36Sopenharmony_ci PTREGS_INFO(r7), \ 8162306a36Sopenharmony_ci PTREGS_INFO(r8), \ 8262306a36Sopenharmony_ci PTREGS_INFO(r9), \ 8362306a36Sopenharmony_ci PTREGS_INFO(r10), \ 8462306a36Sopenharmony_ci PTREGS_INFO(r11), \ 8562306a36Sopenharmony_ci PTREGS_INFO(r12), \ 8662306a36Sopenharmony_ci PTREGS_INFO(r13), \ 8762306a36Sopenharmony_ci PTREGS_INFO(r14), \ 8862306a36Sopenharmony_ci PTREGS_INFO(r15), \ 8962306a36Sopenharmony_ci PTREGS_INFO(r16), \ 9062306a36Sopenharmony_ci PTREGS_INFO(r17), \ 9162306a36Sopenharmony_ci PTREGS_INFO(r18), \ 9262306a36Sopenharmony_ci PTREGS_INFO(r19), \ 9362306a36Sopenharmony_ci PTREGS_INFO(r20), \ 9462306a36Sopenharmony_ci PTREGS_INFO(r21), \ 9562306a36Sopenharmony_ci PTREGS_INFO(r22), \ 9662306a36Sopenharmony_ci PTREGS_INFO(r23), \ 9762306a36Sopenharmony_ci PTREGS_INFO(r24), \ 9862306a36Sopenharmony_ci PTREGS_INFO(r25), \ 9962306a36Sopenharmony_ci PTREGS_INFO(r26), \ 10062306a36Sopenharmony_ci PTREGS_INFO(r27), \ 10162306a36Sopenharmony_ci PTREGS_INFO(r28), \ 10262306a36Sopenharmony_ci PTREGS_INFO(r29), \ 10362306a36Sopenharmony_ci PTREGS_INFO(r30), \ 10462306a36Sopenharmony_ci PTREGS_INFO(r31), \ 10562306a36Sopenharmony_ci PTREGS_INFO(r63) 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_ci#define UNW_DEFAULT_RA(raItem, dataAlign) \ 10862306a36Sopenharmony_ci ((raItem).where == Memory && !((raItem).value * (dataAlign) + 4)) 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_ciextern int arc_unwind(struct unwind_frame_info *frame); 11162306a36Sopenharmony_ciextern void arc_unwind_init(void); 11262306a36Sopenharmony_ciextern void *unwind_add_table(struct module *module, const void *table_start, 11362306a36Sopenharmony_ci unsigned long table_size); 11462306a36Sopenharmony_ciextern void unwind_remove_table(void *handle, int init_only); 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_cistatic inline int 11762306a36Sopenharmony_ciarch_unwind_init_running(struct unwind_frame_info *info, 11862306a36Sopenharmony_ci int (*callback) (struct unwind_frame_info *info, 11962306a36Sopenharmony_ci void *arg), 12062306a36Sopenharmony_ci void *arg) 12162306a36Sopenharmony_ci{ 12262306a36Sopenharmony_ci return 0; 12362306a36Sopenharmony_ci} 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_cistatic inline int arch_unw_user_mode(const struct unwind_frame_info *info) 12662306a36Sopenharmony_ci{ 12762306a36Sopenharmony_ci return 0; 12862306a36Sopenharmony_ci} 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_cistatic inline void arch_unw_init_blocked(struct unwind_frame_info *info) 13162306a36Sopenharmony_ci{ 13262306a36Sopenharmony_ci return; 13362306a36Sopenharmony_ci} 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_cistatic inline void arch_unw_init_frame_info(struct unwind_frame_info *info, 13662306a36Sopenharmony_ci struct pt_regs *regs) 13762306a36Sopenharmony_ci{ 13862306a36Sopenharmony_ci return; 13962306a36Sopenharmony_ci} 14062306a36Sopenharmony_ci 14162306a36Sopenharmony_ci#else 14262306a36Sopenharmony_ci 14362306a36Sopenharmony_ci#define UNW_PC(frame) ((void)(frame), 0) 14462306a36Sopenharmony_ci#define UNW_SP(frame) ((void)(frame), 0) 14562306a36Sopenharmony_ci#define UNW_FP(frame) ((void)(frame), 0) 14662306a36Sopenharmony_ci 14762306a36Sopenharmony_cistatic inline void arc_unwind_init(void) 14862306a36Sopenharmony_ci{ 14962306a36Sopenharmony_ci} 15062306a36Sopenharmony_ci 15162306a36Sopenharmony_ci#define unwind_add_table(a, b, c) 15262306a36Sopenharmony_ci#define unwind_remove_table(a, b) 15362306a36Sopenharmony_ci 15462306a36Sopenharmony_ci#endif /* CONFIG_ARC_DW2_UNWIND */ 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_ci#endif /* _ASM_ARC_UNWIND_H */ 157