1 |
199 |
simons |
/* -*- mode: asm -*-
|
2 |
|
|
*
|
3 |
|
|
* linux/arch/m68knommu/platform/5206e/entry.S
|
4 |
|
|
*
|
5 |
|
|
* Copyright (C) 1999 Greg Ungerer (gerg@moreton.com.au)
|
6 |
|
|
* Copyright (C) 1998 D. Jeff Dionne ,
|
7 |
|
|
* Kenneth Albanowski ,
|
8 |
|
|
* The Silver Hammer Group, Ltd.
|
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@moreton.com.au)
|
24 |
|
|
* 5307 fixes by David W. Miller
|
25 |
|
|
*/
|
26 |
|
|
|
27 |
|
|
/*
|
28 |
|
|
* entry.S contains the system-call and fault low-level handling routines.
|
29 |
|
|
* This also contains the timer-interrupt handler, as well as all interrupts
|
30 |
|
|
* and faults that can result in a task-switch.
|
31 |
|
|
*
|
32 |
|
|
* NOTE: This code handles signal-recognition, which happens every time
|
33 |
|
|
* after a timer-interrupt and after each system call.
|
34 |
|
|
*
|
35 |
|
|
* Stack layout in 'ret_from_exception':
|
36 |
|
|
*
|
37 |
|
|
* This allows access to the syscall arguments in registers d1-d5
|
38 |
|
|
*
|
39 |
|
|
* 0(sp) - d1
|
40 |
|
|
* 4(sp) - d2
|
41 |
|
|
* 8(sp) - d3
|
42 |
|
|
* C(sp) - d4
|
43 |
|
|
* 10(sp) - d5
|
44 |
|
|
* 14(sp) - a0
|
45 |
|
|
* 18(sp) - a1
|
46 |
|
|
* 1C(sp) - d0
|
47 |
|
|
* 20(sp) - orig_d0
|
48 |
|
|
* 24(sp) - stack adjustment
|
49 |
|
|
* 28(sp) - format & vector }
|
50 |
|
|
* 2A(sp) - sr } different to m68k
|
51 |
|
|
* 2C(sp) - pc }
|
52 |
|
|
*/
|
53 |
|
|
|
54 |
|
|
#include
|
55 |
|
|
#include
|
56 |
|
|
#include
|
57 |
|
|
#include
|
58 |
|
|
#include
|
59 |
|
|
|
60 |
|
|
LENOSYS = 38
|
61 |
|
|
|
62 |
|
|
/*
|
63 |
|
|
* these are offsets into the task-struct
|
64 |
|
|
*/
|
65 |
|
|
LTASK_STATE = 0
|
66 |
|
|
LTASK_COUNTER = 4
|
67 |
|
|
LTASK_PRIORITY = 8
|
68 |
|
|
LTASK_SIGNAL = 12
|
69 |
|
|
LTASK_BLOCKED = 16
|
70 |
|
|
LTASK_FLAGS = 20
|
71 |
|
|
|
72 |
|
|
/* the following macro is used when enabling interrupts */
|
73 |
|
|
#define ALLOWINT 0xf8ff
|
74 |
|
|
#define MAX_NOINT_IPL 0
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
LD0 = 0x1C
|
78 |
|
|
LORIG_D0 = 0x20
|
79 |
|
|
LSR = 0x2a
|
80 |
|
|
LFORMATVEC = 0x28
|
81 |
|
|
LPC = 0x2c
|
82 |
|
|
|
83 |
|
|
/*
|
84 |
|
|
* This defines the normal kernel pt-regs layout.
|
85 |
|
|
*
|
86 |
|
|
* regs are a2-a6 and d6-d7 preserved by C code
|
87 |
|
|
* the kernel doesn't mess with usp unless it needs to
|
88 |
|
|
*
|
89 |
|
|
* This is made a little more tricky on the ColdFire. There is no
|
90 |
|
|
* separate kernel and user stack pointers. Need to artificially
|
91 |
|
|
* construct a usp in software... When doing this we need to disable
|
92 |
|
|
* interrupts, otherwise bad things could happen.
|
93 |
|
|
*/
|
94 |
|
|
#define SAVE_ALL \
|
95 |
|
|
move #0x2700,%sr; /* disable intrs */ \
|
96 |
|
|
btst #5,%sp@(2); /* from user? */ \
|
97 |
|
|
bnes 1f; /* no, skip */ \
|
98 |
|
|
addl #8,%sp; /* remove exception */ \
|
99 |
|
|
movel %sp,sw_usp; /* save user sp */ \
|
100 |
|
|
movel sw_ksp,%sp; /* kernel sp */ \
|
101 |
|
|
subql #8,%sp; /* room for exception */\
|
102 |
|
|
clrl %sp@-; /* stk_adj */ \
|
103 |
|
|
movel %d0,%sp@-; /* orig d0 */ \
|
104 |
|
|
movel %d0,%sp@-; /* d0 */ \
|
105 |
|
|
subl #28,%sp; /* space for 7 regs */ \
|
106 |
|
|
moveml %d1-%d5/%a0-%a1,%sp@; \
|
107 |
|
|
movel sw_usp,%a0; /* get usp */ \
|
108 |
|
|
moveml %a0@(-8),%d1-%d2; /* get exception */ \
|
109 |
|
|
moveml %d1-%d2,%sp@(LFORMATVEC); /* copy exception */ \
|
110 |
|
|
bra 2f; \
|
111 |
|
|
1: \
|
112 |
|
|
clrl %sp@-; /* stk_adj */ \
|
113 |
|
|
movel %d0,%sp@-; /* orig d0 */ \
|
114 |
|
|
movel %d0,%sp@-; /* d0 */ \
|
115 |
|
|
subl #28,%sp; /* space for 7 regs */ \
|
116 |
|
|
moveml %d1-%d5/%a0-%a1,%sp@; \
|
117 |
|
|
2:
|
118 |
|
|
|
119 |
|
|
#define RESTORE_ALL \
|
120 |
|
|
btst #5,%sp@(LSR); /* going user? */ \
|
121 |
|
|
bnes 1f; /* no, skip */ \
|
122 |
|
|
move #0x2700,%sr; /* disable intrs */ \
|
123 |
|
|
movel sw_usp,%a0; /* get usp */ \
|
124 |
|
|
moveml %sp@(LFORMATVEC),%d1-%d2; /* copy exception */ \
|
125 |
|
|
moveml %d1-%d2,%a0@(-8); \
|
126 |
|
|
moveml %sp@,%d1-%d5/%a0-%a1; \
|
127 |
|
|
addl #28,%sp; /* space for 7 regs */ \
|
128 |
|
|
movel %sp@+,%d0; \
|
129 |
|
|
addql #4,%sp; /* orig d0 */ \
|
130 |
|
|
addl %sp@+,%sp; /* stk adj */ \
|
131 |
|
|
addql #8,%sp; /* remove exception */ \
|
132 |
|
|
movel %sp,sw_ksp; /* save ksp */ \
|
133 |
|
|
movel sw_usp,%sp; /* restore usp */ \
|
134 |
|
|
subql #8,%sp; /* set exception */ \
|
135 |
|
|
rte; \
|
136 |
|
|
1: \
|
137 |
|
|
moveml %sp@,%d1-%d5/%a0-%a1; \
|
138 |
|
|
addl #28,%sp; /* space for 7 regs */ \
|
139 |
|
|
movel %sp@+,%d0; \
|
140 |
|
|
addql #4,%sp; /* orig d0 */ \
|
141 |
|
|
addl %sp@+,%sp; /* stk adj */ \
|
142 |
|
|
rte
|
143 |
|
|
|
144 |
|
|
/*
|
145 |
|
|
* Quick exception save, use current stack only.
|
146 |
|
|
*/
|
147 |
|
|
#define SAVE_LOCAL \
|
148 |
|
|
move #0x2700,%sr; /* disable intrs */ \
|
149 |
|
|
clrl %sp@-; /* stk_adj */ \
|
150 |
|
|
movel %d0,%sp@-; /* orig d0 */ \
|
151 |
|
|
movel %d0,%sp@-; /* d0 */ \
|
152 |
|
|
subl #28,%sp; /* space for 7 regs */ \
|
153 |
|
|
moveml %d1-%d5/%a0-%a1,%sp@;
|
154 |
|
|
|
155 |
|
|
#define RESTORE_LOCAL \
|
156 |
|
|
moveml %sp@,%d1-%d5/%a0-%a1; \
|
157 |
|
|
addl #28,%sp; /* space for 7 regs */ \
|
158 |
|
|
movel %sp@+,%d0; \
|
159 |
|
|
addql #4,%sp; /* orig d0 */ \
|
160 |
|
|
addl %sp@+,%sp; /* stk adj */ \
|
161 |
|
|
rte
|
162 |
|
|
|
163 |
|
|
|
164 |
|
|
#define SWITCH_STACK_SIZE (7*4+4) /* includes return address */
|
165 |
|
|
|
166 |
|
|
#define SAVE_SWITCH_STACK \
|
167 |
|
|
subl #28,%sp; /* 7 regs */ \
|
168 |
|
|
moveml %a2-%a6/%d6-%d7,%sp@
|
169 |
|
|
|
170 |
|
|
#define RESTORE_SWITCH_STACK \
|
171 |
|
|
moveml %sp@,%a2-%a6/%d6-%d7; \
|
172 |
|
|
addl #28,%sp /* 7 regs */
|
173 |
|
|
|
174 |
|
|
/*
|
175 |
|
|
* Software copy of the user and kernel stack pointers... Ugh...
|
176 |
|
|
* Need these to get around ColdFire not having separate kernel
|
177 |
|
|
* and user stack pointers.
|
178 |
|
|
*/
|
179 |
|
|
.globl SYMBOL_NAME(sw_usp)
|
180 |
|
|
.globl SYMBOL_NAME(sw_ksp)
|
181 |
|
|
|
182 |
|
|
.data
|
183 |
|
|
|
184 |
|
|
sw_ksp:
|
185 |
|
|
.long 0
|
186 |
|
|
|
187 |
|
|
sw_usp:
|
188 |
|
|
.long 0
|
189 |
|
|
|
190 |
|
|
.text
|
191 |
|
|
|
192 |
|
|
|
193 |
|
|
.globl SYMBOL_NAME(buserr)
|
194 |
|
|
.globl SYMBOL_NAME(trap)
|
195 |
|
|
.globl SYMBOL_NAME(system_call)
|
196 |
|
|
.globl SYMBOL_NAME(resume), SYMBOL_NAME(ret_from_exception)
|
197 |
|
|
.globl SYMBOL_NAME(ret_from_signal)
|
198 |
|
|
.globl SYMBOL_NAME(sys_call_table)
|
199 |
|
|
.globl SYMBOL_NAME(sys_fork), SYMBOL_NAME(sys_clone)
|
200 |
|
|
.globl SYMBOL_NAME(ret_from_interrupt)
|
201 |
|
|
.globl SYMBOL_NAME(intrhandler)
|
202 |
|
|
.globl SYMBOL_NAME(fasthandler)
|
203 |
|
|
|
204 |
|
|
.text
|
205 |
|
|
|
206 |
|
|
ENTRY(buserr)
|
207 |
|
|
SAVE_ALL
|
208 |
|
|
moveq #-1,%d0
|
209 |
|
|
movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field
|
210 |
|
|
| signifies that the stack frame
|
211 |
|
|
| is NOT for syscall
|
212 |
|
|
|
213 |
|
|
movel %sp,%sp@- | stack frame pointer argument
|
214 |
|
|
jsr SYMBOL_NAME(buserr_c)
|
215 |
|
|
addql #4,%sp
|
216 |
|
|
jra SYMBOL_NAME(ret_from_exception)
|
217 |
|
|
|
218 |
|
|
|
219 |
|
|
ENTRY(reschedule)
|
220 |
|
|
| save top of frame
|
221 |
|
|
pea %sp@
|
222 |
|
|
jbsr SYMBOL_NAME(set_esp0)
|
223 |
|
|
addql #4,%sp
|
224 |
|
|
|
225 |
|
|
pea SYMBOL_NAME(ret_from_exception)
|
226 |
|
|
jmp SYMBOL_NAME(schedule)
|
227 |
|
|
|
228 |
|
|
ENTRY(system_call)
|
229 |
|
|
SAVE_ALL
|
230 |
|
|
move #0x2000,%sr; | enable intrs again
|
231 |
|
|
|
232 |
|
|
movel #-LENOSYS,%d2
|
233 |
|
|
movel %d2,LD0(%sp) | default return value in d0
|
234 |
|
|
| original D0 is in orig_d0
|
235 |
|
|
movel %d0,%d2
|
236 |
|
|
|
237 |
|
|
| save top of frame
|
238 |
|
|
pea %sp@
|
239 |
|
|
jbsr SYMBOL_NAME(set_esp0)
|
240 |
|
|
addql #4,%sp
|
241 |
|
|
|
242 |
|
|
cmpl #NR_syscalls,%d2
|
243 |
|
|
jcc SYMBOL_NAME(ret_from_exception)
|
244 |
|
|
lea SYMBOL_NAME(sys_call_table),%a0
|
245 |
|
|
lsll #2,%d2 | movel %a0@(%d2:l:4),%d3
|
246 |
|
|
movel %a0@(%d2),%d3
|
247 |
|
|
jeq SYMBOL_NAME(ret_from_exception)
|
248 |
|
|
lsrl #2,%d2
|
249 |
|
|
movel SYMBOL_NAME(current_set),%a0
|
250 |
|
|
btst #5,%a0@(LTASK_FLAGS+3) | PF_TRACESYS
|
251 |
|
|
bnes 1f
|
252 |
|
|
movel %d3,%a0
|
253 |
|
|
jbsr %a0@
|
254 |
|
|
movel %d0,%sp@(LD0) | save the return value
|
255 |
|
|
jra SYMBOL_NAME(ret_from_exception)
|
256 |
|
|
1:
|
257 |
|
|
subql #4,%sp
|
258 |
|
|
SAVE_SWITCH_STACK
|
259 |
|
|
jbsr SYMBOL_NAME(syscall_trace)
|
260 |
|
|
RESTORE_SWITCH_STACK
|
261 |
|
|
addql #4,%sp
|
262 |
|
|
movel %d3,%a0
|
263 |
|
|
jbsr %a0@
|
264 |
|
|
movel %d0,%sp@(LD0) | save the return value
|
265 |
|
|
subql #4,%sp | dummy return address
|
266 |
|
|
SAVE_SWITCH_STACK
|
267 |
|
|
jbsr SYMBOL_NAME(syscall_trace)
|
268 |
|
|
|
269 |
|
|
SYMBOL_NAME_LABEL(ret_from_signal)
|
270 |
|
|
RESTORE_SWITCH_STACK
|
271 |
|
|
addql #4,%sp
|
272 |
|
|
|
273 |
|
|
SYMBOL_NAME_LABEL(ret_from_exception)
|
274 |
|
|
btst #5,%sp@(LSR) | check if returning to kernel
|
275 |
|
|
bnes 2f | if so, skip resched, signals
|
276 |
|
|
tstl SYMBOL_NAME(need_resched)
|
277 |
|
|
jne SYMBOL_NAME(reschedule)
|
278 |
|
|
movel SYMBOL_NAME(current_set),%a0
|
279 |
|
|
cmpl #SYMBOL_NAME(task),%a0 | task[0] cannot have signals
|
280 |
|
|
jeq 2f
|
281 |
|
|
bclr #5,%a0@(LTASK_FLAGS+1) | check for delayed trace
|
282 |
|
|
jeq 1f
|
283 |
|
|
bclr #7,%sp@(LSR) | clear trace bit in SR
|
284 |
|
|
pea 1 | send SIGTRAP
|
285 |
|
|
movel %a0,%sp@-
|
286 |
|
|
pea 5
|
287 |
|
|
jbsr SYMBOL_NAME(send_sig)
|
288 |
|
|
addql #8,%sp
|
289 |
|
|
addql #4,%sp
|
290 |
|
|
movel SYMBOL_NAME(current_set),%a0
|
291 |
|
|
|
292 |
|
|
1:
|
293 |
|
|
tstl %a0@(LTASK_STATE) | state
|
294 |
|
|
jne SYMBOL_NAME(reschedule)
|
295 |
|
|
tstl %a0@(LTASK_COUNTER) | counter
|
296 |
|
|
jeq SYMBOL_NAME(reschedule)
|
297 |
|
|
|
298 |
|
|
movel %a0@(LTASK_BLOCKED),%d0
|
299 |
|
|
movel %d0,%d1 | save blocked in d1 for sig handling
|
300 |
|
|
notl %d0
|
301 |
|
|
btst #4,%a0@(LTASK_FLAGS+3) | PF_PTRACED
|
302 |
|
|
jeq 1f
|
303 |
|
|
moveq #-1,%d0 | let the debugger see all signals
|
304 |
|
|
1: andl %a0@(LTASK_SIGNAL),%d0
|
305 |
|
|
jne Lsignal_return
|
306 |
|
|
2: RESTORE_ALL | Does RTE
|
307 |
|
|
|
308 |
|
|
Lsignal_return:
|
309 |
|
|
subql #4,%sp | dummy return address
|
310 |
|
|
SAVE_SWITCH_STACK
|
311 |
|
|
pea %sp@(SWITCH_STACK_SIZE)
|
312 |
|
|
movel %d1,%sp@-
|
313 |
|
|
jsr SYMBOL_NAME(do_signal)
|
314 |
|
|
addql #8,%sp
|
315 |
|
|
RESTORE_SWITCH_STACK
|
316 |
|
|
addql #4,%sp
|
317 |
|
|
|
318 |
|
|
btst #5,%sp@(LSR); /* going user? */
|
319 |
|
|
bnes not_user; /* no, skip */
|
320 |
|
|
move #0x2700,%sr; /* disable intrs */
|
321 |
|
|
movel sw_usp,%a0; /* get usp */
|
322 |
|
|
moveml %sp@(LFORMATVEC),%d1-%d2; /* copy exception */
|
323 |
|
|
moveml %d1-%d2,%a0@(-8);
|
324 |
|
|
bclr #5,%a0@(-8); /* clear format byte, bit 5 to make stack appear modulo 4 which it WILL be when we do the rte because it was generated in setup_frame */
|
325 |
|
|
bclr #4,%a0@(-8); /* clear format byte, bit 5 to make stack appear modulo 4 which it WILL be when we do the rte because it was generated in setup_frame */
|
326 |
|
|
moveml %sp@,%d1-%d5/%a0-%a1;
|
327 |
|
|
addl #28,%sp; /* space for 7 regs */
|
328 |
|
|
movel %sp@+,%d0;
|
329 |
|
|
addql #4,%sp; /* orig d0 */
|
330 |
|
|
addl %sp@+,%sp; /* stk adj */
|
331 |
|
|
addql #8,%sp; /* remove exception */
|
332 |
|
|
movel %sp,sw_ksp; /* save ksp */
|
333 |
|
|
movel sw_usp,%sp; /* restore usp */
|
334 |
|
|
subql #8,%sp; /* set exception */
|
335 |
|
|
rte;
|
336 |
|
|
not_user:
|
337 |
|
|
moveml %sp@,%d1-%d5/%a0-%a1;
|
338 |
|
|
addl #28,%sp; /* space for 7 regs */
|
339 |
|
|
movel %sp@+,%d0;
|
340 |
|
|
addql #4,%sp; /* orig d0 */
|
341 |
|
|
addl %sp@+,%sp; /* stk adj */
|
342 |
|
|
rte
|
343 |
|
|
|
344 |
|
|
/*--------------------------------------------------------------------------*/
|
345 |
|
|
|
346 |
|
|
/*
|
347 |
|
|
* Common ColdFire trap handler. Most traps come through here first.
|
348 |
|
|
*/
|
349 |
|
|
ENTRY(trap)
|
350 |
|
|
SAVE_ALL
|
351 |
|
|
moveq #-1,%d0
|
352 |
|
|
movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field
|
353 |
|
|
| signifies that the stack frame
|
354 |
|
|
| is NOT for syscall
|
355 |
|
|
movew %sp@(LFORMATVEC),%d0 | get exception vector
|
356 |
|
|
andl #0x03fc,%d0 | mask out vector only
|
357 |
|
|
lsrl #2,%d0 | calculate real vector #
|
358 |
|
|
movel %sp,%sp@- | stack frame pointer argument
|
359 |
|
|
movel %d0,%sp@- | push vector # on stack
|
360 |
|
|
|
361 |
|
|
jsr SYMBOL_NAME(trap_c)
|
362 |
|
|
addql #8,%sp
|
363 |
|
|
jra SYMBOL_NAME(ret_from_exception)
|
364 |
|
|
|
365 |
|
|
|
366 |
|
|
/*
|
367 |
|
|
* This is the generic interrupt handler (for all hardware interrupt
|
368 |
|
|
* sources). It figures out the vector number and calls the appropriate
|
369 |
|
|
* interrupt service routine directly.
|
370 |
|
|
*/
|
371 |
|
|
SYMBOL_NAME_LABEL(intrhandler)
|
372 |
|
|
SAVE_ALL
|
373 |
|
|
|
374 |
|
|
moveq #-1,%d0
|
375 |
|
|
movel %d0,%sp@(LORIG_D0) | a -1 in the ORIG_D0 field
|
376 |
|
|
| signifies that the stack frame
|
377 |
|
|
| is NOT for syscall
|
378 |
|
|
addql #1,SYMBOL_NAME(intr_count)
|
379 |
|
|
| put exception # in d0
|
380 |
|
|
movew %sp@(LFORMATVEC),%d0
|
381 |
|
|
andl #0x03fc,%d0 | mask out vector only
|
382 |
|
|
|
383 |
|
|
movel SYMBOL_NAME(irq_kstat_interrupt),%a0
|
384 |
|
|
| get addr of kstat struct
|
385 |
|
|
addql #1,%a0@(%d0) | incr irq intr count
|
386 |
|
|
|
387 |
|
|
lsrl #2,%d0 | calculate real vector #
|
388 |
|
|
movel %d0,%d1 | calculate array offset
|
389 |
|
|
lsll #4,%d1
|
390 |
|
|
lea SYMBOL_NAME(vec_list),%a0
|
391 |
|
|
addl %d1,%a0 | pointer to array struct
|
392 |
|
|
|
393 |
|
|
movel %sp,%sp@- | push regs arg onto stack
|
394 |
|
|
movel %a0@(8),%sp@- | push devid arg
|
395 |
|
|
movel %d0,%sp@- | push vector # on stack
|
396 |
|
|
|
397 |
|
|
movel %a0@,%a0 | get function to call
|
398 |
|
|
jbsr %a0@ | call vector handler
|
399 |
|
|
addl #12,%sp | pop parameters off stack
|
400 |
|
|
|
401 |
|
|
bra ret_from_interrupt | this was fallthrough
|
402 |
|
|
|
403 |
|
|
|
404 |
|
|
/*
|
405 |
|
|
* This is the fast interrupt handler (for certain hardware interrupt
|
406 |
|
|
* sources). Unlike the normal interrupt handler it just uses the
|
407 |
|
|
* current stack (doesn't care if it is user or kernel). It also
|
408 |
|
|
* doesn't bother doing the bottom half handlers.
|
409 |
|
|
*/
|
410 |
|
|
SYMBOL_NAME_LABEL(fasthandler)
|
411 |
|
|
SAVE_LOCAL
|
412 |
|
|
|
413 |
|
|
movew %sp@(LFORMATVEC),%d0
|
414 |
|
|
andl #0x03fc,%d0 | mask out vector only
|
415 |
|
|
|
416 |
|
|
movel SYMBOL_NAME(irq_kstat_interrupt),%a0
|
417 |
|
|
| get addr of kstat struct
|
418 |
|
|
addql #1,%a0@(%d0) | incr irq intr count
|
419 |
|
|
|
420 |
|
|
movel %sp,%sp@- | push regs arg onto stack
|
421 |
|
|
clrl %d1
|
422 |
|
|
movel %d1,%sp@- | push devid arg
|
423 |
|
|
lsrl #2,%d0 | calculate real vector #
|
424 |
|
|
movel %d0,%sp@- | push vector # on stack
|
425 |
|
|
|
426 |
|
|
lsll #4,%d0 | adjust for array offset
|
427 |
|
|
lea SYMBOL_NAME(vec_list),%a0
|
428 |
|
|
movel %a0@(%d0),%a0 | get function to call
|
429 |
|
|
jbsr %a0@ | call vector handler
|
430 |
|
|
addl #12,%sp | pop parameters off stack
|
431 |
|
|
|
432 |
|
|
RESTORE_LOCAL
|
433 |
|
|
|
434 |
|
|
/*--------------------------------------------------------------------------*/
|
435 |
|
|
|
436 |
|
|
SYMBOL_NAME_LABEL(ret_from_interrupt)
|
437 |
|
|
/* check if we need to do software interrupts */
|
438 |
|
|
1:
|
439 |
|
|
movel SYMBOL_NAME(intr_count),%d1
|
440 |
|
|
subql #1,%d1
|
441 |
|
|
jne 4f
|
442 |
|
|
|
443 |
|
|
|movel %sp@(LSR),%d0
|
444 |
|
|
|lsr #5,%d0
|
445 |
|
|
moveb %sp@(LSR),%d0
|
446 |
|
|
andl #0x7,%d0
|
447 |
|
|
|bfextu %sp@(LSR){#5,#3},%d0 | Check for nested interrupt.
|
448 |
|
|
#if MAX_NOINT_IPL > 0
|
449 |
|
|
cmpiw #MAX_NOINT_IPL,%d0
|
450 |
|
|
#endif
|
451 |
|
|
jhi 4f
|
452 |
|
|
|
453 |
|
|
move #0x2000,%sr; | enable intrs again
|
454 |
|
|
|
455 |
|
|
2:
|
456 |
|
|
movel SYMBOL_NAME(bh_active),%d0
|
457 |
|
|
andl SYMBOL_NAME(bh_mask),%d0
|
458 |
|
|
jne 3f
|
459 |
|
|
|
460 |
|
|
clrl SYMBOL_NAME(intr_count) | deliver signals, reschedule etc..
|
461 |
|
|
jra SYMBOL_NAME(ret_from_exception)
|
462 |
|
|
3:
|
463 |
|
|
jbsr SYMBOL_NAME(do_bottom_half)
|
464 |
|
|
jbra 2b
|
465 |
|
|
4:
|
466 |
|
|
movel %d1,SYMBOL_NAME(intr_count)
|
467 |
|
|
RESTORE_ALL
|
468 |
|
|
|
469 |
|
|
|
470 |
|
|
/* Handler for uninitialized and spurious interrupts */
|
471 |
|
|
|
472 |
|
|
SYMBOL_NAME_LABEL(bad_interrupt)
|
473 |
|
|
addql #1,SYMBOL_NAME(num_spurious)
|
474 |
|
|
rte
|
475 |
|
|
|
476 |
|
|
ENTRY(sys_fork)
|
477 |
|
|
SAVE_SWITCH_STACK
|
478 |
|
|
pea %sp@(SWITCH_STACK_SIZE)
|
479 |
|
|
jbsr SYMBOL_NAME(m68k_fork)
|
480 |
|
|
addql #4,%sp
|
481 |
|
|
RESTORE_SWITCH_STACK
|
482 |
|
|
rts
|
483 |
|
|
|
484 |
|
|
ENTRY(sys_clone)
|
485 |
|
|
SAVE_SWITCH_STACK
|
486 |
|
|
pea %sp@(SWITCH_STACK_SIZE)
|
487 |
|
|
jbsr SYMBOL_NAME(m68k_clone)
|
488 |
|
|
addql #4,%sp
|
489 |
|
|
RESTORE_SWITCH_STACK
|
490 |
|
|
rts
|
491 |
|
|
|
492 |
|
|
ENTRY(sys_sigsuspend)
|
493 |
|
|
SAVE_SWITCH_STACK
|
494 |
|
|
pea %sp@(SWITCH_STACK_SIZE)
|
495 |
|
|
jbsr SYMBOL_NAME(do_sigsuspend)
|
496 |
|
|
addql #4,%sp
|
497 |
|
|
RESTORE_SWITCH_STACK
|
498 |
|
|
rts
|
499 |
|
|
|
500 |
|
|
ENTRY(sys_sigreturn)
|
501 |
|
|
SAVE_SWITCH_STACK
|
502 |
|
|
jbsr SYMBOL_NAME(do_sigreturn)
|
503 |
|
|
RESTORE_SWITCH_STACK
|
504 |
|
|
rts
|
505 |
|
|
|
506 |
|
|
LTSS_KSP = 0
|
507 |
|
|
LTSS_USP = 4
|
508 |
|
|
LTSS_SR = 8
|
509 |
|
|
LTSS_FS = 10
|
510 |
|
|
LTSS_CRP = 12
|
511 |
|
|
LTSS_FPCTXT = 24
|
512 |
|
|
|
513 |
|
|
SYMBOL_NAME_LABEL(resume)
|
514 |
|
|
/*
|
515 |
|
|
* Beware - when entering resume, offset of tss is in d1,
|
516 |
|
|
* prev (the current task) is in a0, next (the new task)
|
517 |
|
|
* is in a1 and d2.b is non-zero if the mm structure is
|
518 |
|
|
* shared between the tasks, so don't change these
|
519 |
|
|
* registers until their contents are no longer needed.
|
520 |
|
|
*/
|
521 |
|
|
|
522 |
|
|
/* offset of tss struct (processor state) from beginning
|
523 |
|
|
of task struct */
|
524 |
|
|
addl %d1,%a0
|
525 |
|
|
|
526 |
|
|
/* save sr */
|
527 |
|
|
move %sr,%d0
|
528 |
|
|
movew %d0,%a0@(LTSS_SR)
|
529 |
|
|
|
530 |
|
|
/* disable interrupts */
|
531 |
|
|
oril #0x700,%d0
|
532 |
|
|
move %d0,%sr
|
533 |
|
|
|
534 |
|
|
#ifndef NO_MM
|
535 |
|
|
/* save fs (sfc,%dfc) (may be pointing to kernel memory) */
|
536 |
|
|
movec %sfc,%d0
|
537 |
|
|
movew %d0,%a0@(LTSS_FS)
|
538 |
|
|
#endif
|
539 |
|
|
|
540 |
|
|
/* save usp */
|
541 |
|
|
/* it is better to use a movel here instead of a movew 8*) */
|
542 |
|
|
|
543 |
|
|
|
544 |
|
|
/* save non-scratch registers on stack */
|
545 |
|
|
SAVE_SWITCH_STACK
|
546 |
|
|
|
547 |
|
|
/* Use the sw_usp, no real %usp */
|
548 |
|
|
movel sw_usp,%a2 /* usp */
|
549 |
|
|
movel %a2,%a0@(LTSS_USP)
|
550 |
|
|
#if 0
|
551 |
|
|
/* busted */
|
552 |
|
|
movel %usp,%d0 /* usp */
|
553 |
|
|
movel %d0,%a0@(LTSS_USP)
|
554 |
|
|
#endif
|
555 |
|
|
|
556 |
|
|
/* save current kernel stack pointer */
|
557 |
|
|
movel %sp,%a0@(LTSS_KSP)
|
558 |
|
|
|
559 |
|
|
/* get pointer to tss struct (a1 contains new task) */
|
560 |
|
|
movel %a1,SYMBOL_NAME(current_set)
|
561 |
|
|
addl %d1,%a1
|
562 |
|
|
|
563 |
|
|
/* Skip address space switching if they are the same. */
|
564 |
|
|
/* FIXME: what did we hack out of here, this does nothing! */
|
565 |
|
|
#if 0
|
566 |
|
|
tstb %d2
|
567 |
|
|
jne 4f
|
568 |
|
|
#endif
|
569 |
|
|
2:
|
570 |
|
|
4:
|
571 |
|
|
/* restore floating point context */
|
572 |
|
|
|
573 |
|
|
/* restore the kernel stack pointer */
|
574 |
|
|
movel %a1@(LTSS_KSP),%sp
|
575 |
|
|
|
576 |
|
|
/* restore non-scratch registers */
|
577 |
|
|
RESTORE_SWITCH_STACK
|
578 |
|
|
|
579 |
|
|
/* restore user stack pointer */
|
580 |
|
|
movel %a1@(LTSS_USP),%a0
|
581 |
|
|
/* No %usp, use a software copy */
|
582 |
|
|
movel %a0,sw_usp
|
583 |
|
|
|
584 |
|
|
#ifndef NO_MM
|
585 |
|
|
/* restore fs (sfc,%dfc) */
|
586 |
|
|
movew %a1@(LTSS_FS),%a0
|
587 |
|
|
movec %a0,%sfc
|
588 |
|
|
movec %a0,%dfc
|
589 |
|
|
#endif
|
590 |
|
|
|
591 |
|
|
/* restore status register */
|
592 |
|
|
movel %d0,%a0
|
593 |
|
|
move %a1@(LTSS_SR),%d0
|
594 |
|
|
move %d0,%sr
|
595 |
|
|
movel %a0,%d0
|
596 |
|
|
rts
|
597 |
|
|
|
598 |
|
|
.text
|
599 |
|
|
ALIGN
|
600 |
|
|
SYMBOL_NAME_LABEL(sys_call_table)
|
601 |
|
|
.long SYMBOL_NAME(sys_setup) /* 0 */
|
602 |
|
|
.long SYMBOL_NAME(sys_exit)
|
603 |
|
|
.long SYMBOL_NAME(sys_fork)
|
604 |
|
|
.long SYMBOL_NAME(sys_read)
|
605 |
|
|
.long SYMBOL_NAME(sys_write)
|
606 |
|
|
.long SYMBOL_NAME(sys_open) /* 5 */
|
607 |
|
|
.long SYMBOL_NAME(sys_close)
|
608 |
|
|
.long SYMBOL_NAME(sys_waitpid)
|
609 |
|
|
.long SYMBOL_NAME(sys_creat)
|
610 |
|
|
.long SYMBOL_NAME(sys_link)
|
611 |
|
|
.long SYMBOL_NAME(sys_unlink) /* 10 */
|
612 |
|
|
.long SYMBOL_NAME(sys_execve)
|
613 |
|
|
.long SYMBOL_NAME(sys_chdir)
|
614 |
|
|
.long SYMBOL_NAME(sys_time)
|
615 |
|
|
.long SYMBOL_NAME(sys_mknod)
|
616 |
|
|
.long SYMBOL_NAME(sys_chmod) /* 15 */
|
617 |
|
|
.long SYMBOL_NAME(sys_chown)
|
618 |
|
|
.long SYMBOL_NAME(sys_break)
|
619 |
|
|
.long SYMBOL_NAME(sys_stat)
|
620 |
|
|
.long SYMBOL_NAME(sys_lseek)
|
621 |
|
|
.long SYMBOL_NAME(sys_getpid) /* 20 */
|
622 |
|
|
.long SYMBOL_NAME(sys_mount)
|
623 |
|
|
.long SYMBOL_NAME(sys_umount)
|
624 |
|
|
.long SYMBOL_NAME(sys_setuid)
|
625 |
|
|
.long SYMBOL_NAME(sys_getuid)
|
626 |
|
|
.long SYMBOL_NAME(sys_stime) /* 25 */
|
627 |
|
|
.long SYMBOL_NAME(sys_ptrace)
|
628 |
|
|
.long SYMBOL_NAME(sys_alarm)
|
629 |
|
|
.long SYMBOL_NAME(sys_fstat)
|
630 |
|
|
.long SYMBOL_NAME(sys_pause)
|
631 |
|
|
.long SYMBOL_NAME(sys_utime) /* 30 */
|
632 |
|
|
.long SYMBOL_NAME(sys_stty)
|
633 |
|
|
.long SYMBOL_NAME(sys_gtty)
|
634 |
|
|
.long SYMBOL_NAME(sys_access)
|
635 |
|
|
.long SYMBOL_NAME(sys_nice)
|
636 |
|
|
.long SYMBOL_NAME(sys_ftime) /* 35 */
|
637 |
|
|
.long SYMBOL_NAME(sys_sync)
|
638 |
|
|
.long SYMBOL_NAME(sys_kill)
|
639 |
|
|
.long SYMBOL_NAME(sys_rename)
|
640 |
|
|
.long SYMBOL_NAME(sys_mkdir)
|
641 |
|
|
.long SYMBOL_NAME(sys_rmdir) /* 40 */
|
642 |
|
|
.long SYMBOL_NAME(sys_dup)
|
643 |
|
|
.long SYMBOL_NAME(sys_pipe)
|
644 |
|
|
.long SYMBOL_NAME(sys_times)
|
645 |
|
|
.long SYMBOL_NAME(sys_prof)
|
646 |
|
|
.long SYMBOL_NAME(sys_brk) /* 45 */
|
647 |
|
|
.long SYMBOL_NAME(sys_setgid)
|
648 |
|
|
.long SYMBOL_NAME(sys_getgid)
|
649 |
|
|
.long SYMBOL_NAME(sys_signal)
|
650 |
|
|
.long SYMBOL_NAME(sys_geteuid)
|
651 |
|
|
.long SYMBOL_NAME(sys_getegid) /* 50 */
|
652 |
|
|
.long SYMBOL_NAME(sys_acct)
|
653 |
|
|
.long SYMBOL_NAME(sys_phys)
|
654 |
|
|
.long SYMBOL_NAME(sys_lock)
|
655 |
|
|
.long SYMBOL_NAME(sys_ioctl)
|
656 |
|
|
.long SYMBOL_NAME(sys_fcntl) /* 55 */
|
657 |
|
|
.long SYMBOL_NAME(sys_mpx)
|
658 |
|
|
.long SYMBOL_NAME(sys_setpgid)
|
659 |
|
|
.long SYMBOL_NAME(sys_ulimit)
|
660 |
|
|
.long SYMBOL_NAME(sys_olduname)
|
661 |
|
|
.long SYMBOL_NAME(sys_umask) /* 60 */
|
662 |
|
|
.long SYMBOL_NAME(sys_chroot)
|
663 |
|
|
.long SYMBOL_NAME(sys_ustat)
|
664 |
|
|
.long SYMBOL_NAME(sys_dup2)
|
665 |
|
|
.long SYMBOL_NAME(sys_getppid)
|
666 |
|
|
.long SYMBOL_NAME(sys_getpgrp) /* 65 */
|
667 |
|
|
.long SYMBOL_NAME(sys_setsid)
|
668 |
|
|
.long SYMBOL_NAME(sys_sigaction)
|
669 |
|
|
.long SYMBOL_NAME(sys_sgetmask)
|
670 |
|
|
.long SYMBOL_NAME(sys_ssetmask)
|
671 |
|
|
.long SYMBOL_NAME(sys_setreuid) /* 70 */
|
672 |
|
|
.long SYMBOL_NAME(sys_setregid)
|
673 |
|
|
.long SYMBOL_NAME(sys_sigsuspend)
|
674 |
|
|
.long SYMBOL_NAME(sys_sigpending)
|
675 |
|
|
.long SYMBOL_NAME(sys_sethostname)
|
676 |
|
|
.long SYMBOL_NAME(sys_setrlimit) /* 75 */
|
677 |
|
|
.long SYMBOL_NAME(sys_getrlimit)
|
678 |
|
|
.long SYMBOL_NAME(sys_getrusage)
|
679 |
|
|
.long SYMBOL_NAME(sys_gettimeofday)
|
680 |
|
|
.long SYMBOL_NAME(sys_settimeofday)
|
681 |
|
|
.long SYMBOL_NAME(sys_getgroups) /* 80 */
|
682 |
|
|
.long SYMBOL_NAME(sys_setgroups)
|
683 |
|
|
.long SYMBOL_NAME(old_select)
|
684 |
|
|
.long SYMBOL_NAME(sys_symlink)
|
685 |
|
|
.long SYMBOL_NAME(sys_lstat)
|
686 |
|
|
.long SYMBOL_NAME(sys_readlink) /* 85 */
|
687 |
|
|
.long SYMBOL_NAME(sys_uselib)
|
688 |
|
|
.long SYMBOL_NAME(sys_swapon)
|
689 |
|
|
.long SYMBOL_NAME(sys_reboot)
|
690 |
|
|
.long SYMBOL_NAME(old_readdir)
|
691 |
|
|
.long SYMBOL_NAME(old_mmap) /* 90 */
|
692 |
|
|
.long SYMBOL_NAME(sys_munmap)
|
693 |
|
|
.long SYMBOL_NAME(sys_truncate)
|
694 |
|
|
.long SYMBOL_NAME(sys_ftruncate)
|
695 |
|
|
.long SYMBOL_NAME(sys_fchmod)
|
696 |
|
|
.long SYMBOL_NAME(sys_fchown) /* 95 */
|
697 |
|
|
.long SYMBOL_NAME(sys_getpriority)
|
698 |
|
|
.long SYMBOL_NAME(sys_setpriority)
|
699 |
|
|
.long SYMBOL_NAME(sys_profil)
|
700 |
|
|
.long SYMBOL_NAME(sys_statfs)
|
701 |
|
|
.long SYMBOL_NAME(sys_fstatfs) /* 100 */
|
702 |
|
|
.long SYMBOL_NAME(sys_ioperm)
|
703 |
|
|
.long SYMBOL_NAME(sys_socketcall)
|
704 |
|
|
.long SYMBOL_NAME(sys_syslog)
|
705 |
|
|
.long SYMBOL_NAME(sys_setitimer)
|
706 |
|
|
.long SYMBOL_NAME(sys_getitimer) /* 105 */
|
707 |
|
|
.long SYMBOL_NAME(sys_newstat)
|
708 |
|
|
.long SYMBOL_NAME(sys_newlstat)
|
709 |
|
|
.long SYMBOL_NAME(sys_newfstat)
|
710 |
|
|
.long SYMBOL_NAME(sys_uname)
|
711 |
|
|
.long SYMBOL_NAME(sys_ni_syscall) /* iopl for i386 */ /* 110 */
|
712 |
|
|
.long SYMBOL_NAME(sys_vhangup)
|
713 |
|
|
.long SYMBOL_NAME(sys_idle)
|
714 |
|
|
.long SYMBOL_NAME(sys_ni_syscall) /* vm86 for i386 */
|
715 |
|
|
.long SYMBOL_NAME(sys_wait4)
|
716 |
|
|
.long SYMBOL_NAME(sys_swapoff) /* 115 */
|
717 |
|
|
.long SYMBOL_NAME(sys_sysinfo)
|
718 |
|
|
.long SYMBOL_NAME(sys_ipc)
|
719 |
|
|
.long SYMBOL_NAME(sys_fsync)
|
720 |
|
|
.long SYMBOL_NAME(sys_sigreturn)
|
721 |
|
|
.long SYMBOL_NAME(sys_clone) /* 120 */
|
722 |
|
|
.long SYMBOL_NAME(sys_setdomainname)
|
723 |
|
|
.long SYMBOL_NAME(sys_newuname)
|
724 |
|
|
.long SYMBOL_NAME(sys_cacheflush) /* modify_ldt for i386 */
|
725 |
|
|
.long SYMBOL_NAME(sys_adjtimex)
|
726 |
|
|
.long SYMBOL_NAME(sys_mprotect) /* 125 */
|
727 |
|
|
.long SYMBOL_NAME(sys_sigprocmask)
|
728 |
|
|
.long SYMBOL_NAME(sys_create_module)
|
729 |
|
|
.long SYMBOL_NAME(sys_init_module)
|
730 |
|
|
.long SYMBOL_NAME(sys_delete_module)
|
731 |
|
|
.long SYMBOL_NAME(sys_get_kernel_syms) /* 130 */
|
732 |
|
|
.long SYMBOL_NAME(sys_quotactl)
|
733 |
|
|
.long SYMBOL_NAME(sys_getpgid)
|
734 |
|
|
.long SYMBOL_NAME(sys_fchdir)
|
735 |
|
|
.long SYMBOL_NAME(sys_bdflush)
|
736 |
|
|
.long SYMBOL_NAME(sys_sysfs) /* 135 */
|
737 |
|
|
.long SYMBOL_NAME(sys_personality)
|
738 |
|
|
.long SYMBOL_NAME(sys_ni_syscall) /* for afs_syscall */
|
739 |
|
|
.long SYMBOL_NAME(sys_setfsuid)
|
740 |
|
|
.long SYMBOL_NAME(sys_setfsgid)
|
741 |
|
|
.long SYMBOL_NAME(sys_llseek) /* 140 */
|
742 |
|
|
.long SYMBOL_NAME(sys_getdents)
|
743 |
|
|
.long SYMBOL_NAME(sys_select)
|
744 |
|
|
.long SYMBOL_NAME(sys_flock)
|
745 |
|
|
.long SYMBOL_NAME(sys_msync)
|
746 |
|
|
.long SYMBOL_NAME(sys_readv) /* 145 */
|
747 |
|
|
.long SYMBOL_NAME(sys_writev)
|
748 |
|
|
.long SYMBOL_NAME(sys_getsid)
|
749 |
|
|
.long SYMBOL_NAME(sys_fdatasync)
|
750 |
|
|
.long SYMBOL_NAME(sys_sysctl)
|
751 |
|
|
.long SYMBOL_NAME(sys_mlock) /* 150 */
|
752 |
|
|
.long SYMBOL_NAME(sys_munlock)
|
753 |
|
|
.long SYMBOL_NAME(sys_mlockall)
|
754 |
|
|
.long SYMBOL_NAME(sys_munlockall)
|
755 |
|
|
.long SYMBOL_NAME(sys_sched_setparam)
|
756 |
|
|
.long SYMBOL_NAME(sys_sched_getparam) /* 155 */
|
757 |
|
|
.long SYMBOL_NAME(sys_sched_setscheduler)
|
758 |
|
|
.long SYMBOL_NAME(sys_sched_getscheduler)
|
759 |
|
|
.long SYMBOL_NAME(sys_sched_yield)
|
760 |
|
|
.long SYMBOL_NAME(sys_sched_get_priority_max)
|
761 |
|
|
.long SYMBOL_NAME(sys_sched_get_priority_min) /* 160 */
|
762 |
|
|
.long SYMBOL_NAME(sys_sched_rr_get_interval)
|
763 |
|
|
.long SYMBOL_NAME(sys_nanosleep)
|
764 |
|
|
.long SYMBOL_NAME(sys_mremap)
|
765 |
|
|
.space (NR_syscalls-163)*4
|