8#ifndef ZEPHYR_INCLUDE_ARCH_EXCEPTION_H_
9#define ZEPHYR_INCLUDE_ARCH_EXCEPTION_H_
22#if defined(CONFIG_EXCEPTION_DUMP_HOOK)
37typedef void (*arch_exception_dump_hook_t)(
const char *format, va_list args);
47typedef void (*arch_exception_drain_hook_t)(
bool flush);
49extern arch_exception_dump_hook_t arch_exception_dump_hook;
50extern arch_exception_drain_hook_t arch_exception_drain_hook;
60static inline void arch_exception_set_dump_hook(arch_exception_dump_hook_t dump,
61 arch_exception_drain_hook_t drain)
63 arch_exception_dump_hook = dump;
64 arch_exception_drain_hook = drain;
74static inline void arch_exception_call_drain_hook(
bool flush)
76 if (arch_exception_drain_hook) {
77 arch_exception_drain_hook(flush);
90static inline void arch_exception_call_dump_hook(
const char *format, ...)
94 if (arch_exception_dump_hook) {
95 va_start(args, format);
96 arch_exception_dump_hook(format, args);
101#if !defined(CONFIG_EXCEPTION_DUMP)
102#define EXCEPTION_DUMP(format, ...) \
105 arch_exception_dump_arg_check(format, ##__VA_ARGS__); \
108#elif defined(CONFIG_EXCEPTION_DUMP_HOOK_ONLY)
109#define EXCEPTION_DUMP(format, ...) arch_exception_call_dump_hook(format "\n", ##__VA_ARGS__)
110#elif defined(CONFIG_LOG)
111#define EXCEPTION_DUMP(format, ...) arch_exception_call_dump_hook(format "\n", ##__VA_ARGS__); \
112 LOG_ERR(format, ##__VA_ARGS__)
114#define EXCEPTION_DUMP(format, ...) arch_exception_call_dump_hook(format "\n", ##__VA_ARGS__); \
115 printk(format "\n", ##__VA_ARGS__)
120#if !defined(CONFIG_EXCEPTION_DUMP)
121#define EXCEPTION_DUMP(format, ...) \
124 arch_exception_dump_arg_check(format, ##__VA_ARGS__); \
127#elif defined(CONFIG_LOG)
128#define EXCEPTION_DUMP(...) LOG_ERR(__VA_ARGS__)
130#define EXCEPTION_DUMP(format, ...) printk(format "\n", ##__VA_ARGS__)
136#if defined(CONFIG_X86_64)
138#elif defined(CONFIG_X86)
140#elif defined(CONFIG_ARM64)
142#elif defined(CONFIG_ARM)
144#elif defined(CONFIG_ARC)
146#elif defined(CONFIG_RISCV)
148#elif defined(CONFIG_XTENSA)
150#elif defined(CONFIG_MIPS)
152#elif defined(CONFIG_OPENRISC)
154#elif defined(CONFIG_ARCH_POSIX)
156#elif defined(CONFIG_SPARC)
158#elif defined(CONFIG_RX)
160#elif defined(CONFIG_ARCH_IS_SET)
161#error "The selected architecture is missing from this dispatch header"
ARCv2 public exception handling.
Cortex-A public exception handling.
ARM AArch32 public exception handling.
static void arch_exception_dump_arg_check(const char *fmt,...)
Dummy function to trigger exception dump argument type checking.
Definition exception.h:17
OpenRISC public exception handling.
RISCV public exception handling.
Xtensa public exception handling.