8#ifndef ZEPHYR_INCLUDE_ARCH_EXCEPTION_H_
9#define ZEPHYR_INCLUDE_ARCH_EXCEPTION_H_
23#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, ...) \
112 arch_exception_call_dump_hook(format "\n", ##__VA_ARGS__); \
114#elif defined(CONFIG_LOG)
115#define EXCEPTION_DUMP(format, ...) \
118 arch_exception_call_dump_hook(format "\n", ##__VA_ARGS__); \
119 LOG_ERR(format, ##__VA_ARGS__); \
122#define EXCEPTION_DUMP(format, ...) \
125 arch_exception_call_dump_hook(format "\n", ##__VA_ARGS__); \
126 printk(format "\n", ##__VA_ARGS__); \
132#if !defined(CONFIG_EXCEPTION_DUMP)
133#define EXCEPTION_DUMP(format, ...) \
136 arch_exception_dump_arg_check(format, ##__VA_ARGS__); \
139#elif defined(CONFIG_LOG)
140#define EXCEPTION_DUMP(...) \
143 LOG_ERR(__VA_ARGS__); \
146#define EXCEPTION_DUMP(format, ...) \
149 printk(format "\n", ##__VA_ARGS__); \
156#if defined(CONFIG_X86_64)
157#include <zephyr/arch/x86/intel64/exception.h>
158#elif defined(CONFIG_X86)
159#include <zephyr/arch/x86/ia32/exception.h>
160#elif defined(CONFIG_ARM64)
161#include <zephyr/arch/arm64/exception.h>
162#elif defined(CONFIG_ARM)
163#include <zephyr/arch/arm/exception.h>
164#elif defined(CONFIG_ARC)
165#include <zephyr/arch/arc/v2/exception.h>
166#elif defined(CONFIG_RISCV)
167#include <zephyr/arch/riscv/exception.h>
168#elif defined(CONFIG_XTENSA)
169#include <zephyr/arch/xtensa/exception.h>
170#elif defined(CONFIG_MIPS)
171#include <zephyr/arch/mips/exception.h>
172#elif defined(CONFIG_OPENRISC)
173#include <zephyr/arch/openrisc/exception.h>
174#elif defined(CONFIG_ARCH_POSIX)
175#include <zephyr/arch/posix/exception.h>
176#elif defined(CONFIG_SPARC)
177#include <zephyr/arch/sparc/exception.h>
178#elif defined(CONFIG_RX)
179#include <zephyr/arch/rx/exception.h>
180#elif defined(CONFIG_HEXAGON)
181#include <zephyr/arch/hexagon/exception.h>
182#elif defined(CONFIG_TRICORE)
184#elif defined(CONFIG_ARCH_IS_SET)
185#error "The selected architecture is missing from this dispatch header"
static void arch_exception_dump_arg_check(const char *fmt,...)
Dummy function to trigger exception dump argument type checking.
Definition exception.h:18
TriCore public exception handling.