2
* linux/arch/m68knommu/platform/5307/entry.S
4
* Copyright (C) 1999-2007, Greg Ungerer (gerg@snapgear.com)
5
* Copyright (C) 1998 D. Jeff Dionne <jeff@lineo.ca>,
6
* Kenneth Albanowski <kjahds@kjahds.com>,
7
* Copyright (C) 2000 Lineo Inc. (www.lineo.com)
8
* Copyright (C) 2004-2006 Macq Electronique SA. (www.macqel.com)
12
* linux/arch/m68k/kernel/entry.S
14
* Copyright (C) 1991, 1992 Linus Torvalds
16
* This file is subject to the terms and conditions of the GNU General Public
17
* License. See the file README.legal in the main directory of this archive
20
* Linux/m68k support by Hamish Macdonald
22
* 68060 fixes by Jesper Skov
23
* ColdFire support by Greg Ungerer (gerg@snapgear.com)
24
* 5307 fixes by David W. Miller
25
* linux 2.4 support David McCullough <davidm@snapgear.com>
26
* Bug, speed and maintainability fixes by Philippe De Muyter <phdm@macqel.be>
29
#include <linux/linkage.h>
30
#include <asm/unistd.h>
31
#include <asm/thread_info.h>
32
#include <asm/errno.h>
33
#include <asm/setup.h>
34
#include <asm/segment.h>
35
#include <asm/asm-offsets.h>
36
#include <asm/entry.h>
38
#ifdef CONFIG_COLDFIRE_SW_A7
40
* Define software copies of the supervisor and user stack pointers.
47
#endif /* CONFIG_COLDFIRE_SW_A7 */
53
.globl ret_from_exception
54
.globl ret_from_signal
60
mov.l #sys_ni_syscall,%d3
65
move #0x2000,%sr /* enable intrs again */
69
lea sys_call_table,%a0
70
lsll #2,%d0 /* movel %a0@(%d0:l:4),%d3 */
75
movel %sp,%d2 /* get thread_info pointer */
76
andl #-THREAD_SIZE,%d2 /* at start of kernel stack */
78
movel %a0@,%a1 /* save top of frame */
79
movel %sp,%a1@(TASK_THREAD+THREAD_ESP0)
80
btst #(TIF_SYSCALL_TRACE%8),%a0@(TINFO_FLAGS+(31-TIF_SYSCALL_TRACE)/8)
85
movel %d0,%sp@(PT_OFF_D0) /* save the return value */
86
jra ret_from_exception
88
movel #-ENOSYS,%d2 /* strace needs -ENOSYS in PT_OFF_D0 */
89
movel %d2,PT_OFF_D0(%sp) /* on syscall entry */
92
jbsr syscall_trace_enter
97
movel %d0,%sp@(PT_OFF_D0) /* save the return value */
98
subql #4,%sp /* dummy return address */
100
jbsr syscall_trace_leave
107
move #0x2700,%sr /* disable intrs */
108
btst #5,%sp@(PT_OFF_SR) /* check if returning to kernel */
109
jeq Luser_return /* if so, skip resched, signals */
111
#ifdef CONFIG_PREEMPT
112
movel %sp,%d1 /* get thread_info pointer */
113
andl #-THREAD_SIZE,%d1 /* at base of kernel stack */
115
movel %a0@(TINFO_FLAGS),%d1 /* get thread_info->flags */
116
andl #(1<<TIF_NEED_RESCHED),%d1
119
movel %a0@(TINFO_PREEMPT),%d1
124
jmp preempt_schedule_irq /* preempt the kernel */
128
moveml %sp@,%d1-%d5/%a0-%a2
129
lea %sp@(32),%sp /* space for 8 regs */
131
addql #4,%sp /* orig d0 */
132
addl %sp@+,%sp /* stk adj */
136
movel %sp,%d1 /* get thread_info pointer */
137
andl #-THREAD_SIZE,%d1 /* at base of kernel stack */
139
movel %a0@(TINFO_FLAGS),%d1 /* get thread_info->flags */
140
jne Lwork_to_do /* still work to do */
146
movel %a0@(TINFO_FLAGS),%d1 /* get thread_info->flags */
147
move #0x2000,%sr /* enable intrs again */
148
btst #TIF_NEED_RESCHED,%d1
151
/* GERG: do we need something here for TRACEing?? */
154
subql #4,%sp /* dummy return address */
156
pea %sp@(SWITCH_STACK_SIZE)
164
* This is the generic interrupt handler (for all hardware interrupt
165
* sources). Calls up to high level code to do all the work.
170
movel %d0,%sp@(PT_OFF_ORIG_D0)
172
movew %sp@(PT_OFF_FORMATVEC),%d0 /* put exception # in d0 */
173
andl #0x03fc,%d0 /* mask out vector only */
175
movel %sp,%sp@- /* push regs arg */
176
lsrl #2,%d0 /* calculate real vector # */
177
movel %d0,%sp@- /* push vector number */
178
jbsr do_IRQ /* call high level irq handler */
179
lea %sp@(8),%sp /* pop args off stack */
181
bra ret_from_exception
184
* Beware - when entering resume, prev (the current task) is
185
* in a0, next (the new task) is in a1,so don't change these
186
* registers until their contents are no longer needed.
187
* This is always called in supervisor mode, so don't bother to save
188
* and restore sr; user's process sr is actually in the stack.
191
movel %a0, %d1 /* get prev thread in d1 */
193
movel %a2,%a0@(TASK_THREAD+THREAD_USP)
196
movel %sp,%a0@(TASK_THREAD+THREAD_KSP) /* save kernel stack pointer */
197
movel %a1@(TASK_THREAD+THREAD_KSP),%sp /* restore new thread stack */
200
movel %a1@(TASK_THREAD+THREAD_USP),%a0 /* restore thread user stack */