Subversion Repositories HelenOS

Rev

Rev 1946 | Rev 2462 | Go to most recent revision | 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 <typedefs.h>
  44. #include <symtab.h>
  45. #include <print.h>
  46.  
  47. void dump_istate(istate_t *istate)
  48. {
  49.     printf("TSTATE=%#llx\n", istate->tstate);
  50.     printf("TPC=%#llx (%s)\n", istate->tpc, get_symtab_entry(istate->tpc));
  51.     printf("TNPC=%#llx (%s)\n", istate->tnpc, get_symtab_entry(istate->tnpc));
  52. }
  53.  
  54. /** Handle instruction_access_exception. (0x8) */
  55. void instruction_access_exception(int n, istate_t *istate)
  56. {
  57.     fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
  58.     dump_istate(istate);
  59.     panic("%s\n", __FUNCTION__);
  60. }
  61.  
  62. /** Handle instruction_access_error. (0xa) */
  63. void instruction_access_error(int n, istate_t *istate)
  64. {
  65.     fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
  66.     dump_istate(istate);
  67.     panic("%s\n", __FUNCTION__);
  68. }
  69.  
  70. /** Handle illegal_instruction. (0x10) */
  71. void illegal_instruction(int n, istate_t *istate)
  72. {
  73.     fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
  74.     dump_istate(istate);
  75.     panic("%s\n", __FUNCTION__);
  76. }
  77.  
  78. /** Handle privileged_opcode. (0x11) */
  79. void privileged_opcode(int n, istate_t *istate)
  80. {
  81.     fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
  82.     dump_istate(istate);
  83.     panic("%s\n", __FUNCTION__);
  84. }
  85.  
  86. /** Handle unimplemented_LDD. (0x12) */
  87. void unimplemented_LDD(int n, istate_t *istate)
  88. {
  89.     fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
  90.     dump_istate(istate);
  91.     panic("%s\n", __FUNCTION__);
  92. }
  93.  
  94. /** Handle unimplemented_STD. (0x13) */
  95. void unimplemented_STD(int n, istate_t *istate)
  96. {
  97.     fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
  98.     dump_istate(istate);
  99.     panic("%s\n", __FUNCTION__);
  100. }
  101.  
  102. /** Handle fp_disabled. (0x20) */
  103. void fp_disabled(int n, istate_t *istate)
  104. {
  105.     fprs_reg_t fprs;
  106.    
  107.     fprs.value = fprs_read();
  108.     if (!fprs.fef) {
  109.         fprs.fef = true;
  110.         fprs_write(fprs.value);
  111.         return;
  112.     }
  113.  
  114. #ifdef CONFIG_FPU_LAZY
  115.     scheduler_fpu_lazy_request();
  116. #else
  117.     fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
  118.     dump_istate(istate);
  119.     panic("%s\n", __FUNCTION__);
  120. #endif
  121. }
  122.  
  123. /** Handle fp_exception_ieee_754. (0x21) */
  124. void fp_exception_ieee_754(int n, istate_t *istate)
  125. {
  126.     fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
  127.     dump_istate(istate);
  128.     panic("%s\n", __FUNCTION__);
  129. }
  130.  
  131. /** Handle fp_exception_other. (0x22) */
  132. void fp_exception_other(int n, istate_t *istate)
  133. {
  134.     fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
  135.     dump_istate(istate);
  136.     panic("%s\n", __FUNCTION__);
  137. }
  138.  
  139. /** Handle tag_overflow. (0x23) */
  140. void tag_overflow(int n, istate_t *istate)
  141. {
  142.     fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
  143.     dump_istate(istate);
  144.     panic("%s\n", __FUNCTION__);
  145. }
  146.  
  147. /** Handle division_by_zero. (0x28) */
  148. void division_by_zero(int n, istate_t *istate)
  149. {
  150.     fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
  151.     dump_istate(istate);
  152.     panic("%s\n", __FUNCTION__);
  153. }
  154.  
  155. /** Handle data_access_exception. (0x30) */
  156. void data_access_exception(int n, istate_t *istate)
  157. {
  158.     fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
  159.     dump_istate(istate);
  160.     dump_sfsr_and_sfar();
  161.     panic("%s\n", __FUNCTION__);
  162. }
  163.  
  164. /** Handle data_access_error. (0x32) */
  165. void data_access_error(int n, istate_t *istate)
  166. {
  167.     fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
  168.     dump_istate(istate);
  169.     panic("%s\n", __FUNCTION__);
  170. }
  171.  
  172. /** Handle mem_address_not_aligned. (0x34) */
  173. void mem_address_not_aligned(int n, istate_t *istate)
  174. {
  175.     fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
  176.     dump_istate(istate);
  177.     panic("%s\n", __FUNCTION__);
  178. }
  179.  
  180. /** Handle LDDF_mem_address_not_aligned. (0x35) */
  181. void LDDF_mem_address_not_aligned(int n, istate_t *istate)
  182. {
  183.     fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
  184.     dump_istate(istate);
  185.     panic("%s\n", __FUNCTION__);
  186. }
  187.  
  188. /** Handle STDF_mem_address_not_aligned. (0x36) */
  189. void STDF_mem_address_not_aligned(int n, istate_t *istate)
  190. {
  191.     fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
  192.     dump_istate(istate);
  193.     panic("%s\n", __FUNCTION__);
  194. }
  195.  
  196. /** Handle privileged_action. (0x37) */
  197. void privileged_action(int n, istate_t *istate)
  198. {
  199.     fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
  200.     dump_istate(istate);
  201.     panic("%s\n", __FUNCTION__);
  202. }
  203.  
  204. /** Handle LDQF_mem_address_not_aligned. (0x38) */
  205. void LDQF_mem_address_not_aligned(int n, istate_t *istate)
  206. {
  207.     fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
  208.     dump_istate(istate);
  209.     panic("%s\n", __FUNCTION__);
  210. }
  211.  
  212. /** Handle STQF_mem_address_not_aligned. (0x39) */
  213. void STQF_mem_address_not_aligned(int n, istate_t *istate)
  214. {
  215.     fault_if_from_uspace(istate, "%s\n", __FUNCTION__);
  216.     dump_istate(istate);
  217.     panic("%s\n", __FUNCTION__);
  218. }
  219.  
  220. /** @}
  221.  */
  222.