entry.S 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * File: arch/blackfin/kernel/entry.S
  3. * Based on:
  4. * Author:
  5. *
  6. * Created:
  7. * Description:
  8. *
  9. * Modified:
  10. * Copyright 2004-2006 Analog Devices Inc.
  11. *
  12. * Bugs: Enter bugs at http://blackfin.uclinux.org/
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation; either version 2 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, see the file COPYING, or write
  26. * to the Free Software Foundation, Inc.,
  27. * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  28. */
  29. #include <linux/linkage.h>
  30. #include <asm/thread_info.h>
  31. #include <asm/errno.h>
  32. #include <asm/blackfin.h>
  33. #include <asm/asm-offsets.h>
  34. #include <asm/context.S>
  35. #ifdef CONFIG_EXCPT_IRQ_SYSC_L1
  36. .section .l1.text
  37. #else
  38. .text
  39. #endif
  40. ENTRY(_ret_from_fork)
  41. #ifdef CONFIG_IPIPE
  42. /*
  43. * Hw IRQs are off on entry, and we don't want the scheduling tail
  44. * code to starve high priority domains from interrupts while it
  45. * runs. Therefore we first stall the root stage to have the
  46. * virtual interrupt state reflect IMASK.
  47. */
  48. p0.l = ___ipipe_root_status;
  49. p0.h = ___ipipe_root_status;
  50. r4 = [p0];
  51. bitset(r4, 0);
  52. [p0] = r4;
  53. /*
  54. * Then we may enable hw IRQs, allowing preemption from high
  55. * priority domains. schedule_tail() will do local_irq_enable()
  56. * since Blackfin does not define __ARCH_WANT_UNLOCKED_CTXSW, so
  57. * there is no need to unstall the root domain by ourselves
  58. * afterwards.
  59. */
  60. p0.l = _bfin_irq_flags;
  61. p0.h = _bfin_irq_flags;
  62. r4 = [p0];
  63. sti r4;
  64. #endif /* CONFIG_IPIPE */
  65. SP += -12;
  66. call _schedule_tail;
  67. SP += 12;
  68. r0 = [sp + PT_IPEND];
  69. cc = bittst(r0,1);
  70. if cc jump .Lin_kernel;
  71. RESTORE_CONTEXT
  72. rti;
  73. .Lin_kernel:
  74. bitclr(r0,1);
  75. [sp + PT_IPEND] = r0;
  76. /* do a 'fake' RTI by jumping to [RETI]
  77. * to avoid clearing supervisor mode in child
  78. */
  79. r0 = [sp + PT_PC];
  80. [sp + PT_P0] = r0;
  81. RESTORE_ALL_SYS
  82. jump (p0);
  83. ENDPROC(_ret_from_fork)
  84. ENTRY(_sys_fork)
  85. r0 = -EINVAL;
  86. #if (ANOMALY_05000371)
  87. nop;
  88. nop;
  89. nop;
  90. #endif
  91. rts;
  92. ENDPROC(_sys_fork)
  93. ENTRY(_sys_vfork)
  94. r0 = sp;
  95. r0 += 24;
  96. [--sp] = rets;
  97. SP += -12;
  98. call _bfin_vfork;
  99. SP += 12;
  100. rets = [sp++];
  101. rts;
  102. ENDPROC(_sys_vfork)
  103. ENTRY(_sys_clone)
  104. r0 = sp;
  105. r0 += 24;
  106. [--sp] = rets;
  107. SP += -12;
  108. call _bfin_clone;
  109. SP += 12;
  110. rets = [sp++];
  111. rts;
  112. ENDPROC(_sys_clone)
  113. ENTRY(_sys_rt_sigreturn)
  114. r0 = sp;
  115. r0 += 24;
  116. [--sp] = rets;
  117. SP += -12;
  118. call _do_rt_sigreturn;
  119. SP += 12;
  120. rets = [sp++];
  121. rts;
  122. ENDPROC(_sys_rt_sigreturn)