2 * entry.S -- non-mmu 68000 interrupt and exception entry points
4 * Copyright (C) 1991, 1992 Linus Torvalds
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file README.legal in the main directory of this archive
10 * Linux/m68k support by Hamish Macdonald
13 #include <linux/linkage.h>
14 #include <asm/thread_info.h>
15 #include <asm/unistd.h>
16 #include <asm/errno.h>
17 #include <asm/setup.h>
18 #include <asm/segment.h>
19 #include <asm/traps.h>
20 #include <asm/asm-offsets.h>
21 #include <asm/entry.h>
27 .globl ret_from_exception
28 .globl ret_from_signal
40 movel #-ENOSYS,%sp@(PT_OFF_D0)
41 jra ret_from_exception
44 movel #-ENOSYS,%sp@(PT_OFF_D0) /* needed for strace*/
47 jbsr syscall_trace_enter
50 movel %sp@(PT_OFF_ORIG_D0),%d1
55 lea sys_call_table, %a0
58 1: movel %d0,%sp@(PT_OFF_D0) /* save the return value */
59 subql #4,%sp /* dummy return address */
61 jbsr syscall_trace_leave
66 jra ret_from_exception
71 /* save top of frame*/
76 movel %sp@(PT_OFF_ORIG_D0),%d0
78 movel %sp,%d1 /* get thread_info pointer */
79 andl #-THREAD_SIZE,%d1
81 btst #(TIF_SYSCALL_TRACE%8),%a2@(TINFO_FLAGS+(31-TIF_SYSCALL_TRACE)/8)
86 lea sys_call_table,%a0
89 movel %d0,%sp@(PT_OFF_D0) /* save the return value*/
92 btst #5,%sp@(PT_OFF_SR) /* check if returning to kernel*/
93 jeq Luser_return /* if so, skip resched, signals*/
99 /* only allow interrupts when we are really the last one on the*/
100 /* kernel stack, otherwise stack overflow can occur during*/
101 /* heavy interrupt load*/
104 movel %sp,%d1 /* get thread_info pointer */
105 andl #-THREAD_SIZE,%d1
108 move %a2@(TINFO_FLAGS),%d1 /* thread_info->flags */
113 movel %a2@(TINFO_FLAGS),%d1 /* thread_info->flags */
114 btst #TIF_NEED_RESCHED,%d1
118 subql #4,%sp /* dummy return address*/
120 pea %sp@(SWITCH_STACK_SIZE)
121 bsrw do_notify_resume
128 * This is the main interrupt handler, responsible for calling process_int()
132 movew %sp@(PT_OFF_FORMATVEC), %d0
136 movel #65,%sp@- /* put vector # on stack*/
137 jbsr process_int /* process the IRQ*/
138 3: addql #8,%sp /* pop parameters off stack*/
139 bra ret_from_exception
143 movew %sp@(PT_OFF_FORMATVEC), %d0
147 movel #66,%sp@- /* put vector # on stack*/
148 jbsr process_int /* process the IRQ*/
149 3: addql #8,%sp /* pop parameters off stack*/
150 bra ret_from_exception
154 movew %sp@(PT_OFF_FORMATVEC), %d0
158 movel #67,%sp@- /* put vector # on stack*/
159 jbsr process_int /* process the IRQ*/
160 3: addql #8,%sp /* pop parameters off stack*/
161 bra ret_from_exception
165 movew %sp@(PT_OFF_FORMATVEC), %d0
169 movel #68,%sp@- /* put vector # on stack*/
170 jbsr process_int /* process the IRQ*/
171 3: addql #8,%sp /* pop parameters off stack*/
172 bra ret_from_exception
176 movew %sp@(PT_OFF_FORMATVEC), %d0
180 movel #69,%sp@- /* put vector # on stack*/
181 jbsr process_int /* process the IRQ*/
182 3: addql #8,%sp /* pop parameters off stack*/
183 bra ret_from_exception
187 movew %sp@(PT_OFF_FORMATVEC), %d0
191 movel #70,%sp@- /* put vector # on stack*/
192 jbsr process_int /* process the IRQ*/
193 3: addql #8,%sp /* pop parameters off stack*/
194 bra ret_from_exception
198 movew %sp@(PT_OFF_FORMATVEC), %d0
202 movel #71,%sp@- /* put vector # on stack*/
203 jbsr process_int /* process the IRQ*/
204 3: addql #8,%sp /* pop parameters off stack*/
205 bra ret_from_exception
209 movew %sp@(PT_OFF_FORMATVEC), %d0
213 movel %d0,%sp@- /* put vector # on stack*/
214 jbsr process_int /* process the IRQ*/
215 3: addql #8,%sp /* pop parameters off stack*/
216 bra ret_from_exception
219 * Handler for uninitialized and spurious interrupts.
222 addql #1,irq_err_count
226 * Beware - when entering resume, prev (the current task) is
227 * in a0, next (the new task) is in a1, so don't change these
228 * registers until their contents are no longer needed.
231 movel %a0,%d1 /* save prev thread in d1 */
232 movew %sr,%a0@(TASK_THREAD+THREAD_SR) /* save sr */
234 movel %sp,%a0@(TASK_THREAD+THREAD_KSP) /* save kernel stack */
235 movel %usp,%a3 /* save usp */
236 movel %a3,%a0@(TASK_THREAD+THREAD_USP)
238 movel %a1@(TASK_THREAD+THREAD_USP),%a3 /* restore user stack */
240 movel %a1@(TASK_THREAD+THREAD_KSP),%sp /* restore new thread stack */
242 movew %a1@(TASK_THREAD+THREAD_SR),%sr /* restore thread status reg */