| 1 | /*
|
|---|
| 2 | * Copyright (c) 2005 Jakub Jermar
|
|---|
| 3 | * Copyright (c) 2009 Pavel Rimsky
|
|---|
| 4 | * All rights reserved.
|
|---|
| 5 | *
|
|---|
| 6 | * Redistribution and use in source and binary forms, with or without
|
|---|
| 7 | * modification, are permitted provided that the following conditions
|
|---|
| 8 | * are met:
|
|---|
| 9 | *
|
|---|
| 10 | * - Redistributions of source code must retain the above copyright
|
|---|
| 11 | * notice, this list of conditions and the following disclaimer.
|
|---|
| 12 | * - Redistributions in binary form must reproduce the above copyright
|
|---|
| 13 | * notice, this list of conditions and the following disclaimer in the
|
|---|
| 14 | * documentation and/or other materials provided with the distribution.
|
|---|
| 15 | * - The name of the author may not be used to endorse or promote products
|
|---|
| 16 | * derived from this software without specific prior written permission.
|
|---|
| 17 | *
|
|---|
| 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|---|
| 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|---|
| 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|---|
| 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|---|
| 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|---|
| 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|---|
| 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|---|
| 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|---|
| 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|---|
| 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|---|
| 28 | */
|
|---|
| 29 |
|
|---|
| 30 | /** @addtogroup kernel_sparc64_interrupt
|
|---|
| 31 | * @{
|
|---|
| 32 | */
|
|---|
| 33 | /** @file
|
|---|
| 34 | */
|
|---|
| 35 |
|
|---|
| 36 | #include <arch/interrupt.h>
|
|---|
| 37 | #include <arch/trap/interrupt.h>
|
|---|
| 38 | #include <arch/trap/exception.h>
|
|---|
| 39 | #include <arch/trap/mmu.h>
|
|---|
| 40 | #include <arch/sparc64.h>
|
|---|
| 41 | #include <interrupt.h>
|
|---|
| 42 | #include <ddi/irq.h>
|
|---|
| 43 | #include <stdbool.h>
|
|---|
| 44 | #include <debug.h>
|
|---|
| 45 | #include <arch/asm.h>
|
|---|
| 46 | #include <barrier.h>
|
|---|
| 47 | #include <arch/drivers/tick.h>
|
|---|
| 48 | #include <arch.h>
|
|---|
| 49 | #include <mm/tlb.h>
|
|---|
| 50 | #include <config.h>
|
|---|
| 51 | #include <synch/spinlock.h>
|
|---|
| 52 |
|
|---|
| 53 | void exc_arch_init(void)
|
|---|
| 54 | {
|
|---|
| 55 | exc_register(TT_INSTRUCTION_ACCESS_EXCEPTION,
|
|---|
| 56 | "instruction_access_exception", false,
|
|---|
| 57 | instruction_access_exception);
|
|---|
| 58 | exc_register(TT_INSTRUCTION_ACCESS_ERROR,
|
|---|
| 59 | "instruction_access_error", false,
|
|---|
| 60 | instruction_access_error);
|
|---|
| 61 |
|
|---|
| 62 | #ifdef SUN4V
|
|---|
| 63 | exc_register(TT_IAE_UNAUTH_ACCESS,
|
|---|
| 64 | "iae_unauth_access", false,
|
|---|
| 65 | instruction_access_exception);
|
|---|
| 66 | exc_register(TT_IAE_NFO_PAGE,
|
|---|
| 67 | "iae_nfo_page", false,
|
|---|
| 68 | instruction_access_exception);
|
|---|
| 69 | #endif
|
|---|
| 70 |
|
|---|
| 71 | exc_register(TT_ILLEGAL_INSTRUCTION,
|
|---|
| 72 | "illegal_instruction", false,
|
|---|
| 73 | illegal_instruction);
|
|---|
| 74 | exc_register(TT_PRIVILEGED_OPCODE,
|
|---|
| 75 | "privileged_opcode", false,
|
|---|
| 76 | privileged_opcode);
|
|---|
| 77 | exc_register(TT_UNIMPLEMENTED_LDD,
|
|---|
| 78 | "unimplemented_LDD", false,
|
|---|
| 79 | unimplemented_LDD);
|
|---|
| 80 | exc_register(TT_UNIMPLEMENTED_STD,
|
|---|
| 81 | "unimplemented_STD", false,
|
|---|
| 82 | unimplemented_STD);
|
|---|
| 83 |
|
|---|
| 84 | #ifdef SUN4V
|
|---|
| 85 | exc_register(TT_DAE_INVALID_ASI,
|
|---|
| 86 | "dae_invalid_asi", false,
|
|---|
| 87 | data_access_exception);
|
|---|
| 88 | exc_register(TT_DAE_PRIVILEGE_VIOLATION,
|
|---|
| 89 | "dae_privilege_violation", false,
|
|---|
| 90 | data_access_exception);
|
|---|
| 91 | exc_register(TT_DAE_NC_PAGE,
|
|---|
| 92 | "dae_nc_page", false,
|
|---|
| 93 | data_access_exception);
|
|---|
| 94 | exc_register(TT_DAE_NC_PAGE,
|
|---|
| 95 | "dae_nc_page", false,
|
|---|
| 96 | data_access_exception);
|
|---|
| 97 | exc_register(TT_DAE_NFO_PAGE,
|
|---|
| 98 | "dae_nfo_page", false,
|
|---|
| 99 | data_access_exception);
|
|---|
| 100 | #endif
|
|---|
| 101 |
|
|---|
| 102 | exc_register(TT_FP_DISABLED,
|
|---|
| 103 | "fp_disabled", true,
|
|---|
| 104 | fp_disabled);
|
|---|
| 105 | exc_register(TT_FP_EXCEPTION_IEEE_754,
|
|---|
| 106 | "fp_exception_ieee_754", false,
|
|---|
| 107 | fp_exception_ieee_754);
|
|---|
| 108 | exc_register(TT_FP_EXCEPTION_OTHER,
|
|---|
| 109 | "fp_exception_other", false,
|
|---|
| 110 | fp_exception_other);
|
|---|
| 111 | exc_register(TT_TAG_OVERFLOW,
|
|---|
| 112 | "tag_overflow", false,
|
|---|
| 113 | tag_overflow);
|
|---|
| 114 | exc_register(TT_DIVISION_BY_ZERO,
|
|---|
| 115 | "division_by_zero", false,
|
|---|
| 116 | division_by_zero);
|
|---|
| 117 | exc_register(TT_DATA_ACCESS_EXCEPTION,
|
|---|
| 118 | "data_access_exception", false,
|
|---|
| 119 | data_access_exception);
|
|---|
| 120 | exc_register(TT_DATA_ACCESS_ERROR,
|
|---|
| 121 | "data_access_error", false,
|
|---|
| 122 | data_access_error);
|
|---|
| 123 | exc_register(TT_MEM_ADDRESS_NOT_ALIGNED,
|
|---|
| 124 | "mem_address_not_aligned", false,
|
|---|
| 125 | mem_address_not_aligned);
|
|---|
| 126 | exc_register(TT_LDDF_MEM_ADDRESS_NOT_ALIGNED,
|
|---|
| 127 | "LDDF_mem_address_not_aligned", false,
|
|---|
| 128 | LDDF_mem_address_not_aligned);
|
|---|
| 129 | exc_register(TT_STDF_MEM_ADDRESS_NOT_ALIGNED,
|
|---|
| 130 | "STDF_mem_address_not_aligned", false,
|
|---|
| 131 | STDF_mem_address_not_aligned);
|
|---|
| 132 | exc_register(TT_PRIVILEGED_ACTION,
|
|---|
| 133 | "privileged_action", false,
|
|---|
| 134 | privileged_action);
|
|---|
| 135 | exc_register(TT_LDQF_MEM_ADDRESS_NOT_ALIGNED,
|
|---|
| 136 | "LDQF_mem_address_not_aligned", false,
|
|---|
| 137 | LDQF_mem_address_not_aligned);
|
|---|
| 138 | exc_register(TT_STQF_MEM_ADDRESS_NOT_ALIGNED,
|
|---|
| 139 | "STQF_mem_address_not_aligned", false,
|
|---|
| 140 | STQF_mem_address_not_aligned);
|
|---|
| 141 |
|
|---|
| 142 | exc_register(TT_INTERRUPT_LEVEL_14,
|
|---|
| 143 | "interrupt_level_14", true,
|
|---|
| 144 | tick_interrupt);
|
|---|
| 145 |
|
|---|
| 146 | #ifdef SUN4U
|
|---|
| 147 | exc_register(TT_INTERRUPT_VECTOR_TRAP,
|
|---|
| 148 | "interrupt_vector_trap", true,
|
|---|
| 149 | interrupt);
|
|---|
| 150 | #endif
|
|---|
| 151 |
|
|---|
| 152 | exc_register(TT_FAST_INSTRUCTION_ACCESS_MMU_MISS,
|
|---|
| 153 | "fast_instruction_access_mmu_miss", true,
|
|---|
| 154 | fast_instruction_access_mmu_miss);
|
|---|
| 155 | exc_register(TT_FAST_DATA_ACCESS_MMU_MISS,
|
|---|
| 156 | "fast_data_access_mmu_miss", true,
|
|---|
| 157 | fast_data_access_mmu_miss);
|
|---|
| 158 | exc_register(TT_FAST_DATA_ACCESS_PROTECTION,
|
|---|
| 159 | "fast_data_access_protection", true,
|
|---|
| 160 | fast_data_access_protection);
|
|---|
| 161 |
|
|---|
| 162 | #ifdef SUN4V
|
|---|
| 163 | exc_register(TT_CPU_MONDO,
|
|---|
| 164 | "cpu_mondo", true,
|
|---|
| 165 | cpu_mondo);
|
|---|
| 166 | #endif
|
|---|
| 167 |
|
|---|
| 168 | }
|
|---|
| 169 |
|
|---|
| 170 | /** @}
|
|---|
| 171 | */
|
|---|