blob: 06371c4208616a26050e675b5c8a74fae16a537f [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 */
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00006#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
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000029#endif /* ASSERT_MACROS_S */