unified.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. * include/asm-arm/unified.h - Unified Assembler Syntax helper macros
  3. *
  4. * Copyright (C) 2008 ARM Limited
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #ifndef __ASM_UNIFIED_H
  20. #define __ASM_UNIFIED_H
  21. #if defined(__ASSEMBLY__) && defined(CONFIG_ARM_ASM_UNIFIED)
  22. .syntax unified
  23. #endif
  24. #ifdef CONFIG_CPU_V7M
  25. #define AR_CLASS(x...)
  26. #define M_CLASS(x...) x
  27. #else
  28. #define AR_CLASS(x...) x
  29. #define M_CLASS(x...)
  30. #endif
  31. #ifdef CONFIG_THUMB2_KERNEL
  32. #if __GNUC__ < 4
  33. #error Thumb-2 kernel requires gcc >= 4
  34. #endif
  35. /* The CPSR bit describing the instruction set (Thumb) */
  36. #define PSR_ISETSTATE PSR_T_BIT
  37. #define ARM(x...)
  38. #define THUMB(x...) x
  39. #ifdef __ASSEMBLY__
  40. #define W(instr) instr.w
  41. #else
  42. #define WASM(instr) #instr ".w"
  43. #endif
  44. #else /* !CONFIG_THUMB2_KERNEL */
  45. /* The CPSR bit describing the instruction set (ARM) */
  46. #define PSR_ISETSTATE 0
  47. #define ARM(x...) x
  48. #define THUMB(x...)
  49. #ifdef __ASSEMBLY__
  50. #define W(instr) instr
  51. #else
  52. #define WASM(instr) #instr
  53. #endif
  54. #endif /* CONFIG_THUMB2_KERNEL */
  55. #ifndef CONFIG_ARM_ASM_UNIFIED
  56. /*
  57. * If the unified assembly syntax isn't used (in ARM mode), these
  58. * macros expand to an empty string
  59. */
  60. #ifdef __ASSEMBLY__
  61. .macro it, cond
  62. .endm
  63. .macro itt, cond
  64. .endm
  65. .macro ite, cond
  66. .endm
  67. .macro ittt, cond
  68. .endm
  69. .macro itte, cond
  70. .endm
  71. .macro itet, cond
  72. .endm
  73. .macro itee, cond
  74. .endm
  75. .macro itttt, cond
  76. .endm
  77. .macro ittte, cond
  78. .endm
  79. .macro ittet, cond
  80. .endm
  81. .macro ittee, cond
  82. .endm
  83. .macro itett, cond
  84. .endm
  85. .macro itete, cond
  86. .endm
  87. .macro iteet, cond
  88. .endm
  89. .macro iteee, cond
  90. .endm
  91. #else /* !__ASSEMBLY__ */
  92. __asm__(
  93. " .macro it, cond\n"
  94. " .endm\n"
  95. " .macro itt, cond\n"
  96. " .endm\n"
  97. " .macro ite, cond\n"
  98. " .endm\n"
  99. " .macro ittt, cond\n"
  100. " .endm\n"
  101. " .macro itte, cond\n"
  102. " .endm\n"
  103. " .macro itet, cond\n"
  104. " .endm\n"
  105. " .macro itee, cond\n"
  106. " .endm\n"
  107. " .macro itttt, cond\n"
  108. " .endm\n"
  109. " .macro ittte, cond\n"
  110. " .endm\n"
  111. " .macro ittet, cond\n"
  112. " .endm\n"
  113. " .macro ittee, cond\n"
  114. " .endm\n"
  115. " .macro itett, cond\n"
  116. " .endm\n"
  117. " .macro itete, cond\n"
  118. " .endm\n"
  119. " .macro iteet, cond\n"
  120. " .endm\n"
  121. " .macro iteee, cond\n"
  122. " .endm\n");
  123. #endif /* __ASSEMBLY__ */
  124. #endif /* CONFIG_ARM_ASM_UNIFIED */
  125. #endif /* !__ASM_UNIFIED_H */