2 * Low level exception handling
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
8 * Copyright (C) 1994, 1995 by Ralf Baechle
10 * $Id: entry.S,v 1.14 1999/04/12 19:13:21 harald Exp $
14 * entry.S contains the system-call and fault low-level handling routines.
15 * This also contains the timer-interrupt handler, as well as all interrupts
16 * and faults that can result in a task-switch. The ISA dependent TLB
17 * code is in arch/mips/<ISA-level>/<cputype>.S
19 #include <linux/config.h>
20 #include <linux/sys.h>
23 #include <asm/current.h>
24 #include <asm/errno.h>
25 #include <asm/mipsregs.h>
26 #include <asm/mipsconfig.h>
28 #include <asm/pgtable.h>
29 #include <asm/stackframe.h>
30 #include <asm/processor.h>
31 #include <asm/regdef.h>
32 #include <asm/fpregdef.h>
33 #include <asm/unistd.h>
36 * Heia ... The %lo, %hi and %HI stuff is too strong for the ELF assembler
37 * and the ABI to cope with ...
43 EXPORT(handle_bottom_half)
49 reschedule: jal schedule
52 EXPORT(ret_from_sys_call)
55 lw t1,bh_active # unused delay slot
57 bnez t0,handle_bottom_half
58 9: lw t0,PT_STATUS(sp) # returning to kernel mode?
61 beqz t1, return # -> yes
62 lw t1, TASK_NEED_RESCHED($28)
64 lw v0, TASK_SIGPENDING($28)
71 EXPORT(return) .set noat
77 * Common spurious interrupt handler.
81 LEAF(spurious_interrupt)
83 * Someone tried to fool us by sending an interrupt but we
84 * couldn't find a cause for it.
86 lui t1,%hi(spurious_count)
87 lw t0,%lo(spurious_count)(t1)
90 sw t0,%lo(spurious_count)(t1)
91 END(spurious_interrupt)
94 * Build a default exception handler for the exceptions that don't need
95 * special handlers. If you didn't know yet - I *like* playing games with
96 * the C preprocessor ...
98 #define __BUILD_clear_none(exception)
99 #define __BUILD_clear_sti(exception) \
101 #define __BUILD_clear_cli(exception) \
103 #define __BUILD_clear_fpe(exception) \
109 #define __BUILD_clear_ade(exception) \
110 MFC0 t0,CP0_BADVADDR; \
111 REG_S t0,PT_BVADDR(sp); \
113 #define __BUILD_silent(exception)
115 #define fmt "Got %s at %08lx.\n"
117 #define __BUILD_verbose(exception) \
120 REG_L a2,PT_EPC(sp); \
122 #define __BUILD_count(exception) \
124 lw t0,exception_count_##exception; \
126 sw t0,exception_count_##exception; \
129 EXPORT(exception_count_##exception); \
132 #define BUILD_HANDLER(exception,handler,clear,verbose) \
134 NESTED(handle_##exception, PT_SIZE, sp); \
137 __BUILD_clear_##clear(exception); \
139 __BUILD_##verbose(exception); \
142 j ret_from_sys_call; \
144 END(handle_##exception)
146 BUILD_HANDLER(adel,ade,ade,silent) /* #4 */
147 BUILD_HANDLER(ades,ade,ade,silent) /* #5 */
148 BUILD_HANDLER(ibe,ibe,cli,verbose) /* #6 */
149 BUILD_HANDLER(dbe,dbe,cli,silent) /* #7 */
150 BUILD_HANDLER(bp,bp,sti,silent) /* #9 */
151 BUILD_HANDLER(ri,ri,sti,silent) /* #10 */
152 BUILD_HANDLER(cpu,cpu,sti,silent) /* #11 */
153 BUILD_HANDLER(ov,ov,sti,silent) /* #12 */
154 BUILD_HANDLER(tr,tr,sti,silent) /* #13 */
155 BUILD_HANDLER(fpe,fpe,fpe,silent) /* #15 */
156 BUILD_HANDLER(watch,watch,sti,verbose) /* #23 */
157 BUILD_HANDLER(reserved,reserved,sti,verbose) /* others */
164 EXPORT(sys_call_table)
165 #define SYS(call, narg) PTR call
167 /* Reserved space for all SVR4 syscalls. */
168 .space (1000)*PTRSIZE
170 #ifdef CONFIG_BINFMT_IRIX
171 /* 32bit IRIX5 system calls. */
172 #include "irix5sys.h"
174 .space (1000)*PTRSIZE /* No IRIX syscalls */
177 /* Reserved space for all the BSD43 and POSIX syscalls. */
178 .space (2000)*PTRSIZE
180 /* Linux flavoured syscalls. */
181 #include "syscalls.h"
184 * Number of arguments of each syscall
186 EXPORT(sys_narg_table)
188 #define SYS(call, narg) .byte narg
190 /* Reserved space for all SVR4 flavoured syscalls. */
193 #ifdef CONFIG_BINFMT_IRIX
194 /* 32bit IRIX5 system calls. */
195 #include "irix5sys.h"
197 .space (1000) /* No IRIX syscalls */
200 /* Reserved space for all the BSD43 and POSIX syscalls. */
203 /* Linux flavoured syscalls. */
204 #include "syscalls.h"