entry-macros.S 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. ! SPDX-License-Identifier: GPL-2.0
  2. ! entry.S macro define
  3. .macro cli
  4. stc sr, r0
  5. or #0xf0, r0
  6. ldc r0, sr
  7. .endm
  8. .macro sti
  9. mov #0xfffffff0, r11
  10. extu.b r11, r11
  11. not r11, r11
  12. stc sr, r10
  13. and r11, r10
  14. #ifdef CONFIG_CPU_HAS_SR_RB
  15. stc k_g_imask, r11
  16. or r11, r10
  17. #endif
  18. ldc r10, sr
  19. .endm
  20. .macro get_current_thread_info, ti, tmp
  21. #ifdef CONFIG_CPU_HAS_SR_RB
  22. stc r7_bank, \ti
  23. #else
  24. mov #((THREAD_SIZE - 1) >> 10) ^ 0xff, \tmp
  25. shll8 \tmp
  26. shll2 \tmp
  27. mov r15, \ti
  28. and \tmp, \ti
  29. #endif
  30. .endm
  31. #ifdef CONFIG_TRACE_IRQFLAGS
  32. .macro TRACE_IRQS_ON
  33. mov.l r0, @-r15
  34. mov.l r1, @-r15
  35. mov.l r2, @-r15
  36. mov.l r3, @-r15
  37. mov.l r4, @-r15
  38. mov.l r5, @-r15
  39. mov.l r6, @-r15
  40. mov.l r7, @-r15
  41. mov.l 7834f, r0
  42. jsr @r0
  43. nop
  44. mov.l @r15+, r7
  45. mov.l @r15+, r6
  46. mov.l @r15+, r5
  47. mov.l @r15+, r4
  48. mov.l @r15+, r3
  49. mov.l @r15+, r2
  50. mov.l @r15+, r1
  51. mov.l @r15+, r0
  52. mov.l 7834f, r0
  53. bra 7835f
  54. nop
  55. .balign 4
  56. 7834: .long trace_hardirqs_on
  57. 7835:
  58. .endm
  59. .macro TRACE_IRQS_OFF
  60. mov.l r0, @-r15
  61. mov.l r1, @-r15
  62. mov.l r2, @-r15
  63. mov.l r3, @-r15
  64. mov.l r4, @-r15
  65. mov.l r5, @-r15
  66. mov.l r6, @-r15
  67. mov.l r7, @-r15
  68. mov.l 7834f, r0
  69. jsr @r0
  70. nop
  71. mov.l @r15+, r7
  72. mov.l @r15+, r6
  73. mov.l @r15+, r5
  74. mov.l @r15+, r4
  75. mov.l @r15+, r3
  76. mov.l @r15+, r2
  77. mov.l @r15+, r1
  78. mov.l @r15+, r0
  79. mov.l 7834f, r0
  80. bra 7835f
  81. nop
  82. .balign 4
  83. 7834: .long trace_hardirqs_off
  84. 7835:
  85. .endm
  86. #else
  87. .macro TRACE_IRQS_ON
  88. .endm
  89. .macro TRACE_IRQS_OFF
  90. .endm
  91. #endif
  92. #if defined(CONFIG_CPU_SH2A) || defined(CONFIG_CPU_SH4)
  93. # define PREF(x) pref @x
  94. #else
  95. # define PREF(x) nop
  96. #endif
  97. /*
  98. * Macro for use within assembly. Because the DWARF unwinder
  99. * needs to use the frame register to unwind the stack, we
  100. * need to setup r14 with the value of the stack pointer as
  101. * the return address is usually on the stack somewhere.
  102. */
  103. .macro setup_frame_reg
  104. #ifdef CONFIG_DWARF_UNWINDER
  105. mov r15, r14
  106. #endif
  107. .endm