aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68knommu/platform/coldfire
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@snapgear.com>2008-02-01 02:37:18 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-02-01 04:58:09 -0500
commit129f481d69123919c9fc351be268878fcd19df01 (patch)
treea0f334ed7c6c9b4132890c1ba49dbeefdb77e399 /arch/m68knommu/platform/coldfire
parentc0ecfcd4b8998441cb6c647ee561e55cc3cd7e81 (diff)
m68knommu: move ColdFire entry.S to its own coldfire directory
Move common ColdFire CPU entry.S to common coldfire platform directory. Currently the common ColdFire CPU family code sits in the arch/m68knommu/platform/5307 directory. This is confusing, the files containing this common code are in no way specific to the 5307 ColdFire. Create an arch/m68knommu/platform/coldfire directory to contain this common code. Other m68knommu CPU varients do not need use this code though, so it doesn't make sense to move it to arch/m68knommu/kernel. Signed-off-by: Greg Ungerer <gerg@uclinux.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/m68knommu/platform/coldfire')
-rw-r--r--arch/m68knommu/platform/coldfire/entry.S235
1 files changed, 235 insertions, 0 deletions
diff --git a/arch/m68knommu/platform/coldfire/entry.S b/arch/m68knommu/platform/coldfire/entry.S
new file mode 100644
index 000000000000..b333731b875a
--- /dev/null
+++ b/arch/m68knommu/platform/coldfire/entry.S
@@ -0,0 +1,235 @@
1/*
2 * linux/arch/m68knommu/platform/5307/entry.S
3 *
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)
9 *
10 * Based on:
11 *
12 * linux/arch/m68k/kernel/entry.S
13 *
14 * Copyright (C) 1991, 1992 Linus Torvalds
15 *
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
18 * for more details.
19 *
20 * Linux/m68k support by Hamish Macdonald
21 *
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>
27 */
28
29#include <linux/sys.h>
30#include <linux/linkage.h>
31#include <asm/unistd.h>
32#include <asm/thread_info.h>
33#include <asm/errno.h>
34#include <asm/setup.h>
35#include <asm/segment.h>
36#include <asm/asm-offsets.h>
37#include <asm/entry.h>
38
39.bss
40
41sw_ksp:
42.long 0
43
44sw_usp:
45.long 0
46
47.text
48
49.globl system_call
50.globl resume
51.globl ret_from_exception
52.globl ret_from_signal
53.globl sys_call_table
54.globl ret_from_interrupt
55.globl inthandler
56.globl fasthandler
57
58enosys:
59 mov.l #sys_ni_syscall,%d3
60 bra 1f
61
62ENTRY(system_call)
63 SAVE_ALL
64 move #0x2000,%sr /* enable intrs again */
65
66 cmpl #NR_syscalls,%d0
67 jcc enosys
68 lea sys_call_table,%a0
69 lsll #2,%d0 /* movel %a0@(%d0:l:4),%d3 */
70 movel %a0@(%d0),%d3
71 jeq enosys
72
731:
74 movel %sp,%d2 /* get thread_info pointer */
75 andl #-THREAD_SIZE,%d2 /* at start of kernel stack */
76 movel %d2,%a0
77 movel %a0@,%a1 /* save top of frame */
78 movel %sp,%a1@(TASK_THREAD+THREAD_ESP0)
79 btst #(TIF_SYSCALL_TRACE%8),%a0@(TI_FLAGS+(31-TIF_SYSCALL_TRACE)/8)
80 bnes 1f
81
82 movel %d3,%a0
83 jbsr %a0@
84 movel %d0,%sp@(PT_D0) /* save the return value */
85 jra ret_from_exception
861:
87 movel #-ENOSYS,%d2 /* strace needs -ENOSYS in PT_D0 */
88 movel %d2,PT_D0(%sp) /* on syscall entry */
89 subql #4,%sp
90 SAVE_SWITCH_STACK
91 jbsr syscall_trace
92 RESTORE_SWITCH_STACK
93 addql #4,%sp
94 movel %d3,%a0
95 jbsr %a0@
96 movel %d0,%sp@(PT_D0) /* save the return value */
97 subql #4,%sp /* dummy return address */
98 SAVE_SWITCH_STACK
99 jbsr syscall_trace
100
101ret_from_signal:
102 RESTORE_SWITCH_STACK
103 addql #4,%sp
104
105ret_from_exception:
106 btst #5,%sp@(PT_SR) /* check if returning to kernel */
107 jeq Luser_return /* if so, skip resched, signals */
108
109Lkernel_return:
110 moveml %sp@,%d1-%d5/%a0-%a2
111 lea %sp@(32),%sp /* space for 8 regs */
112 movel %sp@+,%d0
113 addql #4,%sp /* orig d0 */
114 addl %sp@+,%sp /* stk adj */
115 rte
116
117Luser_return:
118 movel %sp,%d1 /* get thread_info pointer */
119 andl #-THREAD_SIZE,%d1 /* at base of kernel stack */
120 movel %d1,%a0
121 movel %a0@(TI_FLAGS),%d1 /* get thread_info->flags */
122 andl #_TIF_WORK_MASK,%d1
123 jne Lwork_to_do /* still work to do */
124
125Lreturn:
126 move #0x2700,%sr /* disable intrs */
127 movel sw_usp,%a0 /* get usp */
128 movel %sp@(PT_PC),%a0@- /* copy exception program counter */
129 movel %sp@(PT_FORMATVEC),%a0@-/* copy exception format/vector/sr */
130 moveml %sp@,%d1-%d5/%a0-%a2
131 lea %sp@(32),%sp /* space for 8 regs */
132 movel %sp@+,%d0
133 addql #4,%sp /* orig d0 */
134 addl %sp@+,%sp /* stk adj */
135 addql #8,%sp /* remove exception */
136 movel %sp,sw_ksp /* save ksp */
137 subql #8,sw_usp /* set exception */
138 movel sw_usp,%sp /* restore usp */
139 rte
140
141Lwork_to_do:
142 movel %a0@(TI_FLAGS),%d1 /* get thread_info->flags */
143 btst #TIF_NEED_RESCHED,%d1
144 jne reschedule
145
146 /* GERG: do we need something here for TRACEing?? */
147
148Lsignal_return:
149 subql #4,%sp /* dummy return address */
150 SAVE_SWITCH_STACK
151 pea %sp@(SWITCH_STACK_SIZE)
152 clrl %sp@-
153 jsr do_signal
154 addql #8,%sp
155 RESTORE_SWITCH_STACK
156 addql #4,%sp
157 jmp Lreturn
158
159/*
160 * This is the generic interrupt handler (for all hardware interrupt
161 * sources). Calls upto high level code to do all the work.
162 */
163ENTRY(inthandler)
164 SAVE_ALL
165 moveq #-1,%d0
166 movel %d0,%sp@(PT_ORIG_D0)
167
168 movew %sp@(PT_FORMATVEC),%d0 /* put exception # in d0 */
169 andl #0x03fc,%d0 /* mask out vector only */
170
171 movel %sp,%sp@- /* push regs arg */
172 lsrl #2,%d0 /* calculate real vector # */
173 movel %d0,%sp@- /* push vector number */
174 jbsr do_IRQ /* call high level irq handler */
175 lea %sp@(8),%sp /* pop args off stack */
176
177 bra ret_from_interrupt /* this was fallthrough */
178
179/*
180 * This is the fast interrupt handler (for certain hardware interrupt
181 * sources). Unlike the normal interrupt handler it just uses the
182 * current stack (doesn't care if it is user or kernel). It also
183 * doesn't bother doing the bottom half handlers.
184 */
185ENTRY(fasthandler)
186 SAVE_LOCAL
187
188 movew %sp@(PT_FORMATVEC),%d0
189 andl #0x03fc,%d0 /* mask out vector only */
190
191 movel %sp,%sp@- /* push regs arg */
192 lsrl #2,%d0 /* calculate real vector # */
193 movel %d0,%sp@- /* push vector number */
194 jbsr do_IRQ /* call high level irq handler */
195 lea %sp@(8),%sp /* pop args off stack */
196
197 RESTORE_LOCAL
198
199ENTRY(ret_from_interrupt)
200 jeq 2f
2011:
202 RESTORE_ALL
2032:
204 moveb %sp@(PT_SR),%d0
205 andl #0x7,%d0
206 jhi 1b
207
208 /* check if we need to do software interrupts */
209 movel irq_stat+CPUSTAT_SOFTIRQ_PENDING,%d0
210 jeq ret_from_exception
211
212 pea ret_from_exception
213 jmp do_softirq
214
215/*
216 * Beware - when entering resume, prev (the current task) is
217 * in a0, next (the new task) is in a1,so don't change these
218 * registers until their contents are no longer needed.
219 * This is always called in supervisor mode, so don't bother to save
220 * and restore sr; user's process sr is actually in the stack.
221 */
222ENTRY(resume)
223 movel %a0, %d1 /* get prev thread in d1 */
224
225 movel sw_usp,%d0 /* save usp */
226 movel %d0,%a0@(TASK_THREAD+THREAD_USP)
227
228 SAVE_SWITCH_STACK
229 movel %sp,%a0@(TASK_THREAD+THREAD_KSP) /* save kernel stack pointer */
230 movel %a1@(TASK_THREAD+THREAD_KSP),%sp /* restore new thread stack */
231 RESTORE_SWITCH_STACK
232
233 movel %a1@(TASK_THREAD+THREAD_USP),%a0 /* restore thread user stack */
234 movel %a0, sw_usp
235 rts