8#ifndef ZEPHYR_INCLUDE_ARCH_EXCEPTION_H_
9#define ZEPHYR_INCLUDE_ARCH_EXCEPTION_H_
23#if defined(CONFIG_EXCEPTION_DUMP_HOOK)
38typedef void (*arch_exception_dump_hook_t)(
const char *format, va_list args);
48typedef void (*arch_exception_drain_hook_t)(
bool flush);
50extern arch_exception_dump_hook_t arch_exception_dump_hook;
51extern arch_exception_drain_hook_t arch_exception_drain_hook;
61static inline void arch_exception_set_dump_hook(arch_exception_dump_hook_t dump,
62 arch_exception_drain_hook_t drain)
64 arch_exception_dump_hook = dump;
65 arch_exception_drain_hook = drain;
75static inline void arch_exception_call_drain_hook(
bool flush)
77 if (arch_exception_drain_hook) {
78 arch_exception_drain_hook(flush);
91static inline void arch_exception_call_dump_hook(
const char *format, ...)
95 if (arch_exception_dump_hook) {
96 va_start(args, format);
97 arch_exception_dump_hook(format, args);
102#if !defined(CONFIG_EXCEPTION_DUMP)
103#define EXCEPTION_DUMP(format, ...) \
106 arch_exception_dump_arg_check(format, ##__VA_ARGS__); \
109#elif defined(CONFIG_EXCEPTION_DUMP_HOOK_ONLY)
110#define EXCEPTION_DUMP(format, ...) \
113 arch_exception_call_dump_hook(format "\n", ##__VA_ARGS__); \
115#elif defined(CONFIG_LOG)
116#define EXCEPTION_DUMP(format, ...) \
119 arch_exception_call_dump_hook(format "\n", ##__VA_ARGS__); \
120 LOG_ERR(format, ##__VA_ARGS__); \
123#define EXCEPTION_DUMP(format, ...) \
126 arch_exception_call_dump_hook(format "\n", ##__VA_ARGS__); \
127 printk(format "\n", ##__VA_ARGS__); \
133#if !defined(CONFIG_EXCEPTION_DUMP)
134#define EXCEPTION_DUMP(format, ...) \
137 arch_exception_dump_arg_check(format, ##__VA_ARGS__); \
140#elif defined(CONFIG_LOG)
141#define EXCEPTION_DUMP(...) \
144 LOG_ERR(__VA_ARGS__); \
147#define EXCEPTION_DUMP(format, ...) \
150 printk(format "\n", ##__VA_ARGS__); \
157#if defined(CONFIG_X86_64)
159#elif defined(CONFIG_X86)
161#elif defined(CONFIG_ARM64)
163#elif defined(CONFIG_ARM)
165#elif defined(CONFIG_ARC)
167#elif defined(CONFIG_RISCV)
169#elif defined(CONFIG_XTENSA)
171#elif defined(CONFIG_MIPS)
173#elif defined(CONFIG_OPENRISC)
175#elif defined(CONFIG_ARCH_POSIX)
177#elif defined(CONFIG_SPARC)
179#elif defined(CONFIG_RX)
181#elif defined(CONFIG_ARCH_IS_SET)
182#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:18
OpenRISC public exception handling.
RISCV public exception handling.
Xtensa public exception handling.