Soby Mathew | 041f62a | 2014-07-14 16:58:03 +0100 | [diff] [blame] | 1 | /* |
Soby Mathew | 0d78607 | 2016-03-24 16:56:29 +0000 | [diff] [blame] | 2 | * Copyright (c) 2014-2016, ARM Limited and Contributors. All rights reserved. |
Soby Mathew | 041f62a | 2014-07-14 16:58:03 +0100 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Soby Mathew | 041f62a | 2014-07-14 16:58:03 +0100 | [diff] [blame] | 5 | */ |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 6 | #ifndef ASSERT_MACROS_S |
| 7 | #define ASSERT_MACROS_S |
Soby Mathew | 041f62a | 2014-07-14 16:58:03 +0100 | [diff] [blame] | 8 | |
| 9 | /* |
| 10 | * Assembler macro to enable asm_assert. Use this macro wherever |
Soby Mathew | 1218f11 | 2014-08-19 11:26:00 +0100 | [diff] [blame] | 11 | * 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 Mathew | 041f62a | 2014-07-14 16:58:03 +0100 | [diff] [blame] | 15 | */ |
| 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 Mathew | 1218f11 | 2014-08-19 11:26:00 +0100 | [diff] [blame] | 23 | b._cc 300f ;\ |
Soby Mathew | 041f62a | 2014-07-14 16:58:03 +0100 | [diff] [blame] | 24 | adr x0, .L_assert_filename ;\ |
| 25 | mov x1, __LINE__ ;\ |
| 26 | b asm_assert ;\ |
Soby Mathew | 1218f11 | 2014-08-19 11:26:00 +0100 | [diff] [blame] | 27 | 300: |
Dan Handley | ea59668 | 2015-04-01 17:34:24 +0100 | [diff] [blame] | 28 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 29 | #endif /* ASSERT_MACROS_S */ |