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/traps.h>
19 #include <asm/asm-offsets.h>
20 #include <asm/entry.h>
26 .globl ret_from_exception
38 movel #-ENOSYS,%sp@(PT_OFF_D0)
39 jra ret_from_exception
42 movel #-ENOSYS,%sp@(PT_OFF_D0) /* needed for strace*/
45 jbsr syscall_trace_enter
48 movel %sp@(PT_OFF_ORIG_D0),%d1
53 lea sys_call_table, %a0
56 1: movel %d0,%sp@(PT_OFF_D0) /* save the return value */
57 subql #4,%sp /* dummy return address */
59 jbsr syscall_trace_leave
62 jra ret_from_exception
67 /* save top of frame*/
72 movel %sp@(PT_OFF_ORIG_D0),%d0
74 movel %sp,%d1 /* get thread_info pointer */
75 andl #-THREAD_SIZE,%d1
77 btst #(TIF_SYSCALL_TRACE%8),%a2@(TINFO_FLAGS+(31-TIF_SYSCALL_TRACE)/8)
82 lea sys_call_table,%a0
85 movel %d0,%sp@(PT_OFF_D0) /* save the return value*/
88 btst #5,%sp@(PT_OFF_SR) /* check if returning to kernel*/
89 jeq Luser_return /* if so, skip resched, signals*/
95 /* only allow interrupts when we are really the last one on the*/
96 /* kernel stack, otherwise stack overflow can occur during*/
97 /* heavy interrupt load*/
100 movel %sp,%d1 /* get thread_info pointer */
101 andl #-THREAD_SIZE,%d1
104 move %a2@(TINFO_FLAGS),%d1 /* thread_info->flags */
109 movel %a2@(TINFO_FLAGS),%d1 /* thread_info->flags */
110 btst #TIF_NEED_RESCHED,%d1
114 subql #4,%sp /* dummy return address*/
116 pea %sp@(SWITCH_STACK_SIZE)
117 bsrw do_notify_resume
124 * This is the main interrupt handler, responsible for calling process_int()
128 movew %sp@(PT_OFF_FORMATVEC), %d0
132 movel #65,%sp@- /* put vector # on stack*/
133 jbsr process_int /* process the IRQ*/
134 3: addql #8,%sp /* pop parameters off stack*/
135 bra ret_from_exception
139 movew %sp@(PT_OFF_FORMATVEC), %d0
143 movel #66,%sp@- /* put vector # on stack*/
144 jbsr process_int /* process the IRQ*/
145 3: addql #8,%sp /* pop parameters off stack*/
146 bra ret_from_exception
150 movew %sp@(PT_OFF_FORMATVEC), %d0
154 movel #67,%sp@- /* put vector # on stack*/
155 jbsr process_int /* process the IRQ*/
156 3: addql #8,%sp /* pop parameters off stack*/
157 bra ret_from_exception
161 movew %sp@(PT_OFF_FORMATVEC), %d0
165 movel #68,%sp@- /* put vector # on stack*/
166 jbsr process_int /* process the IRQ*/
167 3: addql #8,%sp /* pop parameters off stack*/
168 bra ret_from_exception
172 movew %sp@(PT_OFF_FORMATVEC), %d0
176 movel #69,%sp@- /* put vector # on stack*/
177 jbsr process_int /* process the IRQ*/
178 3: addql #8,%sp /* pop parameters off stack*/
179 bra ret_from_exception
183 movew %sp@(PT_OFF_FORMATVEC), %d0
187 movel #70,%sp@- /* put vector # on stack*/
188 jbsr process_int /* process the IRQ*/
189 3: addql #8,%sp /* pop parameters off stack*/
190 bra ret_from_exception
194 movew %sp@(PT_OFF_FORMATVEC), %d0
198 movel #71,%sp@- /* put vector # on stack*/
199 jbsr process_int /* process the IRQ*/
200 3: addql #8,%sp /* pop parameters off stack*/
201 bra ret_from_exception
205 movew %sp@(PT_OFF_FORMATVEC), %d0
209 movel %d0,%sp@- /* put vector # on stack*/
210 jbsr process_int /* process the IRQ*/
211 3: addql #8,%sp /* pop parameters off stack*/
212 bra ret_from_exception
215 * Handler for uninitialized and spurious interrupts.
218 addql #1,irq_err_count
222 * Beware - when entering resume, prev (the current task) is
223 * in a0, next (the new task) is in a1, so don't change these
224 * registers until their contents are no longer needed.
227 movel %a0,%d1 /* save prev thread in d1 */
228 movew %sr,%a0@(TASK_THREAD+THREAD_SR) /* save sr */
230 movel %sp,%a0@(TASK_THREAD+THREAD_KSP) /* save kernel stack */
231 movel %usp,%a3 /* save usp */
232 movel %a3,%a0@(TASK_THREAD+THREAD_USP)
234 movel %a1@(TASK_THREAD+THREAD_USP),%a3 /* restore user stack */
236 movel %a1@(TASK_THREAD+THREAD_KSP),%sp /* restore new thread stack */
238 movew %a1@(TASK_THREAD+THREAD_SR),%sr /* restore thread status reg */