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/sys.h>
16 #include <linux/linkage.h>
17 #include <asm/thread_info.h>
18 #include <asm/unistd.h>
19 #include <asm/errno.h>
20 #include <asm/setup.h>
21 #include <asm/segment.h>
22 #include <asm/traps.h>
23 #include <asm/asm-offsets.h>
24 #include <asm/entry.h>
30 .globl ret_from_exception
31 .globl ret_from_signal
33 .globl ret_from_interrupt
38 movel #-ENOSYS,%sp@(PT_OFF_D0)
39 jra ret_from_exception
42 movel #-ENOSYS,%sp@(PT_OFF_D0) /* needed for strace*/
45 jbsr syscall_trace_enter
48 movel %sp@(PT_OFF_ORIG_D0),%d1
53 lea sys_call_table, %a0
56 1: movel %d0,%sp@(PT_OFF_D0) /* save the return value */
57 subql #4,%sp /* dummy return address */
59 jbsr syscall_trace_leave
64 jra ret_from_exception
69 /* save top of frame*/
74 movel %sp@(PT_OFF_ORIG_D0),%d0
76 movel %sp,%d1 /* get thread_info pointer */
77 andl #-THREAD_SIZE,%d1
79 btst #(TIF_SYSCALL_TRACE%8),%a2@(TI_FLAGS+(31-TIF_SYSCALL_TRACE)/8)
84 lea sys_call_table,%a0
87 movel %d0,%sp@(PT_OFF_D0) /* save the return value*/
90 btst #5,%sp@(PT_OFF_SR) /* check if returning to kernel*/
91 jeq Luser_return /* if so, skip resched, signals*/
97 /* only allow interrupts when we are really the last one on the*/
98 /* kernel stack, otherwise stack overflow can occur during*/
99 /* heavy interrupt load*/
102 movel %sp,%d1 /* get thread_info pointer */
103 andl #-THREAD_SIZE,%d1
105 move %a2@(TI_FLAGS),%d1 /* thread_info->flags */
106 andl #_TIF_WORK_MASK,%d1
111 movel %a2@(TI_FLAGS),%d1 /* thread_info->flags */
112 btst #TIF_NEED_RESCHED,%d1
116 subql #4,%sp /* dummy return address*/
118 pea %sp@(SWITCH_STACK_SIZE)
128 * This is the main interrupt handler, responsible for calling do_IRQ()
132 movew %sp@(PT_OFF_FORMATVEC), %d0
137 movel %d0,%sp@- /* put vector # on stack*/
138 jbsr do_IRQ /* process the IRQ*/
139 3: addql #8,%sp /* pop parameters off stack*/
140 bra ret_from_interrupt
147 moveb %sp@(PT_OFF_SR), %d0
150 /* check if we need to do software interrupts */
152 movel irq_stat+CPUSTAT_SOFTIRQ_PENDING,%d0
153 jeq ret_from_exception
155 pea ret_from_exception
160 * Handler for uninitialized and spurious interrupts.
163 addql #1,num_spurious
167 * Beware - when entering resume, prev (the current task) is
168 * in a0, next (the new task) is in a1,so don't change these
169 * registers until their contents are no longer needed.
172 movel %a0,%d1 /* save prev thread in d1 */
173 movew %sr,%a0@(TASK_THREAD+THREAD_SR) /* save sr */
174 movel %usp,%a2 /* save usp */
175 movel %a2,%a0@(TASK_THREAD+THREAD_USP)
178 movel %sp,%a0@(TASK_THREAD+THREAD_KSP) /* save kernel stack */
179 movel %a1@(TASK_THREAD+THREAD_KSP),%sp /* restore new thread stack */
182 movel %a1@(TASK_THREAD+THREAD_USP),%a0 /* restore user stack */
184 movew %a1@(TASK_THREAD+THREAD_SR),%sr /* restore thread status reg */