1 /* $Id: entry.S,v 1.19 1999/12/08 22:05:10 harald Exp $
3 * Low level exception handling
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
9 * Copyright (C) 1994 - 2000 by Ralf Baechle
10 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
12 #include <linux/config.h>
13 #include <linux/sys.h>
16 #include <asm/current.h>
17 #include <asm/errno.h>
18 #include <asm/mipsregs.h>
20 #include <asm/pgtable.h>
21 #include <asm/stackframe.h>
22 #include <asm/processor.h>
23 #include <asm/regdef.h>
24 #include <asm/fpregdef.h>
25 #include <asm/unistd.h>
26 #include <asm/isadep.h>
37 EXPORT(handle_softirq)
41 reschedule: jal schedule
43 EXPORT(ret_from_sys_call)
45 .type ret_from_irq,@function
46 lw t0, irq_stat # softirq_active
47 lw t1, irq_stat+4 # softirq_mask. unused delay slot
49 bnez t0, handle_softirq
52 9: lw t0,PT_STATUS(sp) # returning to kernel mode?
53 lw t2, TASK_NEED_RESCHED($28)
55 beqz t1, return # -> yes
57 lw v0, TASK_SIGPENDING($28)
63 EXPORT(return) .set noat
68 * Common spurious interrupt handler.
72 LEAF(spurious_interrupt)
74 * Someone tried to fool us by sending an interrupt but we
75 * couldn't find a cause for it.
77 lui t1,%hi(spurious_count)
79 lw t0,%lo(spurious_count)(t1)
83 sw t0,%lo(spurious_count)(t1)
84 END(spurious_interrupt)
87 * Build a default exception handler for the exceptions that don't need
88 * special handlers. If you didn't know yet - I *like* playing games with
89 * the C preprocessor ...
91 #define __BUILD_clear_none(exception)
92 #define __BUILD_clear_sti(exception) \
94 #define __BUILD_clear_cli(exception) \
96 #define __BUILD_clear_fpe(exception) \
102 #define __BUILD_clear_ade(exception) \
104 MFC0 t0,CP0_BADVADDR; \
106 REG_S t0,PT_BVADDR(sp); \
108 #define __BUILD_silent(exception)
110 #define fmt "Got %s at %08lx.\n"
112 #define __BUILD_verbose(exception) \
115 REG_L a2,PT_EPC(sp); \
117 #define __BUILD_count(exception) \
119 lw t0,exception_count_##exception; \
122 sw t0,exception_count_##exception; \
124 EXPORT(exception_count_##exception); \
127 #define BUILD_HANDLER(exception,handler,clear,verbose) \
129 NESTED(handle_##exception, PT_SIZE, sp); \
132 __BUILD_clear_##clear(exception); \
134 __BUILD_##verbose(exception); \
137 j ret_from_sys_call; \
139 END(handle_##exception)
141 BUILD_HANDLER(adel,ade,ade,silent) /* #4 */
142 BUILD_HANDLER(ades,ade,ade,silent) /* #5 */
143 BUILD_HANDLER(ibe,ibe,cli,verbose) /* #6 */
144 BUILD_HANDLER(dbe,dbe,cli,silent) /* #7 */
145 BUILD_HANDLER(bp,bp,sti,silent) /* #9 */
146 BUILD_HANDLER(ri,ri,sti,silent) /* #10 */
147 BUILD_HANDLER(cpu,cpu,sti,silent) /* #11 */
148 BUILD_HANDLER(ov,ov,sti,silent) /* #12 */
149 BUILD_HANDLER(tr,tr,sti,silent) /* #13 */
150 BUILD_HANDLER(fpe,fpe,fpe,silent) /* #15 */
151 BUILD_HANDLER(watch,watch,sti,verbose) /* #23 */
152 BUILD_HANDLER(reserved,reserved,sti,verbose) /* others */
161 EXPORT(sys_call_table)
162 #define SYS(call, narg) PTR call
164 /* Reserved space for all SVR4 syscalls. */
165 .space (1000)*PTRSIZE
167 #ifdef CONFIG_BINFMT_IRIX
168 /* 32bit IRIX5 system calls. */
169 #include "irix5sys.h"
171 .space (1000)*PTRSIZE /* No IRIX syscalls */
174 /* Reserved space for all the BSD43 and POSIX syscalls. */
175 .space (2000)*PTRSIZE
177 /* Linux flavoured syscalls. */
178 #include "syscalls.h"
181 * Number of arguments of each syscall
183 EXPORT(sys_narg_table)
185 #define SYS(call, narg) .byte narg
187 /* Reserved space for all SVR4 flavoured syscalls. */
190 #ifdef CONFIG_BINFMT_IRIX
191 /* 32bit IRIX5 system calls. */
192 #include "irix5sys.h"
194 .space (1000) /* No IRIX syscalls */
197 /* Reserved space for all the BSD43 and POSIX syscalls. */
200 /* Linux flavoured syscalls. */
201 #include "syscalls.h"