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