blob: 4567c69bf3f217be42c21c23ae9f8f11a10feb7e [file] [log] [blame]
Soby Mathew041f62a2014-07-14 16:58:03 +01001/*
Soby Mathew0d786072016-03-24 16:56:29 +00002 * Copyright (c) 2014-2016, ARM Limited and Contributors. All rights reserved.
Soby Mathew041f62a2014-07-14 16:58:03 +01003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Soby Mathew041f62a2014-07-14 16:58:03 +01005 */
Dan Handleyea596682015-04-01 17:34:24 +01006#ifndef __ASSERT_MACROS_S__
7#define __ASSERT_MACROS_S__
Soby Mathew041f62a2014-07-14 16:58:03 +01008
9 /*
10 * Assembler macro to enable asm_assert. Use this macro wherever
Soby Mathew1218f112014-08-19 11:26:00 +010011 * assert is required in assembly. Please note that the macro makes
12 * use of label '300' to provide the logic and the caller
13 * should make sure that this label is not used to branch prior
14 * to calling this macro.
Soby Mathew041f62a2014-07-14 16:58:03 +010015 */
16#define ASM_ASSERT(_cc) \
17.ifndef .L_assert_filename ;\
18 .pushsection .rodata.str1.1, "aS" ;\
19 .L_assert_filename: ;\
20 .string __FILE__ ;\
21 .popsection ;\
22.endif ;\
Soby Mathew1218f112014-08-19 11:26:00 +010023 b._cc 300f ;\
Soby Mathew041f62a2014-07-14 16:58:03 +010024 adr x0, .L_assert_filename ;\
25 mov x1, __LINE__ ;\
26 b asm_assert ;\
Soby Mathew1218f112014-08-19 11:26:00 +010027300:
Dan Handleyea596682015-04-01 17:34:24 +010028
29#endif /* __ASSERT_MACROS_S__ */