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_D0)
39 jra ret_from_exception
42 movel #-ENOSYS,%sp@(PT_D0) /* needed for strace*/
48 movel %sp@(PT_ORIG_D0),%d1
53 lea sys_call_table, %a0
56 1: movel %d0,%sp@(PT_D0) /* save the return value */
57 subql #4,%sp /* dummy return address */
64 jra ret_from_exception
69 /* save top of frame*/
74 btst #PF_TRACESYS_BIT,%a2@(TASK_FLAGS+PF_TRACESYS_OFF)
79 lea sys_call_table,%a0
82 movel %d0,%sp@(PT_D0) /* save the return value*/
85 btst #5,%sp@(PT_SR) /* check if returning to kernel*/
86 jeq Luser_return /* if so, skip resched, signals*/
92 /* only allow interrupts when we are really the last one on the*/
93 /* kernel stack, otherwise stack overflow can occur during*/
94 /* heavy interrupt load*/
97 movel %sp,%d1 /* get thread_info pointer */
98 andl #-THREAD_SIZE,%d1
100 move %a2@(TI_FLAGS),%d1 /* thread_info->flags */
101 andl #_TIF_WORK_MASK,%d1
106 movel %a2@(TI_FLAGS),%d1 /* thread_info->flags */
107 btst #TIF_NEED_RESCHED,%d1
111 subql #4,%sp /* dummy return address*/
113 pea %sp@(SWITCH_STACK_SIZE)
123 * This is the main interrupt handler, responsible for calling do_IRQ()
127 movew %sp@(PT_VECTOR), %d0
132 movel %d0,%sp@- /* put vector # on stack*/
133 jbsr do_IRQ /* process the IRQ*/
134 3: addql #8,%sp /* pop parameters off stack*/
135 bra ret_from_interrupt
142 moveb %sp@(PT_SR), %d0
145 /* check if we need to do software interrupts */
147 movel irq_stat+CPUSTAT_SOFTIRQ_PENDING,%d0
148 jeq ret_from_exception
150 pea ret_from_exception
155 * Handler for uninitialized and spurious interrupts.
158 addql #1,num_spurious
162 * Beware - when entering resume, prev (the current task) is
163 * in a0, next (the new task) is in a1,so don't change these
164 * registers until their contents are no longer needed.
167 movel %a0,%d1 /* save prev thread in d1 */
168 movew %sr,%a0@(TASK_THREAD+THREAD_SR) /* save sr */
169 movel %usp,%a2 /* save usp */
170 movel %a2,%a0@(TASK_THREAD+THREAD_USP)
173 movel %sp,%a0@(TASK_THREAD+THREAD_KSP) /* save kernel stack */
174 movel %a1@(TASK_THREAD+THREAD_KSP),%sp /* restore new thread stack */
177 movel %a1@(TASK_THREAD+THREAD_USP),%a0 /* restore user stack */
179 movew %a1@(TASK_THREAD+THREAD_SR),%sr /* restore thread status reg */