assert_macros.S 760 B

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