unified.h 2.2 KB

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