2 * linux/arch/m68knommu/platform/68360/entry.S
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
32 .globl ret_from_interrupt
37 movel #-ENOSYS,%sp@(PT_OFF_D0)
38 jra ret_from_exception
41 movel #-ENOSYS,%sp@(PT_OFF_D0) /* needed for strace*/
44 jbsr syscall_trace_enter
47 movel %sp@(PT_OFF_ORIG_D0),%d1
52 lea sys_call_table, %a0
55 1: movel %d0,%sp@(PT_OFF_D0) /* save the return value */
56 subql #4,%sp /* dummy return address */
58 jbsr syscall_trace_leave
63 jra ret_from_exception
68 /* save top of frame*/
73 movel %sp@(PT_OFF_ORIG_D0),%d0
75 movel %sp,%d1 /* get thread_info pointer */
76 andl #-THREAD_SIZE,%d1
78 btst #(TIF_SYSCALL_TRACE%8),%a2@(TINFO_FLAGS+(31-TIF_SYSCALL_TRACE)/8)
83 lea sys_call_table,%a0
86 movel %d0,%sp@(PT_OFF_D0) /* save the return value*/
89 btst #5,%sp@(PT_OFF_SR) /* check if returning to kernel*/
90 jeq Luser_return /* if so, skip resched, signals*/
96 /* only allow interrupts when we are really the last one on the*/
97 /* kernel stack, otherwise stack overflow can occur during*/
98 /* heavy interrupt load*/
101 movel %sp,%d1 /* get thread_info pointer */
102 andl #-THREAD_SIZE,%d1
105 move %a2@(TINFO_FLAGS),%d1 /* thread_info->flags */
110 movel %a2@(TINFO_FLAGS),%d1 /* thread_info->flags */
111 btst #TIF_NEED_RESCHED,%d1
115 subql #4,%sp /* dummy return address*/
117 pea %sp@(SWITCH_STACK_SIZE)
118 bsrw do_notify_resume
125 * This is the main interrupt handler, responsible for calling do_IRQ()
129 movew %sp@(PT_OFF_FORMATVEC), %d0
134 movel %d0,%sp@- /* put vector # on stack*/
135 jbsr do_IRQ /* process the IRQ*/
136 3: addql #8,%sp /* pop parameters off stack*/
137 bra ret_from_interrupt
144 moveb %sp@(PT_OFF_SR), %d0
147 /* check if we need to do software interrupts */
149 movel irq_stat+CPUSTAT_SOFTIRQ_PENDING,%d0
150 jeq ret_from_exception
152 pea ret_from_exception
157 * Handler for uninitialized and spurious interrupts.
160 addql #1,irq_err_count
164 * Beware - when entering resume, prev (the current task) is
165 * in a0, next (the new task) is in a1, so don't change these
166 * registers until their contents are no longer needed.
169 movel %a0,%d1 /* save prev thread in d1 */
170 movew %sr,%a0@(TASK_THREAD+THREAD_SR) /* save sr */
172 movel %sp,%a0@(TASK_THREAD+THREAD_KSP) /* save kernel stack */
173 movel %usp,%a3 /* save usp */
174 movel %a3,%a0@(TASK_THREAD+THREAD_USP)
176 movel %a1@(TASK_THREAD+THREAD_USP),%a3 /* restore user stack */
178 movel %a1@(TASK_THREAD+THREAD_KSP),%sp /* restore new thread stack */
180 movew %a1@(TASK_THREAD+THREAD_SR),%sr /* restore thread status reg */