xref: /linux/arch/arm/include/asm/traps.h (revision 1b0975ee3bdd3eb19a47371c26fd7ef8f7f6b599)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASMARM_TRAP_H
3 #define _ASMARM_TRAP_H
4 
5 #include <linux/list.h>
6 
7 struct pt_regs;
8 struct task_struct;
9 
10 struct undef_hook {
11 	struct list_head node;
12 	u32 instr_mask;
13 	u32 instr_val;
14 	u32 cpsr_mask;
15 	u32 cpsr_val;
16 	int (*fn)(struct pt_regs *regs, unsigned int instr);
17 };
18 
19 void register_undef_hook(struct undef_hook *hook);
20 void unregister_undef_hook(struct undef_hook *hook);
21 
22 static inline int __in_irqentry_text(unsigned long ptr)
23 {
24 	extern char __irqentry_text_start[];
25 	extern char __irqentry_text_end[];
26 
27 	return ptr >= (unsigned long)&__irqentry_text_start &&
28 	       ptr < (unsigned long)&__irqentry_text_end;
29 }
30 
31 extern void __init early_trap_init(void *);
32 extern void dump_backtrace_entry(unsigned long where, unsigned long from,
33 				 unsigned long frame, const char *loglvl);
34 extern void ptrace_break(struct pt_regs *regs);
35 
36 extern void *vectors_page;
37 
38 asmlinkage void dump_backtrace_stm(u32 *stack, u32 instruction, const char *loglvl);
39 asmlinkage void do_undefinstr(struct pt_regs *regs);
40 asmlinkage void handle_fiq_as_nmi(struct pt_regs *regs);
41 asmlinkage void bad_mode(struct pt_regs *regs, int reason);
42 asmlinkage int arm_syscall(int no, struct pt_regs *regs);
43 asmlinkage void baddataabort(int code, unsigned long instr, struct pt_regs *regs);
44 asmlinkage void __div0(void);
45 asmlinkage void handle_bad_stack(struct pt_regs *regs);
46 
47 #endif
48