xtensa_vector_defaults.S 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. // Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #include "xtensa_rtos.h"
  14. #include "esp_private/panic_reason.h"
  15. #include "sdkconfig.h"
  16. #include "soc/soc.h"
  17. /*
  18. This file contains the default handlers for the high interrupt levels as well as some specialized exceptions.
  19. The default behaviour is to just exit the interrupt or call the panic handler on the exceptions
  20. */
  21. #if XCHAL_HAVE_DEBUG
  22. .global xt_debugexception
  23. .weak xt_debugexception
  24. .set xt_debugexception, _xt_debugexception
  25. .section .iram1,"ax"
  26. .type _xt_debugexception,@function
  27. .align 4
  28. _xt_debugexception:
  29. movi a0,PANIC_RSN_DEBUGEXCEPTION
  30. wsr a0,EXCCAUSE
  31. /* _xt_panic assumes a level 1 exception. As we're
  32. crashing anyhow, copy EPC & EXCSAVE from DEBUGLEVEL
  33. to level 1. */
  34. rsr a0,(EPC + XCHAL_DEBUGLEVEL)
  35. wsr a0,EPC_1
  36. rsr a0,(EXCSAVE + XCHAL_DEBUGLEVEL)
  37. wsr a0,EXCSAVE_1
  38. call0 _xt_panic /* does not return */
  39. rfi XCHAL_DEBUGLEVEL
  40. #endif /* Debug exception */
  41. #if XCHAL_NUM_INTLEVELS >=2 && XCHAL_EXCM_LEVEL <2 && XCHAL_DEBUGLEVEL !=2
  42. .global xt_highint2
  43. .weak xt_highint2
  44. .set xt_highint2, _xt_highint2
  45. .section .iram1,"ax"
  46. .type _xt_highint2,@function
  47. .align 4
  48. _xt_highint2:
  49. /* Default handler does nothing; just returns */
  50. .align 4
  51. .L_xt_highint2_exit:
  52. rsr a0, EXCSAVE_2 /* restore a0 */
  53. rfi 2
  54. #endif /* Level 2 */
  55. #if XCHAL_NUM_INTLEVELS >=3 && XCHAL_EXCM_LEVEL <3 && XCHAL_DEBUGLEVEL !=3
  56. .global xt_highint3
  57. .weak xt_highint3
  58. .set xt_highint3, _xt_highint3
  59. .section .iram1,"ax"
  60. .type _xt_highint3,@function
  61. .align 4
  62. _xt_highint3:
  63. /* Default handler does nothing; just returns */
  64. .align 4
  65. .L_xt_highint3_exit:
  66. rsr a0, EXCSAVE_3 /* restore a0 */
  67. rfi 3
  68. #endif /* Level 3 */
  69. #if XCHAL_NUM_INTLEVELS >=4 && XCHAL_EXCM_LEVEL <4 && XCHAL_DEBUGLEVEL !=4
  70. .global xt_highint4
  71. .weak xt_highint4
  72. .set xt_highint4, _xt_highint4
  73. .section .iram1,"ax"
  74. .type _xt_highint4,@function
  75. .align 4
  76. _xt_highint4:
  77. /* Default handler does nothing; just returns */
  78. .align 4
  79. .L_xt_highint4_exit:
  80. rsr a0, EXCSAVE_4 /* restore a0 */
  81. rfi 4
  82. #endif /* Level 4 */
  83. #if XCHAL_NUM_INTLEVELS >=5 && XCHAL_EXCM_LEVEL <5 && XCHAL_DEBUGLEVEL !=5
  84. .global xt_highint5
  85. .weak xt_highint5
  86. .set xt_highint5, _xt_highint5
  87. .section .iram1,"ax"
  88. .type _xt_highint5,@function
  89. .align 4
  90. _xt_highint5:
  91. /* Default handler does nothing; just returns */
  92. .align 4
  93. .L_xt_highint5_exit:
  94. rsr a0, EXCSAVE_5 /* restore a0 */
  95. rfi 5
  96. #endif /* Level 5 */
  97. #if XCHAL_NUM_INTLEVELS >=6 && XCHAL_EXCM_LEVEL <6 && XCHAL_DEBUGLEVEL !=6
  98. .global _xt_highint6
  99. .global xt_highint6
  100. .weak xt_highint6
  101. .set xt_highint6, _xt_highint6
  102. .section .iram1,"ax"
  103. .type _xt_highint6,@function
  104. .align 4
  105. _xt_highint6:
  106. /* Default handler does nothing; just returns */
  107. .align 4
  108. .L_xt_highint6_exit:
  109. rsr a0, EXCSAVE_6 /* restore a0 */
  110. rfi 6
  111. #endif /* Level 6 */
  112. #if XCHAL_HAVE_NMI
  113. .global _xt_nmi
  114. .global xt_nmi
  115. .weak xt_nmi
  116. .set xt_nmi, _xt_nmi
  117. .section .iram1,"ax"
  118. .type _xt_nmi,@function
  119. .align 4
  120. _xt_nmi:
  121. /* Default handler does nothing; just returns */
  122. .align 4
  123. .L_xt_nmi_exit:
  124. rsr a0, EXCSAVE + XCHAL_NMILEVEL /* restore a0 */
  125. rfi XCHAL_NMILEVEL
  126. #endif /* NMI */