r4k_genex.S
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:3k
源码类别:

Linux/Unix编程

开发平台:

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.  * Copyright (C) 1994 - 1999 by Ralf Baechle
  7.  * Copyright (C) 1999 Silicon Graphics
  8.  *
  9.  * Low level exception handling
  10.  */
  11. #include <linux/init.h>
  12. #include <asm/asm.h>
  13. #include <asm/regdef.h>
  14. #include <asm/fpregdef.h>
  15. #include <asm/mipsregs.h>
  16. #include <asm/stackframe.h>
  17. #include <asm/exception.h>
  18. #include <asm/r4kcacheops.h>
  19. BUILD_HANDLER adel ade ade silent /* #4  */
  20. BUILD_HANDLER ades ade ade silent /* #5  */
  21. BUILD_HANDLER ibe be cli silent /* #6  */
  22. BUILD_HANDLER dbe be cli silent /* #7  */
  23. BUILD_HANDLER bp bp sti silent /* #9  */
  24. BUILD_HANDLER ri ri sti silent /* #10 */
  25. BUILD_HANDLER cpu cpu sti silent /* #11 */
  26. BUILD_HANDLER ov ov sti silent /* #12 */
  27. BUILD_HANDLER tr tr sti silent /* #13 */
  28. BUILD_HANDLER fpe fpe fpe silent /* #15 */
  29. BUILD_HANDLER watch watch sti verbose /* #23 */
  30. BUILD_HANDLER mcheck mcheck cli verbose /* #24 */
  31. BUILD_HANDLER reserved reserved sti verbose /* others */
  32. __INIT
  33. /* General exception handler for CPUs with virtual coherency exception.
  34.  *
  35.  * Be careful when changing this, it has to be at most 128 bytes to fit
  36.  * into space reserved for the exception handler.
  37.  */
  38. NESTED(except_vec3_r4000, 0, sp)
  39. .set noat
  40. #if defined(R5432_CP0_INTERRUPT_WAR)
  41. mfc0    k0, CP0_INDEX
  42. #endif
  43. mfc0 k1, CP0_CAUSE
  44. andi k1, k1, 0x7c
  45. li k0, 31<<2
  46. beq k1, k0, handle_vced
  47.  li k0, 14<<2
  48. beq k1, k0, handle_vcei
  49.  dsll k1, k1, 1
  50. ld k0, exception_handlers(k1)
  51. jr k0
  52. /*
  53.  * Big shit, we now may have two dirty primary cache lines for the same
  54.  * physical address.  We can savely invalidate the line pointed to by
  55.  * c0_badvaddr because after return from this exception handler the load /
  56.  * store will be re-executed.
  57.  */
  58. handle_vced:
  59. mfc0 k0, CP0_BADVADDR
  60. li k1, -4 # Is this ...
  61. and k0, k1 # ... really needed?
  62. mtc0 zero, CP0_TAGLO
  63. cache Index_Store_Tag_D,(k0)
  64. cache Hit_Writeback_Inv_SD,(k0)
  65. lui k0, %hi(vced_count)
  66. lw k1, %lo(vced_count)(k0)
  67. addiu k1, 1
  68. sw k1, %lo(vced_count)(k0)
  69. eret
  70. handle_vcei:
  71. mfc0 k0, CP0_BADVADDR
  72. cache Hit_Writeback_Inv_SD,(k0) # also cleans pi
  73. lui k0, %hi(vcei_count)
  74. lw k1, %lo(vcei_count)(k0)
  75. addiu k1, 1
  76. sw k1, %lo(vcei_count)(k0)
  77. eret
  78. END(except_vec3_r4000)
  79. .set at
  80. /* General exception vector for all other CPUs. */
  81. NESTED(except_vec3_generic, 0, sp)
  82. .set noat
  83. mfc0 k1, CP0_CAUSE
  84. andi k1, k1, 0x7c
  85. dsll k1, k1, 1
  86. ld k0, exception_handlers(k1)
  87. jr k0
  88.  nop
  89. END(except_vec3_generic)
  90. .set at
  91. /*
  92.  * Special interrupt vector for embedded MIPS.  This is a dedicated interrupt
  93.  * vector which reduces interrupt processing overhead.  The jump instruction
  94.  * will be inserted here at initialization time.  This handler may only be 8
  95.  * bytes in size!
  96.  */
  97. NESTED(except_vec4, 0, sp)
  98. 1: j 1b /* Dummy, will be replaced */
  99.  nop
  100. END(except_vec4)
  101. __FINIT