1
0

context_gcc.S 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2010-04-09 fify the first version
  9. * 2010-04-19 fify rewrite rt_hw_interrupt_disable/enable fuction
  10. * 2010-04-20 fify move peripheral ISR to bsp/interrupts.s34
  11. */
  12. .section .text
  13. .globl _rt_interrupt_from_thread
  14. .globl _rt_interrupt_to_thread
  15. .global _os_context_switch
  16. .type _os_context_switch, @function
  17. _os_context_switch:
  18. PUSHM R0,R1,R2,R3,A0,A1,SB,FB
  19. MOV.W _rt_interrupt_from_thread, A0
  20. STC ISP, [A0]
  21. MOV.W _rt_interrupt_to_thread, A0
  22. LDC [A0], ISP
  23. POPM R0,R1,R2,R3,A0,A1,SB,FB ; Restore registers from the new task's stack
  24. REIT ; Return from interrup
  25. /*
  26. * void rt_hw_context_switch_to(rt_uint32 to);
  27. * this fucntion is used to perform the first thread switch
  28. */
  29. .global _rt_hw_context_switch_to
  30. .type _rt_hw_context_switch_to, @function
  31. _rt_hw_context_switch_to:
  32. ENTER #0x0
  33. MOV.W 0x5[FB], A0
  34. LDC [A0], ISP
  35. POPM R0,R1,R2,R3,A0,A1,SB,FB
  36. REIT
  37. .end