arm_bx.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* Copyright (C) 2013 Yann E. MORIN <yann.morin.1998@free.fr>
  2. *
  3. * This file is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU Lesser General Public License as
  5. * published by the Free Software Foundation; either version 2.1 of
  6. * the License, or (at your option) any later version.
  7. *
  8. * This file is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. * Lesser General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Lesser General Public
  14. * License along with the GNU C Library; if not, see
  15. * <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef _ARM_BX_H
  18. #define _ARM_BX_H
  19. /* We need features.h first */
  20. #if !defined _FEATURES_H
  21. #error Please include features.h first
  22. #endif /* features.h not yet included */
  23. #if defined(__USE_BX__)
  24. # if (__ARM_ARCH <= 4 && !defined __ARM_ARCH_4T__)
  25. # error Use of BX was requested, but is not available on the target processor.
  26. # endif /* ARCH level */
  27. #endif /* __USE_BX__ */
  28. #if defined(__USE_BX__) && (__ARM_ARCH > 4 || (__ARM_ARCH == 4 && defined __ARM_ARCH_4T__))
  29. # define BX(reg) bx reg
  30. # define BXC(cond, reg) bx##cond reg
  31. #else
  32. # define BX(reg) mov pc, reg
  33. # define BXC(cond, reg) mov##cond pc, reg
  34. #endif
  35. #endif /* _ARM_BX_H */