unified.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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_THUMB2_KERNEL
  25. #if __GNUC__ < 4
  26. #error Thumb-2 kernel requires gcc >= 4
  27. #endif
  28. /* The CPSR bit describing the instruction set (Thumb) */
  29. #define PSR_ISETSTATE PSR_T_BIT
  30. #define ARM(x...)
  31. #define THUMB(x...) x
  32. #ifdef __ASSEMBLY__
  33. #define W(instr) instr.w
  34. #define BSYM(sym) sym + 1
  35. #else
  36. #define WASM(instr) #instr ".w"
  37. #endif
  38. #else /* !CONFIG_THUMB2_KERNEL */
  39. /* The CPSR bit describing the instruction set (ARM) */
  40. #define PSR_ISETSTATE 0
  41. #define ARM(x...) x
  42. #define THUMB(x...)
  43. #ifdef __ASSEMBLY__
  44. #define W(instr) instr
  45. #define BSYM(sym) sym
  46. #else
  47. #define WASM(instr) #instr
  48. #endif
  49. #endif /* CONFIG_THUMB2_KERNEL */
  50. #ifndef CONFIG_ARM_ASM_UNIFIED
  51. /*
  52. * If the unified assembly syntax isn't used (in ARM mode), these
  53. * macros expand to an empty string
  54. */
  55. #ifdef __ASSEMBLY__
  56. .macro it, cond
  57. .endm
  58. .macro itt, cond
  59. .endm
  60. .macro ite, cond
  61. .endm
  62. .macro ittt, cond
  63. .endm
  64. .macro itte, cond
  65. .endm
  66. .macro itet, cond
  67. .endm
  68. .macro itee, cond
  69. .endm
  70. .macro itttt, cond
  71. .endm
  72. .macro ittte, cond
  73. .endm
  74. .macro ittet, cond
  75. .endm
  76. .macro ittee, cond
  77. .endm
  78. .macro itett, cond
  79. .endm
  80. .macro itete, cond
  81. .endm
  82. .macro iteet, cond
  83. .endm
  84. .macro iteee, cond
  85. .endm
  86. #else /* !__ASSEMBLY__ */
  87. __asm__(
  88. " .macro it, cond\n"
  89. " .endm\n"
  90. " .macro itt, cond\n"
  91. " .endm\n"
  92. " .macro ite, cond\n"
  93. " .endm\n"
  94. " .macro ittt, cond\n"
  95. " .endm\n"
  96. " .macro itte, cond\n"
  97. " .endm\n"
  98. " .macro itet, cond\n"
  99. " .endm\n"
  100. " .macro itee, cond\n"
  101. " .endm\n"
  102. " .macro itttt, cond\n"
  103. " .endm\n"
  104. " .macro ittte, cond\n"
  105. " .endm\n"
  106. " .macro ittet, cond\n"
  107. " .endm\n"
  108. " .macro ittee, cond\n"
  109. " .endm\n"
  110. " .macro itett, cond\n"
  111. " .endm\n"
  112. " .macro itete, cond\n"
  113. " .endm\n"
  114. " .macro iteet, cond\n"
  115. " .endm\n"
  116. " .macro iteee, cond\n"
  117. " .endm\n");
  118. #endif /* __ASSEMBLY__ */
  119. #endif /* CONFIG_ARM_ASM_UNIFIED */
  120. #endif /* !__ASM_UNIFIED_H */