context_gcc.S 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * File : context.asm
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2009, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2010-04-09 fify the first version
  13. * 2010-04-19 fify rewrite rt_hw_interrupt_disable/enable fuction
  14. * 2010-04-20 fify move peripheral ISR to bsp/interrupts.s34
  15. */
  16. .section .text
  17. .globl _rt_interrupt_from_thread
  18. .globl _rt_interrupt_to_thread
  19. .global _os_context_switch
  20. .type _os_context_switch, @function
  21. _os_context_switch:
  22. PUSHM R0,R1,R2,R3,A0,A1,SB,FB
  23. MOV.W _rt_interrupt_from_thread, A0
  24. STC ISP, [A0]
  25. MOV.W _rt_interrupt_to_thread, A0
  26. LDC [A0], ISP
  27. POPM R0,R1,R2,R3,A0,A1,SB,FB ; Restore registers from the new task's stack
  28. REIT ; Return from interrup
  29. /*
  30. * void rt_hw_context_switch_to(rt_uint32 to);
  31. * this fucntion is used to perform the first thread switch
  32. */
  33. .global _rt_hw_context_switch_to
  34. .type _rt_hw_context_switch_to, @function
  35. _rt_hw_context_switch_to:
  36. ENTER #0x0
  37. MOV.W 0x5[FB], A0
  38. LDC [A0], ISP
  39. POPM R0,R1,R2,R3,A0,A1,SB,FB
  40. REIT
  41. .end