11bb92983SJerome Forissier // SPDX-License-Identifier: BSD-2-Clause
2b0104773SPascal Brand /*
3b0104773SPascal Brand * Copyright (c) 2014, STMicroelectronics International N.V.
4b0104773SPascal Brand */
58ddf5a4eSEtienne Carriere
6b0104773SPascal Brand #include <assert.h>
7dbd392c9SPascal Brand #include <compiler.h>
88ddf5a4eSEtienne Carriere #include <trace.h>
9a046599aSJens Wiklander #include <kernel/panic.h>
10b0104773SPascal Brand
118ddf5a4eSEtienne Carriere /* assert log and break for the optee kernel */
12b0104773SPascal Brand
_assert_log(const char * expr __maybe_unused,const char * file __maybe_unused,const int line __maybe_unused,const char * func __maybe_unused)13*e2f03e07SJerome Forissier void __nostackcheck _assert_log(const char *expr __maybe_unused,
148c9d9445SEtienne Carriere const char *file __maybe_unused,
158c9d9445SEtienne Carriere const int line __maybe_unused,
168c9d9445SEtienne Carriere const char *func __maybe_unused)
17b0104773SPascal Brand {
183f17b838SEtienne Carriere #if defined(CFG_TEE_CORE_DEBUG)
198c9d9445SEtienne Carriere EMSG_RAW("assertion '%s' failed at %s:%d <%s>",
208c9d9445SEtienne Carriere expr, file, line, func);
218c9d9445SEtienne Carriere #else
228c9d9445SEtienne Carriere EMSG_RAW("assertion failed");
238c9d9445SEtienne Carriere #endif
24b0104773SPascal Brand }
25b0104773SPascal Brand
_assert_break(void)26dbd392c9SPascal Brand void __noreturn _assert_break(void)
27b0104773SPascal Brand {
28a046599aSJens Wiklander panic();
29b0104773SPascal Brand }
30