1 /* 2 * Copyright (c) 2014 Wind River Systems, Inc. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /** 8 * @file 9 * @brief ARCv2 public error handling 10 * 11 * ARC-specific kernel error handling interface. Included by arc/arch.h. 12 */ 13 14 #ifndef ZEPHYR_INCLUDE_ARCH_ARC_V2_ERROR_H_ 15 #define ZEPHYR_INCLUDE_ARCH_ARC_V2_ERROR_H_ 16 17 #include <zephyr/arch/arc/syscall.h> 18 #include <zephyr/arch/arc/v2/exc.h> 19 #include <stdbool.h> 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 /* 26 * use trap_s to raise a SW exception 27 */ 28 #define ARCH_EXCEPT(reason_p) do { \ 29 __asm__ volatile ( \ 30 "mov %%r0, %[reason]\n\t" \ 31 "trap_s %[id]\n\t" \ 32 : \ 33 : [reason] "i" (reason_p), \ 34 [id] "i" (_TRAP_S_CALL_RUNTIME_EXCEPT) \ 35 : "memory"); \ 36 CODE_UNREACHABLE; /* LCOV_EXCL_LINE */ \ 37 } while (false) 38 39 #ifdef __cplusplus 40 } 41 #endif 42 43 44 #endif /* ZEPHYR_INCLUDE_ARCH_ARC_V2_ERROR_H_ */ 45