18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _ASMARM_TRAP_H
38c2ecf20Sopenharmony_ci#define _ASMARM_TRAP_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/list.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_cistruct pt_regs;
88c2ecf20Sopenharmony_cistruct task_struct;
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_cistruct undef_hook {
118c2ecf20Sopenharmony_ci	struct list_head node;
128c2ecf20Sopenharmony_ci	u32 instr_mask;
138c2ecf20Sopenharmony_ci	u32 instr_val;
148c2ecf20Sopenharmony_ci	u32 cpsr_mask;
158c2ecf20Sopenharmony_ci	u32 cpsr_val;
168c2ecf20Sopenharmony_ci	int (*fn)(struct pt_regs *regs, unsigned int instr);
178c2ecf20Sopenharmony_ci};
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_civoid register_undef_hook(struct undef_hook *hook);
208c2ecf20Sopenharmony_civoid unregister_undef_hook(struct undef_hook *hook);
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_cistatic inline int __in_irqentry_text(unsigned long ptr)
238c2ecf20Sopenharmony_ci{
248c2ecf20Sopenharmony_ci	extern char __irqentry_text_start[];
258c2ecf20Sopenharmony_ci	extern char __irqentry_text_end[];
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci	return ptr >= (unsigned long)&__irqentry_text_start &&
288c2ecf20Sopenharmony_ci	       ptr < (unsigned long)&__irqentry_text_end;
298c2ecf20Sopenharmony_ci}
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciextern void __init early_trap_init(void *);
328c2ecf20Sopenharmony_ciextern void dump_backtrace_entry(unsigned long where, unsigned long from,
338c2ecf20Sopenharmony_ci				 unsigned long frame, const char *loglvl);
348c2ecf20Sopenharmony_ciextern void ptrace_break(struct pt_regs *regs);
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ciextern void *vectors_page;
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#endif
39