2 * entry.S - non-mmu 68360 interrupt and exceptions entry points
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 * Copyright (C) 2001 SED Systems, a Division of Calian Ltd.
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file README.legal in the main directory of this archive
11 * Linux/m68k support by Hamish Macdonald
12 * M68360 Port by SED Systems, and Lineo.
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
36 movel #-ENOSYS,%sp@(PT_OFF_D0)
37 jra ret_from_exception
40 movel #-ENOSYS,%sp@(PT_OFF_D0) /* needed for strace*/
43 jbsr syscall_trace_enter
46 movel %sp@(PT_OFF_ORIG_D0),%d1
51 lea sys_call_table, %a0
54 1: movel %d0,%sp@(PT_OFF_D0) /* save the return value */
55 subql #4,%sp /* dummy return address */
57 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 do_IRQ()
128 movew %sp@(PT_OFF_FORMATVEC), %d0
133 movel %d0,%sp@- /* put vector # on stack*/
134 jbsr do_IRQ /* process the IRQ */
135 addql #8,%sp /* pop parameters off stack*/
136 jra ret_from_exception
139 * Handler for uninitialized and spurious interrupts.
142 addql #1,irq_err_count
146 * Beware - when entering resume, prev (the current task) is
147 * in a0, next (the new task) is in a1, so don't change these
148 * registers until their contents are no longer needed.
151 movel %a0,%d1 /* save prev thread in d1 */
152 movew %sr,%a0@(TASK_THREAD+THREAD_SR) /* save sr */
154 movel %sp,%a0@(TASK_THREAD+THREAD_KSP) /* save kernel stack */
155 movel %usp,%a3 /* save usp */
156 movel %a3,%a0@(TASK_THREAD+THREAD_USP)
158 movel %a1@(TASK_THREAD+THREAD_USP),%a3 /* restore user stack */
160 movel %a1@(TASK_THREAD+THREAD_KSP),%sp /* restore new thread stack */
162 movew %a1@(TASK_THREAD+THREAD_SR),%sr /* restore thread status reg */