unified.h 2.6 KB

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