Subversion Repositories HelenOS

Rev

Rev 4055 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Copyright (c) 2005 Jakub Jermar
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  *
  9.  * - Redistributions of source code must retain the above copyright
  10.  *   notice, this list of conditions and the following disclaimer.
  11.  * - Redistributions in binary form must reproduce the above copyright
  12.  *   notice, this list of conditions and the following disclaimer in the
  13.  *   documentation and/or other materials provided with the distribution.
  14.  * - The name of the author may not be used to endorse or promote products
  15.  *   derived from this software without specific prior written permission.
  16.  *
  17.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  18.  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  19.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  20.  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  21.  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  22.  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  23.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  24.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  26.  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27.  */
  28.  
  29. /** @addtogroup sparc64interrupt
  30.  * @{
  31.  */
  32. /** @file
  33.  *
  34.  */
  35.  
  36. #include <arch/trap/exception.h>
  37. #include <arch/mm/tlb.h>
  38. #include <arch/interrupt.h>
  39. #include <interrupt.h>
  40. #include <arch/asm.h>
  41. #include <arch/register.h>
  42. #include <debug.h>
  43. #include <print.h>
  44. #include <symtab.h>
  45.  
  46. void dump_istate(istate_t *istate)
  47. {
  48.     char *tpcs, *tnpcs;
  49.  
  50.     tpcs = symtab_fmt_name_lookup(istate->tpc);
  51.     tnpcs = symtab_fmt_name_lookup(istate->tnpc);
  52.  
  53.     printf("TSTATE=%#" PRIx64 "\n", istate->tstate);
  54.     printf("TPC=%#" PRIx64 " (%s)\n", istate->tpc, tpcs);
  55.     printf("TNPC=%#" PRIx64 " (%s)\n", istate->tnpc, tnpcs);
  56. }
  57.  
  58. /** Handle instruction_access_exception. (0x8) */
  59. void instruction_access_exception(int n, istate_t *istate)
  60. {
  61.     fault_if_from_uspace(istate, "%s.", __func__);
  62.     dump_istate(istate);
  63.     panic("%s.", __func__);
  64. }
  65.  
  66. /** Handle instruction_access_error. (0xa) */
  67. void instruction_access_error(int n, istate_t *istate)
  68. {
  69.     fault_if_from_uspace(istate, "%s.", __func__);
  70.     dump_istate(istate);
  71.     panic("%s.", __func__);
  72. }
  73.  
  74. /** Handle illegal_instruction. (0x10) */
  75. void illegal_instruction(int n, istate_t *istate)
  76. {
  77.     fault_if_from_uspace(istate, "%s.", __func__);
  78.     dump_istate(istate);
  79.     panic("%s.", __func__);
  80. }
  81.  
  82. /** Handle privileged_opcode. (0x11) */
  83. void privileged_opcode(int n, istate_t *istate)
  84. {
  85.     fault_if_from_uspace(istate, "%s.", __func__);
  86.     dump_istate(istate);
  87.     panic("%s.", __func__);
  88. }
  89.  
  90. /** Handle unimplemented_LDD. (0x12) */
  91. void unimplemented_LDD(int n, istate_t *istate)
  92. {
  93.     fault_if_from_uspace(istate, "%s.", __func__);
  94.     dump_istate(istate);
  95.     panic("%s.", __func__);
  96. }
  97.  
  98. /** Handle unimplemented_STD. (0x13) */
  99. void unimplemented_STD(int n, istate_t *istate)
  100. {
  101.     fault_if_from_uspace(istate, "%s.", __func__);
  102.     dump_istate(istate);
  103.     panic("%s.", __func__);
  104. }
  105.  
  106. /** Handle fp_disabled. (0x20) */
  107. void fp_disabled(int n, istate_t *istate)
  108. {
  109.     fprs_reg_t fprs;
  110.    
  111.     fprs.value = fprs_read();
  112.     if (!fprs.fef) {
  113.         fprs.fef = true;
  114.         fprs_write(fprs.value);
  115.         return;
  116.     }
  117.  
  118. #ifdef CONFIG_FPU_LAZY
  119.     scheduler_fpu_lazy_request();
  120. #else
  121.     fault_if_from_uspace(istate, "%s.", __func__);
  122.     dump_istate(istate);
  123.     panic("%s.", __func__);
  124. #endif
  125. }
  126.  
  127. /** Handle fp_exception_ieee_754. (0x21) */
  128. void fp_exception_ieee_754(int n, istate_t *istate)
  129. {
  130.     fault_if_from_uspace(istate, "%s.", __func__);
  131.     dump_istate(istate);
  132.     panic("%s.", __func__);
  133. }
  134.  
  135. /** Handle fp_exception_other. (0x22) */
  136. void fp_exception_other(int n, istate_t *istate)
  137. {
  138.     fault_if_from_uspace(istate, "%s.", __func__);
  139.     dump_istate(istate);
  140.     panic("%s.", __func__);
  141. }
  142.  
  143. /** Handle tag_overflow. (0x23) */
  144. void tag_overflow(int n, istate_t *istate)
  145. {
  146.     fault_if_from_uspace(istate, "%s.", __func__);
  147.     dump_istate(istate);
  148.     panic("%s.", __func__);
  149. }
  150.  
  151. /** Handle division_by_zero. (0x28) */
  152. void division_by_zero(int n, istate_t *istate)
  153. {
  154.     fault_if_from_uspace(istate, "%s.", __func__);
  155.     dump_istate(istate);
  156.     panic("%s.", __func__);
  157. }
  158.  
  159. /** Handle data_access_exception. (0x30) */
  160. void data_access_exception(int n, istate_t *istate)
  161. {
  162.     fault_if_from_uspace(istate, "%s.", __func__);
  163.     dump_istate(istate);
  164.     dump_sfsr_and_sfar();
  165.     panic("%s.", __func__);
  166. }
  167.  
  168. /** Handle data_access_error. (0x32) */
  169. void data_access_error(int n, istate_t *istate)
  170. {
  171.     fault_if_from_uspace(istate, "%s.", __func__);
  172.     dump_istate(istate);
  173.     panic("%s.", __func__);
  174. }
  175.  
  176. /** Handle mem_address_not_aligned. (0x34) */
  177. void mem_address_not_aligned(int n, istate_t *istate)
  178. {
  179.     fault_if_from_uspace(istate, "%s.", __func__);
  180.     dump_istate(istate);
  181.     panic("%s.", __func__);
  182. }
  183.  
  184. /** Handle LDDF_mem_address_not_aligned. (0x35) */
  185. void LDDF_mem_address_not_aligned(int n, istate_t *istate)
  186. {
  187.     fault_if_from_uspace(istate, "%s.", __func__);
  188.     dump_istate(istate);
  189.     panic("%s.", __func__);
  190. }
  191.  
  192. /** Handle STDF_mem_address_not_aligned. (0x36) */
  193. void STDF_mem_address_not_aligned(int n, istate_t *istate)
  194. {
  195.     fault_if_from_uspace(istate, "%s.", __func__);
  196.     dump_istate(istate);
  197.     panic("%s.", __func__);
  198. }
  199.  
  200. /** Handle privileged_action. (0x37) */
  201. void privileged_action(int n, istate_t *istate)
  202. {
  203.     fault_if_from_uspace(istate, "%s.", __func__);
  204.     dump_istate(istate);
  205.     panic("%s.", __func__);
  206. }
  207.  
  208. /** Handle LDQF_mem_address_not_aligned. (0x38) */
  209. void LDQF_mem_address_not_aligned(int n, istate_t *istate)
  210. {
  211.     fault_if_from_uspace(istate, "%s.", __func__);
  212.     dump_istate(istate);
  213.     panic("%s.", __func__);
  214. }
  215.  
  216. /** Handle STQF_mem_address_not_aligned. (0x39) */
  217. void STQF_mem_address_not_aligned(int n, istate_t *istate)
  218. {
  219.     fault_if_from_uspace(istate, "%s.", __func__);
  220.     dump_istate(istate);
  221.     panic("%s.", __func__);
  222. }
  223.  
  224. /** @}
  225.  */
  226.