entry.S
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:2k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /*
  2.  * This file is subject to the terms and conditions of the GNU General Public
  3.  * License.  See the file "COPYING" in the main directory of this archive
  4.  * for more details.
  5.  *
  6.  * Low level exception handling
  7.  *
  8.  * Copyright (C) 1994 - 2000, 2001 Ralf Baechle
  9.  * Copyright (C) 1999, 2000 Silicon Graphics
  10.  * Copyright (C) 2001 MIPS Technologies, Inc.
  11.  */
  12. #include <linux/config.h>
  13. #include <asm/asm.h>
  14. #include <asm/regdef.h>
  15. #include <asm/mipsregs.h>
  16. #include <asm/stackframe.h>
  17. /* This duplicates the definition from <linux/sched.h> */
  18. #define PT_TRACESYS 0x00000002 /* tracing system calls */
  19. #define KU_USER 0x10
  20. .text
  21. .align 4
  22. FEXPORT(ret_from_fork)
  23. move a0, v0 # prev
  24. jal schedule_tail
  25. lw t0, TASK_PTRACE($28) # syscall tracing enabled?
  26. andi t0, PT_TRACESYS
  27. bnez t0, tracesys_exit
  28. j ret_from_sys_call
  29. tracesys_exit:
  30. jal syscall_trace
  31. b ret_from_sys_call
  32. EXPORT(ret_from_irq)
  33. EXPORT(ret_from_exception)
  34. lw t0, PT_STATUS(sp) # returning to kernel mode?
  35. andi t0, t0, KU_USER
  36. bnez t0, ret_from_sys_call
  37. j restore_all
  38. reschedule: jal schedule 
  39. FEXPORT(ret_from_sys_call)
  40. mfc0 t0, CP0_STATUS # need_resched and signals atomic test
  41. ori t0, t0, 1
  42. xori t0, t0, 1
  43. mtc0 t0, CP0_STATUS
  44. ld v0, TASK_NEED_RESCHED($28)
  45. lw v1, TASK_SIGPENDING($28)
  46. bnez v0, reschedule
  47. bnez v1, signal_return
  48. restore_all: .set noat
  49. RESTORE_ALL
  50. eret
  51. .set at
  52. signal_return: .type signal_return, @function
  53. mfc0 t0, CP0_STATUS
  54. ori t0, t0, 1
  55. mtc0 t0, CP0_STATUS
  56. move a0, zero
  57. move a1, sp
  58. jal do_signal
  59. b restore_all
  60. /*
  61.  * Common spurious interrupt handler.
  62.  */
  63. .text
  64. .align  5
  65. LEAF(spurious_interrupt)
  66. /*
  67.  * Someone tried to fool us by sending an interrupt but we
  68.  * couldn't find a cause for it.
  69.  */
  70. lui     t1,%hi(spurious_count)
  71. lw      t0,%lo(spurious_count)(t1)
  72. addiu   t0,1
  73. sw      t0,%lo(spurious_count)(t1)
  74. j ret_from_irq
  75. END(spurious_interrupt)