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/config.h>
16 #include <linux/sys.h>
17 #include <linux/linkage.h>
18 #include <asm/thread_info.h>
19 #include <asm/unistd.h>
20 #include <asm/errno.h>
21 #include <asm/setup.h>
22 #include <asm/segment.h>
23 #include <asm/traps.h>
24 #include <asm/asm-offsets.h>
25 #include <asm/entry.h>
31 .globl ret_from_exception
32 .globl ret_from_signal
34 .globl ret_from_interrupt
39 movel #-ENOSYS,%sp@(PT_D0)
40 jra ret_from_exception
43 movel #-ENOSYS,%sp@(PT_D0) /* needed for strace*/
49 movel %sp@(PT_ORIG_D0),%d1
54 lea sys_call_table, %a0
57 1: movel %d0,%sp@(PT_D0) /* save the return value */
58 subql #4,%sp /* dummy return address */
65 jra ret_from_exception
70 /* save top of frame*/
75 btst #PF_TRACESYS_BIT,%a2@(TASK_FLAGS+PF_TRACESYS_OFF)
80 lea sys_call_table,%a0
83 movel %d0,%sp@(PT_D0) /* save the return value*/
86 btst #5,%sp@(PT_SR) /* check if returning to kernel*/
87 jeq Luser_return /* if so, skip resched, signals*/
93 /* only allow interrupts when we are really the last one on the*/
94 /* kernel stack, otherwise stack overflow can occur during*/
95 /* heavy interrupt load*/
98 movel %sp,%d1 /* get thread_info pointer */
101 move %a2@(TI_FLAGS),%d1 /* thread_info->flags */
102 andl #_TIF_WORK_MASK,%d1
107 movel %a2@(TI_FLAGS),%d1 /* thread_info->flags */
108 btst #TIF_NEED_RESCHED,%d1
112 subql #4,%sp /* dummy return address*/
114 pea %sp@(SWITCH_STACK_SIZE)
124 * This is the main interrupt handler, responsible for calling process_int()
128 addql #1,local_irq_count /* put exception # in d0*/
129 movew %sp@(PT_VECTOR), %d0
134 movel %d0,%sp@- /* put vector # on stack*/
135 jbsr process_int /* process the IRQ*/
136 3: addql #8,%sp /* pop parameters off stack*/
137 bra ret_from_interrupt
140 subql #1,local_irq_count
145 moveb %sp@(PT_SR), %d0
148 /* check if we need to do software interrupts */
150 movel irq_stat+CPUSTAT_SOFTIRQ_PENDING,%d0
151 jeq ret_from_exception
153 pea ret_from_exception
158 * Handler for uninitialized and spurious interrupts.
161 addql #1,num_spurious
165 * Beware - when entering resume, prev (the current task) is
166 * in a0, next (the new task) is in a1,so don't change these
167 * registers until their contents are no longer needed.
170 movel %a0,%d1 /* save prev thread in d1 */
171 movew %sr,%a0@(TASK_THREAD+THREAD_SR) /* save sr */
172 movel %usp,%a2 /* save usp */
173 movel %a2,%a0@(TASK_THREAD+THREAD_USP)
176 movel %sp,%a0@(TASK_THREAD+THREAD_KSP) /* save kernel stack */
177 movel %a1@(TASK_THREAD+THREAD_KSP),%sp /* restore new thread stack */
180 movel %a1@(TASK_THREAD+THREAD_USP),%a0 /* restore user stack */
182 movew %a1@(TASK_THREAD+THREAD_SR),%sr /* restore thread status reg */