1 /*
2  * Copyright (c) 2020 Carlo Caione <ccaione@baylibre.com>
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /**
8  * @file
9  * @brief ARM AArch64 public error handling
10  *
11  * ARM AArch64-specific kernel error handling interface. Included by arch.h.
12  */
13 
14 #ifndef ZEPHYR_INCLUDE_ARCH_ARM64_ERROR_H_
15 #define ZEPHYR_INCLUDE_ARCH_ARM64_ERROR_H_
16 
17 #include <zephyr/arch/arm64/syscall.h>
18 #include <zephyr/arch/arm64/exception.h>
19 #include <stdbool.h>
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 #define ARCH_EXCEPT(reason_p)						\
26 do {									\
27 	register uint64_t x8 __asm__("x8") = reason_p;			\
28 									\
29 	__asm__ volatile("svc %[id]\n"					\
30 			 :						\
31 			 : [id] "i" (_SVC_CALL_RUNTIME_EXCEPT),		\
32 				"r" (x8)				\
33 			 : "memory");					\
34 } while (false)
35 
36 #ifdef __cplusplus
37 }
38 #endif
39 
40 #endif /* ZEPHYR_INCLUDE_ARCH_ARM64_ERROR_H_ */
41