xref: /optee_os/lib/libutee/assert.c (revision 2c028fdebbedee91f88f6c5325b5064a124dfe46)
11bb92983SJerome Forissier // SPDX-License-Identifier: BSD-2-Clause
2b0104773SPascal Brand /*
3b0104773SPascal Brand  * Copyright (c) 2014, STMicroelectronics International N.V.
4b0104773SPascal Brand  */
58c9d9445SEtienne Carriere 
6b0104773SPascal Brand #include <assert.h>
76db75bd2SPascal Brand #include <compiler.h>
88c9d9445SEtienne Carriere #include <trace.h>
9b0104773SPascal Brand #include <tee_internal_api.h>
10b0104773SPascal Brand #include <tee_internal_api_extensions.h>
116db75bd2SPascal Brand #include <utee_syscalls.h>
12b0104773SPascal Brand 
_assert_log(const char * expr __maybe_unused,const char * file __maybe_unused,const int line __maybe_unused,const char * func __maybe_unused)133276098dSJerome Forissier void _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 {
188c9d9445SEtienne Carriere 	EMSG_RAW("assertion '%s' failed at %s:%d in %s()",
198c9d9445SEtienne Carriere 				expr, file, line, func);
20b0104773SPascal Brand }
21b0104773SPascal Brand 
_assert_break(void)226db75bd2SPascal Brand void __noreturn _assert_break(void)
23b0104773SPascal Brand {
24*2c028fdeSJerome Forissier 	_utee_panic(TEE_ERROR_GENERIC);
250e1c6e8eSJerome Forissier 	/* Not reached */
260e1c6e8eSJerome Forissier 	while (1)
270e1c6e8eSJerome Forissier 		;
28b0104773SPascal Brand }
29