xref: /optee_os/core/include/kernel/abort.h (revision 325d496372fce39d1e3c3aa07da6ee80523797e8)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2015-2021, Linaro Limited
4  */
5 
6 #ifndef __KERNEL_ABORT_H
7 #define __KERNEL_ABORT_H
8 
9 #define ABORT_TYPE_UNDEF		0
10 #define ABORT_TYPE_PREFETCH		1
11 #define ABORT_TYPE_DATA			2
12 /* Dump stack on user mode panic (not an abort) */
13 #define ABORT_TYPE_USER_MODE_PANIC	3
14 
15 #ifndef __ASSEMBLER__
16 
17 #include <compiler.h>
18 #include <types_ext.h>
19 
20 struct abort_info {
21 	uint32_t abort_type;
22 	uint32_t fault_descr;	/* only valid for data of prefetch abort */
23 	vaddr_t va;
24 	uint32_t pc;
25 	struct thread_abort_regs *regs;
26 };
27 
28 /* Print abort info to the console */
29 void abort_print(struct abort_info *ai);
30 
31 /* Print abort info + stack dump to the console */
32 void abort_print_error(struct abort_info *ai);
33 
34 void abort_handler(uint32_t abort_type, struct thread_abort_regs *regs);
35 
36 /*
37  * Platform specific handler for external abort exceptions.
38  * CFG_EXTERNAL_ABORT_PLAT_HANDLER must be enabled to have the platform handler
39  * be called.
40  */
41 void plat_external_abort_handler(struct abort_info *ai);
42 
43 bool abort_is_user_exception(struct abort_info *ai);
44 
45 bool abort_is_write_fault(struct abort_info *ai);
46 
47 /* Called from a normal thread */
48 void abort_print_current_ts(void);
49 
50 #endif /*__ASSEMBLER__*/
51 #endif /*__KERNEL_ABORT_H*/
52 
53