unified.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * include/asm-arm/unified.h - Unified Assembler Syntax helper macros
  4. *
  5. * Copyright (C) 2008 ARM Limited
  6. */
  7. #ifndef __ASM_UNIFIED_H
  8. #define __ASM_UNIFIED_H
  9. #if defined(__ASSEMBLY__) && defined(CONFIG_ARM_ASM_UNIFIED)
  10. .syntax unified
  11. #endif
  12. #ifdef CONFIG_CPU_V7M
  13. #define AR_CLASS(x...)
  14. #define M_CLASS(x...) x
  15. #else
  16. #define AR_CLASS(x...) x
  17. #define M_CLASS(x...)
  18. #endif
  19. #ifdef CONFIG_THUMB2_KERNEL
  20. #if __GNUC__ < 4
  21. #error Thumb-2 kernel requires gcc >= 4
  22. #endif
  23. /* The CPSR bit describing the instruction set (Thumb) */
  24. #define PSR_ISETSTATE PSR_T_BIT
  25. #define ARM(x...)
  26. #define THUMB(x...) x
  27. #ifdef __ASSEMBLY__
  28. #define W(instr) instr.w
  29. #else
  30. #define WASM(instr) #instr ".w"
  31. #endif
  32. #else /* !CONFIG_THUMB2_KERNEL */
  33. /* The CPSR bit describing the instruction set (ARM) */
  34. #define PSR_ISETSTATE 0
  35. #define ARM(x...) x
  36. #define THUMB(x...)
  37. #ifdef __ASSEMBLY__
  38. #define W(instr) instr
  39. #else
  40. #define WASM(instr) #instr
  41. #endif
  42. #endif /* CONFIG_THUMB2_KERNEL */
  43. #ifndef CONFIG_ARM_ASM_UNIFIED
  44. /*
  45. * If the unified assembly syntax isn't used (in ARM mode), these
  46. * macros expand to an empty string
  47. */
  48. #ifdef __ASSEMBLY__
  49. .macro it, cond
  50. .endm
  51. .macro itt, cond
  52. .endm
  53. .macro ite, cond
  54. .endm
  55. .macro ittt, cond
  56. .endm
  57. .macro itte, cond
  58. .endm
  59. .macro itet, cond
  60. .endm
  61. .macro itee, cond
  62. .endm
  63. .macro itttt, cond
  64. .endm
  65. .macro ittte, cond
  66. .endm
  67. .macro ittet, cond
  68. .endm
  69. .macro ittee, cond
  70. .endm
  71. .macro itett, cond
  72. .endm
  73. .macro itete, cond
  74. .endm
  75. .macro iteet, cond
  76. .endm
  77. .macro iteee, cond
  78. .endm
  79. #else /* !__ASSEMBLY__ */
  80. __asm__(
  81. " .macro it, cond\n"
  82. " .endm\n"
  83. " .macro itt, cond\n"
  84. " .endm\n"
  85. " .macro ite, cond\n"
  86. " .endm\n"
  87. " .macro ittt, cond\n"
  88. " .endm\n"
  89. " .macro itte, cond\n"
  90. " .endm\n"
  91. " .macro itet, cond\n"
  92. " .endm\n"
  93. " .macro itee, cond\n"
  94. " .endm\n"
  95. " .macro itttt, cond\n"
  96. " .endm\n"
  97. " .macro ittte, cond\n"
  98. " .endm\n"
  99. " .macro ittet, cond\n"
  100. " .endm\n"
  101. " .macro ittee, cond\n"
  102. " .endm\n"
  103. " .macro itett, cond\n"
  104. " .endm\n"
  105. " .macro itete, cond\n"
  106. " .endm\n"
  107. " .macro iteet, cond\n"
  108. " .endm\n"
  109. " .macro iteee, cond\n"
  110. " .endm\n");
  111. #endif /* __ASSEMBLY__ */
  112. #endif /* CONFIG_ARM_ASM_UNIFIED */
  113. #endif /* !__ASM_UNIFIED_H */