2 * linux/arch/m68knommu/platform/68328/entry.S
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/config.h>
14 #include <linux/sys.h>
15 #include <linux/linkage.h>
16 #include <asm/thread_info.h>
17 #include <asm/unistd.h>
18 #include <asm/errno.h>
19 #include <asm/setup.h>
20 #include <asm/segment.h>
21 #include <asm/traps.h>
22 #include <asm/asm-offsets.h>
23 #include <asm/entry.h>
29 .globl ret_from_exception
30 .globl ret_from_signal
32 .globl ret_from_interrupt
43 movel #-ENOSYS,%sp@(PT_D0)
44 jra ret_from_exception
47 movel #-ENOSYS,%sp@(PT_D0) /* needed for strace*/
53 movel %sp@(PT_ORIG_D0),%d1
58 lea sys_call_table, %a0
61 1: movel %d0,%sp@(PT_D0) /* save the return value */
62 subql #4,%sp /* dummy return address */
69 jra ret_from_exception
74 /* save top of frame*/
79 movel %sp@(PT_ORIG_D0),%d0
81 movel %sp,%d1 /* get thread_info pointer */
84 btst #TIF_SYSCALL_TRACE,%a2@(TI_FLAGS)
89 lea sys_call_table,%a0
92 movel %d0,%sp@(PT_D0) /* save the return value*/
95 btst #5,%sp@(PT_SR) /* check if returning to kernel*/
96 jeq Luser_return /* if so, skip resched, signals*/
102 /* only allow interrupts when we are really the last one on the*/
103 /* kernel stack, otherwise stack overflow can occur during*/
104 /* heavy interrupt load*/
107 movel %sp,%d1 /* get thread_info pointer */
110 move %a2@(TI_FLAGS),%d1 /* thread_info->flags */
111 andl #_TIF_WORK_MASK,%d1
116 movel %a2@(TI_FLAGS),%d1 /* thread_info->flags */
117 btst #TIF_NEED_RESCHED,%d1
121 subql #4,%sp /* dummy return address*/
123 pea %sp@(SWITCH_STACK_SIZE)
133 * This is the main interrupt handler, responsible for calling process_int()
137 addql #1,local_irq_count /* put exception # in d0*/
138 movew %sp@(PT_VECTOR), %d0
142 movel #65,%sp@- /* put vector # on stack*/
143 jbsr process_int /* process the IRQ*/
144 3: addql #8,%sp /* pop parameters off stack*/
145 bra ret_from_interrupt
149 addql #1,local_irq_count /* put exception # in d0*/
150 movew %sp@(PT_VECTOR), %d0
154 movel #66,%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_interrupt
161 addql #1,local_irq_count /* put exception # in d0*/
162 movew %sp@(PT_VECTOR), %d0
166 movel #67,%sp@- /* put vector # on stack*/
167 jbsr process_int /* process the IRQ*/
168 3: addql #8,%sp /* pop parameters off stack*/
169 bra ret_from_interrupt
173 addql #1,local_irq_count /* put exception # in d0*/
174 movew %sp@(PT_VECTOR), %d0
178 movel #68,%sp@- /* put vector # on stack*/
179 jbsr process_int /* process the IRQ*/
180 3: addql #8,%sp /* pop parameters off stack*/
181 bra ret_from_interrupt
185 addql #1,local_irq_count /* put exception # in d0*/
186 movew %sp@(PT_VECTOR), %d0
190 movel #69,%sp@- /* put vector # on stack*/
191 jbsr process_int /* process the IRQ*/
192 3: addql #8,%sp /* pop parameters off stack*/
193 bra ret_from_interrupt
197 addql #1,local_irq_count /* put exception # in d0*/
198 movew %sp@(PT_VECTOR), %d0
202 movel #70,%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_interrupt
209 addql #1,local_irq_count /* put exception # in d0*/
210 movew %sp@(PT_VECTOR), %d0
214 movel #71,%sp@- /* put vector # on stack*/
215 jbsr process_int /* process the IRQ*/
216 3: addql #8,%sp /* pop parameters off stack*/
217 bra ret_from_interrupt
221 addql #1,local_irq_count /* put exception # in d0*/
222 movew %sp@(PT_VECTOR), %d0
226 movel %d0,%sp@- /* put vector # on stack*/
227 jbsr process_int /* process the IRQ*/
228 3: addql #8,%sp /* pop parameters off stack*/
229 bra ret_from_interrupt
232 subql #1,local_irq_count
237 moveb %sp@(PT_SR), %d0
241 /* check if we need to do software interrupts */
242 movel local_irq_count,%d0
243 jeq ret_from_exception
245 pea ret_from_exception
250 * Handler for uninitialized and spurious interrupts.
253 addql #1,num_spurious
257 * Beware - when entering resume, prev (the current task) is
258 * in a0, next (the new task) is in a1,so don't change these
259 * registers until their contents are no longer needed.
262 movel %a0,%d1 /* save prev thread in d1 */
263 movew %sr,%a0@(TASK_THREAD+THREAD_SR) /* save sr */
264 movel %usp,%a2 /* save usp */
265 movel %a2,%a0@(TASK_THREAD+THREAD_USP)
268 movel %sp,%a0@(TASK_THREAD+THREAD_KSP) /* save kernel stack */
269 movel %a1@(TASK_THREAD+THREAD_KSP),%sp /* restore new thread stack */
272 movel %a1@(TASK_THREAD+THREAD_USP),%a0 /* restore user stack */
274 movew %a1@(TASK_THREAD+THREAD_SR),%sr /* restore thread status reg */