xref: /arm-trusted-firmware/include/arch/aarch64/assert_macros.S (revision 91f16700b400a8c0651d24a598fc48ee2997a0d7)
1*91f16700Schasinglulu/*
2*91f16700Schasinglulu * Copyright (c) 2014-2016, ARM Limited and Contributors. All rights reserved.
3*91f16700Schasinglulu *
4*91f16700Schasinglulu * SPDX-License-Identifier: BSD-3-Clause
5*91f16700Schasinglulu */
6*91f16700Schasinglulu#ifndef ASSERT_MACROS_S
7*91f16700Schasinglulu#define ASSERT_MACROS_S
8*91f16700Schasinglulu
9*91f16700Schasinglulu	/*
10*91f16700Schasinglulu	 * Assembler macro to enable asm_assert. Use this macro wherever
11*91f16700Schasinglulu	 * assert is required in assembly. Please note that the macro makes
12*91f16700Schasinglulu	 * use of label '300' to provide the logic and the caller
13*91f16700Schasinglulu	 * should make sure that this label is not used to branch prior
14*91f16700Schasinglulu	 * to calling this macro.
15*91f16700Schasinglulu	 */
16*91f16700Schasinglulu#define ASM_ASSERT(_cc) \
17*91f16700Schasinglulu.ifndef .L_assert_filename ;\
18*91f16700Schasinglulu	.pushsection .rodata.str1.1, "aS" ;\
19*91f16700Schasinglulu	.L_assert_filename: ;\
20*91f16700Schasinglulu			.string	__FILE__ ;\
21*91f16700Schasinglulu	.popsection ;\
22*91f16700Schasinglulu.endif ;\
23*91f16700Schasinglulu	b._cc	300f ;\
24*91f16700Schasinglulu	adr	x0, .L_assert_filename ;\
25*91f16700Schasinglulu	mov	x1, __LINE__ ;\
26*91f16700Schasinglulu	b	asm_assert ;\
27*91f16700Schasinglulu300:
28*91f16700Schasinglulu
29*91f16700Schasinglulu#endif /* ASSERT_MACROS_S */
30