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
6 * Copyright (C) 1994 - 2000, 2001, 2003 Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2001 MIPS Technologies, Inc.
9 * Copyright (C) 2002 Maciej W. Rozycki
11 #include <linux/config.h>
12 #include <linux/init.h>
15 #include <asm/cacheops.h>
16 #include <asm/regdef.h>
17 #include <asm/fpregdef.h>
18 #include <asm/mipsregs.h>
19 #include <asm/stackframe.h>
22 #define PANIC_PIC(msg) \
35 NESTED(except_vec0_generic, 0, sp)
36 PANIC_PIC("Exception vector 0 called")
37 END(except_vec0_generic)
39 NESTED(except_vec1_generic, 0, sp)
40 PANIC_PIC("Exception vector 1 called")
41 END(except_vec1_generic)
44 * General exception vector for all other CPUs.
46 * Be careful when changing this, it has to be at most 128 bytes
47 * to fit into space reserved for the exception handler.
49 NESTED(except_vec3_generic, 0, sp)
52 #if R5432_CP0_INTERRUPT_WAR
60 PTR_L k0, exception_handlers(k1)
63 END(except_vec3_generic)
66 * General exception handler for CPUs with virtual coherency exception.
68 * Be careful when changing this, it has to be at most 256 (as a special
69 * exception) bytes to fit into space reserved for the exception handler.
71 NESTED(except_vec3_r4000, 0, sp)
81 beq k1, k0, handle_vced
83 beq k1, k0, handle_vcei
88 PTR_L k0, exception_handlers(k1)
92 * Big shit, we now may have two dirty primary cache lines for the same
93 * physical address. We can savely invalidate the line pointed to by
94 * c0_badvaddr because after return from this exception handler the
95 * load / store will be re-executed.
98 DMFC0 k0, CP0_BADVADDR
99 li k1, -4 # Is this ...
100 and k0, k1 # ... really needed?
102 cache Index_Store_Tag_D,(k0)
103 cache Hit_Writeback_Inv_SD,(k0)
104 #ifdef CONFIG_PROC_FS
105 PTR_LA k0, vced_count
113 MFC0 k0, CP0_BADVADDR
114 cache Hit_Writeback_Inv_SD, (k0) # also cleans pi
115 #ifdef CONFIG_PROC_FS
116 PTR_LA k0, vcei_count
123 END(except_vec3_r4000)
126 * Special interrupt vector for MIPS64 ISA & embedded MIPS processors.
127 * This is a dedicated interrupt exception vector which reduces the
128 * interrupt processing overhead. The jump instruction will be replaced
129 * at the initialization time.
131 * Be careful when changing this, it has to be at most 128 bytes
132 * to fit into space reserved for the exception handler.
134 NESTED(except_vec4, 0, sp)
135 1: j 1b /* Dummy, will be replaced */
139 * EJTAG debug exception handler.
140 * The EJTAG debug exception entry point is 0xbfc00480, which
141 * normally is in the boot PROM, so the boot PROM must do a
142 * unconditional jump to this vector.
144 NESTED(except_vec_ejtag_debug, 0, sp)
145 j ejtag_debug_handler
146 END(except_vec_ejtag_debug)
151 * EJTAG debug exception handler.
153 NESTED(ejtag_debug_handler, PT_SIZE, sp)
159 sll k0, k0, 30 # Check for SDBBP.
160 bgez k0, ejtag_return
162 PTR_LA k0, ejtag_debug_buffer
166 jal ejtag_exception_handler
168 PTR_LA k0, ejtag_debug_buffer
176 END(ejtag_debug_handler)
179 * This buffer is reserved for the use of the EJTAG debug
183 EXPORT(ejtag_debug_buffer)
190 * NMI debug exception handler for MIPS reference boards.
191 * The NMI debug exception entry point is 0xbfc00000, which
192 * normally is in the boot PROM, so the boot PROM must do a
193 * unconditional jump to this vector.
195 NESTED(except_vec_nmi, 0, sp)
201 NESTED(nmi_handler, PT_SIZE, sp)
207 jal nmi_exception_handler
213 .macro __build_clear_none
216 .macro __build_clear_sti
220 .macro __build_clear_cli
224 .macro __build_clear_fpe
232 .macro __build_clear_ade
233 MFC0 t0, CP0_BADVADDR
234 PTR_S t0, PT_BVADDR(sp)
238 .macro __BUILD_silent exception
241 /* Gas tries to parse the PRINT argument as a string containing
242 string escapes and emits bogus warnings if it believes to
243 recognize an unknown escape code. So make the arguments
244 start with an n and gas will believe \n is ok ... */
245 .macro __BUILD_verbose nexception
246 LONG_L a1, PT_EPC(sp)
248 PRINT("Got \nexception at %08lx\012")
251 PRINT("Got \nexception at %016lx\012")
255 .macro __BUILD_count exception
256 LONG_L t0,exception_count_\exception
258 LONG_S t0,exception_count_\exception
259 .comm exception_count\exception, 8, 8
262 .macro __BUILD_HANDLER exception handler clear verbose ext
264 NESTED(handle_\exception, PT_SIZE, sp)
267 FEXPORT(handle_\exception\ext)
270 __BUILD_\verbose \exception
274 END(handle_\exception)
277 .macro BUILD_HANDLER exception handler clear verbose
278 __BUILD_HANDLER \exception \handler \clear \verbose _int
281 BUILD_HANDLER adel ade ade silent /* #4 */
282 BUILD_HANDLER ades ade ade silent /* #5 */
283 BUILD_HANDLER ibe be cli silent /* #6 */
284 BUILD_HANDLER dbe be cli silent /* #7 */
285 BUILD_HANDLER bp bp sti silent /* #9 */
286 BUILD_HANDLER ri ri sti silent /* #10 */
287 BUILD_HANDLER cpu cpu sti silent /* #11 */
288 BUILD_HANDLER ov ov sti silent /* #12 */
289 BUILD_HANDLER tr tr sti silent /* #13 */
290 BUILD_HANDLER fpe fpe fpe silent /* #15 */
291 BUILD_HANDLER mdmx mdmx sti silent /* #22 */
292 BUILD_HANDLER watch watch sti verbose /* #23 */
293 BUILD_HANDLER mcheck mcheck cli verbose /* #24 */
294 BUILD_HANDLER reserved reserved sti verbose /* others */
297 /* A temporary overflow handler used by check_daddi(). */
301 BUILD_HANDLER daddi_ov daddi_ov none silent /* #12 */