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