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/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
30 .globl ret_from_interrupt
41 movel #-ENOSYS,%sp@(PT_OFF_D0)
42 jra ret_from_exception
45 movel #-ENOSYS,%sp@(PT_OFF_D0) /* needed for strace*/
48 jbsr syscall_trace_enter
51 movel %sp@(PT_OFF_ORIG_D0),%d1
56 lea sys_call_table, %a0
59 1: movel %d0,%sp@(PT_OFF_D0) /* save the return value */
60 subql #4,%sp /* dummy return address */
62 jbsr syscall_trace_leave
67 jra ret_from_exception
72 /* save top of frame*/
77 movel %sp@(PT_OFF_ORIG_D0),%d0
79 movel %sp,%d1 /* get thread_info pointer */
80 andl #-THREAD_SIZE,%d1
82 btst #(TIF_SYSCALL_TRACE%8),%a2@(TINFO_FLAGS+(31-TIF_SYSCALL_TRACE)/8)
87 lea sys_call_table,%a0
90 movel %d0,%sp@(PT_OFF_D0) /* save the return value*/
93 btst #5,%sp@(PT_OFF_SR) /* check if returning to kernel*/
94 jeq Luser_return /* if so, skip resched, signals*/
100 /* only allow interrupts when we are really the last one on the*/
101 /* kernel stack, otherwise stack overflow can occur during*/
102 /* heavy interrupt load*/
105 movel %sp,%d1 /* get thread_info pointer */
106 andl #-THREAD_SIZE,%d1
109 move %a2@(TINFO_FLAGS),%d1 /* thread_info->flags */
114 movel %a2@(TINFO_FLAGS),%d1 /* thread_info->flags */
115 btst #TIF_NEED_RESCHED,%d1
119 subql #4,%sp /* dummy return address*/
121 pea %sp@(SWITCH_STACK_SIZE)
122 bsrw do_notify_resume
129 * This is the main interrupt handler, responsible for calling process_int()
133 movew %sp@(PT_OFF_FORMATVEC), %d0
137 movel #65,%sp@- /* put vector # on stack*/
138 jbsr process_int /* process the IRQ*/
139 3: addql #8,%sp /* pop parameters off stack*/
140 bra ret_from_interrupt
144 movew %sp@(PT_OFF_FORMATVEC), %d0
148 movel #66,%sp@- /* put vector # on stack*/
149 jbsr process_int /* process the IRQ*/
150 3: addql #8,%sp /* pop parameters off stack*/
151 bra ret_from_interrupt
155 movew %sp@(PT_OFF_FORMATVEC), %d0
159 movel #67,%sp@- /* put vector # on stack*/
160 jbsr process_int /* process the IRQ*/
161 3: addql #8,%sp /* pop parameters off stack*/
162 bra ret_from_interrupt
166 movew %sp@(PT_OFF_FORMATVEC), %d0
170 movel #68,%sp@- /* put vector # on stack*/
171 jbsr process_int /* process the IRQ*/
172 3: addql #8,%sp /* pop parameters off stack*/
173 bra ret_from_interrupt
177 movew %sp@(PT_OFF_FORMATVEC), %d0
181 movel #69,%sp@- /* put vector # on stack*/
182 jbsr process_int /* process the IRQ*/
183 3: addql #8,%sp /* pop parameters off stack*/
184 bra ret_from_interrupt
188 movew %sp@(PT_OFF_FORMATVEC), %d0
192 movel #70,%sp@- /* put vector # on stack*/
193 jbsr process_int /* process the IRQ*/
194 3: addql #8,%sp /* pop parameters off stack*/
195 bra ret_from_interrupt
199 movew %sp@(PT_OFF_FORMATVEC), %d0
203 movel #71,%sp@- /* put vector # on stack*/
204 jbsr process_int /* process the IRQ*/
205 3: addql #8,%sp /* pop parameters off stack*/
206 bra ret_from_interrupt
210 movew %sp@(PT_OFF_FORMATVEC), %d0
214 movel %d0,%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
224 moveb %sp@(PT_OFF_SR), %d0
228 /* check if we need to do software interrupts */
229 jeq ret_from_exception
231 pea ret_from_exception
236 * Handler for uninitialized and spurious interrupts.
239 addql #1,irq_err_count
243 * Beware - when entering resume, prev (the current task) is
244 * in a0, next (the new task) is in a1, so don't change these
245 * registers until their contents are no longer needed.
248 movel %a0,%d1 /* save prev thread in d1 */
249 movew %sr,%a0@(TASK_THREAD+THREAD_SR) /* save sr */
251 movel %sp,%a0@(TASK_THREAD+THREAD_KSP) /* save kernel stack */
252 movel %usp,%a3 /* save usp */
253 movel %a3,%a0@(TASK_THREAD+THREAD_USP)
255 movel %a1@(TASK_THREAD+THREAD_USP),%a3 /* restore user stack */
257 movel %a1@(TASK_THREAD+THREAD_KSP),%sp /* restore new thread stack */
259 movew %a1@(TASK_THREAD+THREAD_SR),%sr /* restore thread status reg */