context_gcc.S 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. ;/*
  2. ; * File : context_iar.S
  3. ; * This file is part of RT-Thread RTOS
  4. ; * COPYRIGHT (C) 2006, RT-Thread Development Team
  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 as published by
  8. ; * the Free Software Foundation; either version 2 of the License, or
  9. ; * (at your option) any later version.
  10. ; *
  11. ; * This program is distributed in the hope that it will be useful,
  12. ; * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ; * GNU General Public License for more details.
  15. ; *
  16. ; * You should have received a copy of the GNU General Public License along
  17. ; * with this program; if not, write to the Free Software Foundation, Inc.,
  18. ; * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. ; *
  20. ; * Change Logs:
  21. ; * Date Author Notes
  22. ; * 2017-07-16 zhangjun for hifive1
  23. ; */
  24. /*
  25. * rt_base_t rt_hw_interrupt_disable();
  26. */
  27. .globl rt_hw_interrupt_disable
  28. rt_hw_interrupt_disable:
  29. ret
  30. /*
  31. * void rt_hw_interrupt_enable(rt_base_t level);
  32. */
  33. .globl rt_hw_interrupt_enable
  34. rt_hw_interrupt_enable:
  35. ret
  36. /*
  37. * void rt_hw_context_switch(rt_uint32 from, rt_uint32 to);
  38. * a0 --> from
  39. * a1 --> to
  40. */
  41. .globl rt_hw_context_switch
  42. rt_hw_context_switch:
  43. addi sp, sp, -120
  44. sw sp, (a0)
  45. sw gp, (sp)
  46. sw tp, 4(sp)
  47. sw t6, 8(sp)
  48. sw t5, 12(sp)
  49. sw t4, 16(sp)
  50. sw t3, 20(sp)
  51. sw t2, 24(sp)
  52. sw t1, 28(sp)
  53. sw t0, 32(sp)
  54. sw s11,36(sp)
  55. sw s10,40(sp)
  56. sw s9, 44(sp)
  57. sw s8, 48(sp)
  58. sw s7, 52(sp)
  59. sw s6, 56(sp)
  60. sw s5, 60(sp)
  61. sw s4, 64(sp)
  62. sw s3, 68(sp)
  63. sw s2, 72(sp)
  64. sw s1, 76(sp)
  65. sw s0, 80(sp)
  66. sw a7, 84(sp)
  67. sw a6, 88(sp)
  68. sw a5, 92(sp)
  69. sw a4, 96(sp)
  70. sw a3, 100(sp)
  71. sw a2, 104(sp)
  72. sw a1, 108(sp)
  73. sw ra, 120(sp)
  74. sw a0, 112(sp)
  75. lw sp, (a1)
  76. lw gp, (sp)
  77. lw tp, 4(sp)
  78. lw t6, 8(sp)
  79. lw t5, 12(sp)
  80. lw t4, 16(sp)
  81. lw t3, 20(sp)
  82. lw t2, 24(sp)
  83. lw t1, 28(sp)
  84. lw t0, 32(sp)
  85. lw s11,36(sp)
  86. lw s10,40(sp)
  87. lw s9, 44(sp)
  88. lw s8, 48(sp)
  89. lw s7, 52(sp)
  90. lw s6, 56(sp)
  91. lw s5, 60(sp)
  92. lw s4, 64(sp)
  93. lw s3, 68(sp)
  94. lw s2, 72(sp)
  95. lw s1, 76(sp)
  96. lw s0, 80(sp)
  97. lw a7, 84(sp)
  98. lw a6, 88(sp)
  99. lw a5, 92(sp)
  100. lw a4, 96(sp)
  101. lw a3, 100(sp)
  102. lw a2, 104(sp)
  103. lw a1, 108(sp)
  104. lw a0, 112(sp)
  105. lw ra, 120(sp)
  106. addi sp, sp, 120
  107. ret
  108. /*
  109. * void rt_hw_context_switch_to(rt_uint32 to);
  110. * a0 --> to
  111. */
  112. .globl rt_hw_context_switch_to
  113. rt_hw_context_switch_to:
  114. lw sp, (a0)
  115. lw gp, (sp)
  116. lw tp, 4(sp)
  117. lw t6, 8(sp)
  118. lw t5, 12(sp)
  119. lw t4, 16(sp)
  120. lw t3, 20(sp)
  121. lw t2, 24(sp)
  122. lw t1, 28(sp)
  123. lw t0, 32(sp)
  124. lw s11,36(sp)
  125. lw s10,40(sp)
  126. lw s9, 44(sp)
  127. lw s8, 48(sp)
  128. lw s7, 52(sp)
  129. lw s6, 56(sp)
  130. lw s5, 60(sp)
  131. lw s4, 64(sp)
  132. lw s3, 68(sp)
  133. lw s2, 72(sp)
  134. lw s1, 76(sp)
  135. lw s0, 80(sp)
  136. lw a7, 84(sp)
  137. lw a6, 88(sp)
  138. lw a5, 92(sp)
  139. lw a4, 96(sp)
  140. lw a3, 100(sp)
  141. lw a2, 104(sp)
  142. lw a1, 108(sp)
  143. lw a0, 112(sp)
  144. lw ra, 120(sp)
  145. addi sp, sp, 120
  146. ret
  147. /*
  148. * void rt_hw_context_switch_interrupt(rt_uint32 from, rt_uint32 to);
  149. */
  150. .globl rt_thread_switch_interrupt_flag
  151. .globl rt_interrupt_from_thread
  152. .globl rt_interrupt_to_thread
  153. .globl rt_hw_context_switch_interrupt
  154. rt_hw_context_switch_interrupt:
  155. _reswitch:
  156. ret