Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef __ASSERT_MACROS_S__ |
| 8 | #define __ASSERT_MACROS_S__ |
| 9 | |
| 10 | /* |
| 11 | * Assembler macro to enable asm_assert. Use this macro wherever |
| 12 | * assert is required in assembly. Please note that the macro makes |
| 13 | * use of label '300' to provide the logic and the caller |
| 14 | * should make sure that this label is not used to branch prior |
| 15 | * to calling this macro. |
| 16 | */ |
| 17 | #define ASM_ASSERT(_cc) \ |
| 18 | .ifndef .L_assert_filename ;\ |
| 19 | .pushsection .rodata.str1.1, "aS" ;\ |
| 20 | .L_assert_filename: ;\ |
| 21 | .string __FILE__ ;\ |
| 22 | .popsection ;\ |
| 23 | .endif ;\ |
| 24 | b._cc 300f ;\ |
| 25 | adr x0, .L_assert_filename ;\ |
| 26 | mov x1, __LINE__ ;\ |
| 27 | b asm_assert ;\ |
| 28 | 300: |
| 29 | |
| 30 | #endif /* __ASSERT_MACROS_S__ */ |