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/sys.h>
14 #include <linux/linkage.h>
15 #include <asm/thread_info.h>
16 #include <asm/unistd.h>
17 #include <asm/errno.h>
18 #include <asm/setup.h>
19 #include <asm/segment.h>
20 #include <asm/traps.h>
21 #include <asm/asm-offsets.h>
22 #include <asm/entry.h>
28 .globl ret_from_exception
29 .globl ret_from_signal
31 .globl ret_from_interrupt
42 movel #-ENOSYS,%sp@(PT_D0)
43 jra ret_from_exception
46 movel #-ENOSYS,%sp@(PT_D0) /* needed for strace*/
52 movel %sp@(PT_ORIG_D0),%d1
57 lea sys_call_table, %a0
60 1: movel %d0,%sp@(PT_D0) /* save the return value */
61 subql #4,%sp /* dummy return address */
68 jra ret_from_exception
73 /* save top of frame*/
78 movel %sp@(PT_ORIG_D0),%d0
80 movel %sp,%d1 /* get thread_info pointer */
81 andl #-THREAD_SIZE,%d1
83 btst #TIF_SYSCALL_TRACE,%a2@(TI_FLAGS)
88 lea sys_call_table,%a0
91 movel %d0,%sp@(PT_D0) /* save the return value*/
94 btst #5,%sp@(PT_SR) /* check if returning to kernel*/
95 jeq Luser_return /* if so, skip resched, signals*/
101 /* only allow interrupts when we are really the last one on the*/
102 /* kernel stack, otherwise stack overflow can occur during*/
103 /* heavy interrupt load*/
106 movel %sp,%d1 /* get thread_info pointer */
107 andl #-THREAD_SIZE,%d1
109 move %a2@(TI_FLAGS),%d1 /* thread_info->flags */
110 andl #_TIF_WORK_MASK,%d1
115 movel %a2@(TI_FLAGS),%d1 /* thread_info->flags */
116 btst #TIF_NEED_RESCHED,%d1
120 subql #4,%sp /* dummy return address*/
122 pea %sp@(SWITCH_STACK_SIZE)
132 * This is the main interrupt handler, responsible for calling process_int()
136 movew %sp@(PT_VECTOR), %d0
140 movel #65,%sp@- /* put vector # on stack*/
141 jbsr process_int /* process the IRQ*/
142 3: addql #8,%sp /* pop parameters off stack*/
143 bra ret_from_interrupt
147 movew %sp@(PT_VECTOR), %d0
151 movel #66,%sp@- /* put vector # on stack*/
152 jbsr process_int /* process the IRQ*/
153 3: addql #8,%sp /* pop parameters off stack*/
154 bra ret_from_interrupt
158 movew %sp@(PT_VECTOR), %d0
162 movel #67,%sp@- /* put vector # on stack*/
163 jbsr process_int /* process the IRQ*/
164 3: addql #8,%sp /* pop parameters off stack*/
165 bra ret_from_interrupt
169 movew %sp@(PT_VECTOR), %d0
173 movel #68,%sp@- /* put vector # on stack*/
174 jbsr process_int /* process the IRQ*/
175 3: addql #8,%sp /* pop parameters off stack*/
176 bra ret_from_interrupt
180 movew %sp@(PT_VECTOR), %d0
184 movel #69,%sp@- /* put vector # on stack*/
185 jbsr process_int /* process the IRQ*/
186 3: addql #8,%sp /* pop parameters off stack*/
187 bra ret_from_interrupt
191 movew %sp@(PT_VECTOR), %d0
195 movel #70,%sp@- /* put vector # on stack*/
196 jbsr process_int /* process the IRQ*/
197 3: addql #8,%sp /* pop parameters off stack*/
198 bra ret_from_interrupt
202 movew %sp@(PT_VECTOR), %d0
206 movel #71,%sp@- /* put vector # on stack*/
207 jbsr process_int /* process the IRQ*/
208 3: addql #8,%sp /* pop parameters off stack*/
209 bra ret_from_interrupt
213 movew %sp@(PT_VECTOR), %d0
217 movel %d0,%sp@- /* put vector # on stack*/
218 jbsr process_int /* process the IRQ*/
219 3: addql #8,%sp /* pop parameters off stack*/
220 bra ret_from_interrupt
227 moveb %sp@(PT_SR), %d0
231 /* check if we need to do software interrupts */
232 jeq ret_from_exception
234 pea ret_from_exception
239 * Handler for uninitialized and spurious interrupts.
242 addql #1,num_spurious
246 * Beware - when entering resume, prev (the current task) is
247 * in a0, next (the new task) is in a1,so don't change these
248 * registers until their contents are no longer needed.
251 movel %a0,%d1 /* save prev thread in d1 */
252 movew %sr,%a0@(TASK_THREAD+THREAD_SR) /* save sr */
253 movel %usp,%a2 /* save usp */
254 movel %a2,%a0@(TASK_THREAD+THREAD_USP)
257 movel %sp,%a0@(TASK_THREAD+THREAD_KSP) /* save kernel stack */
258 movel %a1@(TASK_THREAD+THREAD_KSP),%sp /* restore new thread stack */
261 movel %a1@(TASK_THREAD+THREAD_USP),%a0 /* restore user stack */
263 movew %a1@(TASK_THREAD+THREAD_SR),%sr /* restore thread status reg */