]>
Commit | Line | Data |
---|---|---|
1394f032 BW |
1 | /* |
2 | * File: arch/blackfin/mach-common/entry.S | |
3 | * Based on: | |
4 | * Author: Linus Torvalds | |
5 | * | |
6 | * Created: ? | |
7 | * Description: contains the system-call and fault low-level handling routines. | |
8 | * This also contains the timer-interrupt handler, as well as all | |
9 | * interrupts and faults that can result in a task-switch. | |
10 | * | |
11 | * Modified: | |
12 | * Copyright 2004-2006 Analog Devices Inc. | |
13 | * | |
14 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | |
15 | * | |
16 | * This program is free software; you can redistribute it and/or modify | |
17 | * it under the terms of the GNU General Public License as published by | |
18 | * the Free Software Foundation; either version 2 of the License, or | |
19 | * (at your option) any later version. | |
20 | * | |
21 | * This program is distributed in the hope that it will be useful, | |
22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
24 | * GNU General Public License for more details. | |
25 | * | |
26 | * You should have received a copy of the GNU General Public License | |
27 | * along with this program; if not, see the file COPYING, or write | |
28 | * to the Free Software Foundation, Inc., | |
29 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
30 | */ | |
31 | ||
2ebcade5 | 32 | /* NOTE: This code handles signal-recognition, which happens every time |
1394f032 BW |
33 | * after a timer-interrupt and after each system call. |
34 | */ | |
35 | ||
9cb07b23 | 36 | #include <linux/init.h> |
1394f032 | 37 | #include <linux/linkage.h> |
1f83b8f1 | 38 | #include <linux/unistd.h> |
1394f032 | 39 | #include <asm/blackfin.h> |
1394f032 BW |
40 | #include <asm/errno.h> |
41 | #include <asm/thread_info.h> /* TIF_NEED_RESCHED */ | |
42 | #include <asm/asm-offsets.h> | |
669b792c | 43 | #include <asm/trace.h> |
1394f032 BW |
44 | |
45 | #include <asm/mach-common/context.S> | |
46 | ||
f0b5d12f MF |
47 | #if defined(CONFIG_BFIN_SCRATCH_REG_RETN) |
48 | # define EX_SCRATCH_REG RETN | |
49 | #elif defined(CONFIG_BFIN_SCRATCH_REG_RETE) | |
50 | # define EX_SCRATCH_REG RETE | |
51 | #else | |
52 | # define EX_SCRATCH_REG CYCLES | |
53 | #endif | |
54 | ||
b3f8b927 RG |
55 | #if ANOMALY_05000281 |
56 | ENTRY(_safe_speculative_execution) | |
57 | NOP; | |
58 | NOP; | |
59 | NOP; | |
60 | jump _safe_speculative_execution; | |
61 | ENDPROC(_safe_speculative_execution) | |
62 | #endif | |
63 | ||
1394f032 BW |
64 | #ifdef CONFIG_EXCPT_IRQ_SYSC_L1 |
65 | .section .l1.text | |
66 | #else | |
67 | .text | |
68 | #endif | |
69 | ||
70 | /* Slightly simplified and streamlined entry point for CPLB misses. | |
71 | * This one does not lower the level to IRQ5, and thus can be used to | |
72 | * patch up CPLB misses on the kernel stack. | |
73 | */ | |
1aafd909 | 74 | #if ANOMALY_05000261 |
f26fbc48 RG |
75 | #define _ex_dviol _ex_workaround_261 |
76 | #define _ex_dmiss _ex_workaround_261 | |
77 | #define _ex_dmult _ex_workaround_261 | |
78 | ||
79 | ENTRY(_ex_workaround_261) | |
1394f032 BW |
80 | /* |
81 | * Work around an anomaly: if we see a new DCPLB fault, return | |
82 | * without doing anything. Then, if we get the same fault again, | |
83 | * handle it. | |
84 | */ | |
f26fbc48 | 85 | P4 = R7; /* Store EXCAUSE */ |
1394f032 BW |
86 | p5.l = _last_cplb_fault_retx; |
87 | p5.h = _last_cplb_fault_retx; | |
88 | r7 = [p5]; | |
89 | r6 = retx; | |
90 | [p5] = r6; | |
91 | cc = r6 == r7; | |
8d6c2420 | 92 | if !cc jump _bfin_return_from_exception; |
1394f032 | 93 | /* fall through */ |
f26fbc48 RG |
94 | R7 = P4; |
95 | R6 = 0x26; /* Data CPLB Miss */ | |
96 | cc = R6 == R7; | |
97 | if cc jump _ex_dcplb_miss (BP); | |
b97b8a99 BS |
98 | R6 = 0x23; /* Data CPLB Miss */ |
99 | cc = R6 == R7; | |
100 | if cc jump _ex_dcplb_viol (BP); | |
f26fbc48 RG |
101 | /* Handle 0x23 Data CPLB Protection Violation |
102 | * and Data CPLB Multiple Hits - Linux Trap Zero | |
103 | */ | |
104 | jump _ex_trap_c; | |
105 | ENDPROC(_ex_workaround_261) | |
106 | ||
b97b8a99 BS |
107 | #else |
108 | #ifdef CONFIG_MPU | |
109 | #define _ex_dviol _ex_dcplb_viol | |
f26fbc48 RG |
110 | #else |
111 | #define _ex_dviol _ex_trap_c | |
b97b8a99 | 112 | #endif |
f26fbc48 RG |
113 | #define _ex_dmiss _ex_dcplb_miss |
114 | #define _ex_dmult _ex_trap_c | |
1394f032 BW |
115 | #endif |
116 | ||
b97b8a99 BS |
117 | |
118 | ENTRY(_ex_dcplb_viol) | |
f26fbc48 RG |
119 | ENTRY(_ex_dcplb_miss) |
120 | ENTRY(_ex_icplb_miss) | |
1394f032 BW |
121 | (R7:6,P5:4) = [sp++]; |
122 | ASTAT = [sp++]; | |
123 | SAVE_ALL_SYS | |
80f31c8a | 124 | DEBUG_HWTRACE_SAVE(p5, r7) |
b97b8a99 BS |
125 | #ifdef CONFIG_MPU |
126 | R0 = SEQSTAT; | |
127 | R1 = SP; | |
128 | sp += -12; | |
129 | call _cplb_hdr; | |
130 | sp += 12; | |
131 | CC = R0 == 0; | |
132 | IF !CC JUMP _handle_bad_cplb; | |
133 | #else | |
1394f032 | 134 | call __cplb_hdr; |
b97b8a99 | 135 | #endif |
80f31c8a | 136 | DEBUG_HWTRACE_RESTORE(p5, r7) |
1394f032 | 137 | RESTORE_ALL_SYS |
f0b5d12f | 138 | SP = EX_SCRATCH_REG; |
1394f032 | 139 | rtx; |
f26fbc48 | 140 | ENDPROC(_ex_icplb_miss) |
1394f032 | 141 | |
1394f032 | 142 | ENTRY(_ex_syscall) |
1394f032 BW |
143 | (R7:6,P5:4) = [sp++]; |
144 | ASTAT = [sp++]; | |
145 | raise 15; /* invoked by TRAP #0, for sys call */ | |
f0b5d12f | 146 | sp = EX_SCRATCH_REG; |
1394f032 | 147 | rtx |
51be24c3 | 148 | ENDPROC(_ex_syscall) |
1394f032 | 149 | |
1394f032 BW |
150 | ENTRY(_ex_soft_bp) |
151 | r7 = retx; | |
152 | r7 += -2; | |
153 | retx = r7; | |
154 | jump.s _ex_trap_c; | |
51be24c3 | 155 | ENDPROC(_ex_soft_bp) |
1394f032 BW |
156 | |
157 | ENTRY(_ex_single_step) | |
158 | r7 = retx; | |
159 | r6 = reti; | |
160 | cc = r7 == r6; | |
8d6c2420 | 161 | if cc jump _bfin_return_from_exception |
1394f032 BW |
162 | r7 = syscfg; |
163 | bitclr (r7, 0); | |
164 | syscfg = R7; | |
165 | ||
166 | p5.l = lo(IPEND); | |
167 | p5.h = hi(IPEND); | |
168 | r6 = [p5]; | |
169 | cc = bittst(r6, 5); | |
170 | if !cc jump _ex_trap_c; | |
171 | p4.l = lo(EVT5); | |
172 | p4.h = hi(EVT5); | |
173 | r6.h = _exception_to_level5; | |
174 | r6.l = _exception_to_level5; | |
175 | r7 = [p4]; | |
176 | cc = r6 == r7; | |
177 | if !cc jump _ex_trap_c; | |
46c87c3c | 178 | ENDPROC(_ex_single_step) |
1394f032 | 179 | |
8d6c2420 | 180 | ENTRY(_bfin_return_from_exception) |
1aafd909 | 181 | #if ANOMALY_05000257 |
8af10b79 MH |
182 | R7=LC0; |
183 | LC0=R7; | |
184 | R7=LC1; | |
185 | LC1=R7; | |
186 | #endif | |
1394f032 BW |
187 | (R7:6,P5:4) = [sp++]; |
188 | ASTAT = [sp++]; | |
f0b5d12f | 189 | sp = EX_SCRATCH_REG; |
1394f032 | 190 | rtx; |
46c87c3c | 191 | ENDPROC(_bfin_return_from_exception) |
1394f032 BW |
192 | |
193 | ENTRY(_handle_bad_cplb) | |
194 | /* To get here, we just tried and failed to change a CPLB | |
195 | * so, handle things in trap_c (C code), by lowering to | |
196 | * IRQ5, just like we normally do. Since this is not a | |
197 | * "normal" return path, we have a do alot of stuff to | |
198 | * the stack to get ready so, we can fall through - we | |
199 | * need to make a CPLB exception look like a normal exception | |
200 | */ | |
201 | ||
1394f032 BW |
202 | RESTORE_ALL_SYS |
203 | [--sp] = ASTAT; | |
80f31c8a | 204 | [--sp] = (R7:6,P5:4); |
1394f032 | 205 | |
1ffe6646 MF |
206 | ENTRY(_ex_replaceable) |
207 | nop; | |
208 | ||
1394f032 | 209 | ENTRY(_ex_trap_c) |
2ebcade5 RG |
210 | /* Make sure we are not in a double fault */ |
211 | p4.l = lo(IPEND); | |
212 | p4.h = hi(IPEND); | |
213 | r7 = [p4]; | |
214 | CC = BITTST (r7, 5); | |
215 | if CC jump _double_fault; | |
216 | ||
1394f032 BW |
217 | /* Call C code (trap_c) to handle the exception, which most |
218 | * likely involves sending a signal to the current process. | |
219 | * To avoid double faults, lower our priority to IRQ5 first. | |
220 | */ | |
221 | P5.h = _exception_to_level5; | |
222 | P5.l = _exception_to_level5; | |
223 | p4.l = lo(EVT5); | |
224 | p4.h = hi(EVT5); | |
225 | [p4] = p5; | |
226 | csync; | |
227 | ||
228 | /* Disable all interrupts, but make sure level 5 is enabled so | |
229 | * we can switch to that level. Save the old mask. */ | |
230 | cli r6; | |
231 | p4.l = _excpt_saved_imask; | |
232 | p4.h = _excpt_saved_imask; | |
233 | [p4] = r6; | |
234 | r6 = 0x3f; | |
235 | sti r6; | |
236 | ||
237 | /* Save the excause into a circular buffer, in case the instruction | |
238 | * which caused this excecptions causes others. | |
239 | */ | |
240 | P5.l = _in_ptr_excause; | |
241 | P5.h = _in_ptr_excause; | |
242 | R7 = [P5]; | |
243 | R7 += 4; | |
244 | R6 = 0xF; | |
245 | R7 = R7 & R6; | |
246 | [P5] = R7; | |
247 | R6.l = _excause_circ_buf; | |
248 | R6.h = _excause_circ_buf; | |
249 | R7 = R7 + R6; | |
250 | p5 = R7; | |
251 | R6 = SEQSTAT; | |
252 | [P5] = R6; | |
253 | ||
1394f032 BW |
254 | (R7:6,P5:4) = [sp++]; |
255 | ASTAT = [sp++]; | |
f0b5d12f | 256 | SP = EX_SCRATCH_REG; |
1394f032 BW |
257 | raise 5; |
258 | rtx; | |
51be24c3 | 259 | ENDPROC(_ex_trap_c) |
1394f032 | 260 | |
2ebcade5 RG |
261 | /* We just realized we got an exception, while we were processing a different |
262 | * exception. This is a unrecoverable event, so crash | |
263 | */ | |
264 | ENTRY(_double_fault) | |
265 | /* Turn caches & protection off, to ensure we don't get any more | |
266 | * double exceptions | |
267 | */ | |
268 | ||
269 | P4.L = LO(IMEM_CONTROL); | |
270 | P4.H = HI(IMEM_CONTROL); | |
271 | ||
272 | R5 = [P4]; /* Control Register*/ | |
273 | BITCLR(R5,ENICPLB_P); | |
274 | SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */ | |
275 | .align 8; | |
276 | [P4] = R5; | |
277 | SSYNC; | |
278 | ||
279 | P4.L = LO(DMEM_CONTROL); | |
280 | P4.H = HI(DMEM_CONTROL); | |
281 | R5 = [P4]; | |
282 | BITCLR(R5,ENDCPLB_P); | |
283 | SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */ | |
284 | .align 8; | |
285 | [P4] = R5; | |
286 | SSYNC; | |
287 | ||
288 | /* Fix up the stack */ | |
289 | (R7:6,P5:4) = [sp++]; | |
290 | ASTAT = [sp++]; | |
291 | SP = EX_SCRATCH_REG; | |
292 | ||
293 | /* We should be out of the exception stack, and back down into | |
294 | * kernel or user space stack | |
295 | */ | |
296 | SAVE_ALL_SYS | |
297 | ||
298 | r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */ | |
299 | SP += -12; | |
300 | call _double_fault_c; | |
301 | SP += 12; | |
302 | .L_double_fault_panic: | |
303 | JUMP .L_double_fault_panic | |
304 | ||
305 | ENDPROC(_double_fault) | |
306 | ||
1394f032 BW |
307 | ENTRY(_exception_to_level5) |
308 | SAVE_ALL_SYS | |
309 | ||
310 | /* Restore interrupt mask. We haven't pushed RETI, so this | |
311 | * doesn't enable interrupts until we return from this handler. */ | |
312 | p4.l = _excpt_saved_imask; | |
313 | p4.h = _excpt_saved_imask; | |
314 | r6 = [p4]; | |
315 | sti r6; | |
316 | ||
317 | /* Restore the hardware error vector. */ | |
318 | P5.h = _evt_ivhw; | |
319 | P5.l = _evt_ivhw; | |
320 | p4.l = lo(EVT5); | |
321 | p4.h = hi(EVT5); | |
322 | [p4] = p5; | |
323 | csync; | |
324 | ||
325 | p2.l = lo(IPEND); | |
326 | p2.h = hi(IPEND); | |
327 | csync; | |
328 | r0 = [p2]; /* Read current IPEND */ | |
329 | [sp + PT_IPEND] = r0; /* Store IPEND */ | |
330 | ||
331 | /* Pop the excause from the circular buffer and push it on the stack | |
332 | * (in the right place - if you change the location of SEQSTAT, you | |
333 | * must change this offset. | |
334 | */ | |
335 | .L_excep_to_5_again: | |
336 | P5.l = _out_ptr_excause; | |
337 | P5.h = _out_ptr_excause; | |
338 | R7 = [P5]; | |
339 | R7 += 4; | |
340 | R6 = 0xF; | |
341 | R7 = R7 & R6; | |
342 | [P5] = R7; | |
343 | R6.l = _excause_circ_buf; | |
344 | R6.h = _excause_circ_buf; | |
345 | R7 = R7 + R6; | |
346 | P5 = R7; | |
347 | R1 = [P5]; | |
6f3ed704 | 348 | [SP + PT_SEQSTAT] = r1; |
1394f032 BW |
349 | |
350 | r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */ | |
351 | SP += -12; | |
352 | call _trap_c; | |
353 | SP += 12; | |
354 | ||
355 | /* See if anything else is in the exception buffer | |
356 | * if there is, process it | |
357 | */ | |
358 | P5.l = _out_ptr_excause; | |
359 | P5.h = _out_ptr_excause; | |
360 | P4.l = _in_ptr_excause; | |
361 | P4.h = _in_ptr_excause; | |
362 | R6 = [P5]; | |
363 | R7 = [P4]; | |
364 | CC = R6 == R7; | |
365 | if ! CC JUMP .L_excep_to_5_again | |
366 | ||
367 | call _ret_from_exception; | |
368 | RESTORE_ALL_SYS | |
369 | rti; | |
51be24c3 | 370 | ENDPROC(_exception_to_level5) |
1394f032 BW |
371 | |
372 | ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/ | |
373 | /* Since the kernel stack can be anywhere, it's not guaranteed to be | |
374 | * covered by a CPLB. Switch to an exception stack; use RETN as a | |
375 | * scratch register (for want of a better option). | |
376 | */ | |
f0b5d12f | 377 | EX_SCRATCH_REG = sp; |
1394f032 BW |
378 | sp.l = _exception_stack_top; |
379 | sp.h = _exception_stack_top; | |
380 | /* Try to deal with syscalls quickly. */ | |
381 | [--sp] = ASTAT; | |
80f31c8a | 382 | [--sp] = (R7:6,P5:4); |
1394f032 BW |
383 | r7 = SEQSTAT; /* reason code is in bit 5:0 */ |
384 | r6.l = lo(SEQSTAT_EXCAUSE); | |
385 | r6.h = hi(SEQSTAT_EXCAUSE); | |
386 | r7 = r7 & r6; | |
1ffe6646 MF |
387 | p5.h = _ex_table; |
388 | p5.l = _ex_table; | |
1394f032 BW |
389 | p4 = r7; |
390 | p5 = p5 + (p4 << 2); | |
391 | p4 = [p5]; | |
392 | jump (p4); | |
393 | ||
394 | .Lbadsys: | |
395 | r7 = -ENOSYS; /* signextending enough */ | |
396 | [sp + PT_R0] = r7; /* return value from system call */ | |
397 | jump .Lsyscall_really_exit; | |
51be24c3 | 398 | ENDPROC(_trap) |
1394f032 BW |
399 | |
400 | ENTRY(_kernel_execve) | |
401 | link SIZEOF_PTREGS; | |
402 | p0 = sp; | |
403 | r3 = SIZEOF_PTREGS / 4; | |
404 | r4 = 0(x); | |
405 | 0: | |
406 | [p0++] = r4; | |
407 | r3 += -1; | |
408 | cc = r3 == 0; | |
409 | if !cc jump 0b (bp); | |
410 | ||
411 | p0 = sp; | |
412 | sp += -16; | |
413 | [sp + 12] = p0; | |
414 | call _do_execve; | |
415 | SP += 16; | |
416 | cc = r0 == 0; | |
417 | if ! cc jump 1f; | |
418 | /* Success. Copy our temporary pt_regs to the top of the kernel | |
419 | * stack and do a normal exception return. | |
420 | */ | |
421 | r1 = sp; | |
422 | r0 = (-KERNEL_STACK_SIZE) (x); | |
423 | r1 = r1 & r0; | |
424 | p2 = r1; | |
425 | p3 = [p2]; | |
426 | r0 = KERNEL_STACK_SIZE - 4 (z); | |
427 | p1 = r0; | |
428 | p1 = p1 + p2; | |
429 | ||
430 | p0 = fp; | |
431 | r4 = [p0--]; | |
432 | r3 = SIZEOF_PTREGS / 4; | |
433 | 0: | |
434 | r4 = [p0--]; | |
435 | [p1--] = r4; | |
436 | r3 += -1; | |
437 | cc = r3 == 0; | |
438 | if ! cc jump 0b (bp); | |
439 | ||
440 | r0 = (KERNEL_STACK_SIZE - SIZEOF_PTREGS) (z); | |
441 | p1 = r0; | |
442 | p1 = p1 + p2; | |
443 | sp = p1; | |
444 | r0 = syscfg; | |
445 | [SP + PT_SYSCFG] = r0; | |
446 | [p3 + (TASK_THREAD + THREAD_KSP)] = sp; | |
447 | ||
448 | RESTORE_CONTEXT; | |
449 | rti; | |
450 | 1: | |
451 | unlink; | |
452 | rts; | |
51be24c3 | 453 | ENDPROC(_kernel_execve) |
1394f032 BW |
454 | |
455 | ENTRY(_system_call) | |
456 | /* Store IPEND */ | |
457 | p2.l = lo(IPEND); | |
458 | p2.h = hi(IPEND); | |
459 | csync; | |
460 | r0 = [p2]; | |
461 | [sp + PT_IPEND] = r0; | |
462 | ||
463 | /* Store RETS for now */ | |
464 | r0 = rets; | |
465 | [sp + PT_RESERVED] = r0; | |
466 | /* Set the stack for the current process */ | |
467 | r7 = sp; | |
468 | r6.l = lo(ALIGN_PAGE_MASK); | |
469 | r6.h = hi(ALIGN_PAGE_MASK); | |
470 | r7 = r7 & r6; /* thread_info */ | |
471 | p2 = r7; | |
472 | p2 = [p2]; | |
473 | ||
474 | [p2+(TASK_THREAD+THREAD_KSP)] = sp; | |
475 | ||
476 | /* Check the System Call */ | |
477 | r7 = __NR_syscall; | |
478 | /* System call number is passed in P0 */ | |
479 | r6 = p0; | |
480 | cc = r6 < r7; | |
481 | if ! cc jump .Lbadsys; | |
482 | ||
483 | /* are we tracing syscalls?*/ | |
484 | r7 = sp; | |
485 | r6.l = lo(ALIGN_PAGE_MASK); | |
486 | r6.h = hi(ALIGN_PAGE_MASK); | |
487 | r7 = r7 & r6; | |
488 | p2 = r7; | |
489 | r7 = [p2+TI_FLAGS]; | |
490 | CC = BITTST(r7,TIF_SYSCALL_TRACE); | |
491 | if CC JUMP _sys_trace; | |
492 | ||
493 | /* Execute the appropriate system call */ | |
494 | ||
495 | p4 = p0; | |
496 | p5.l = _sys_call_table; | |
497 | p5.h = _sys_call_table; | |
498 | p5 = p5 + (p4 << 2); | |
499 | r0 = [sp + PT_R0]; | |
500 | r1 = [sp + PT_R1]; | |
501 | r2 = [sp + PT_R2]; | |
502 | p5 = [p5]; | |
503 | ||
504 | [--sp] = r5; | |
505 | [--sp] = r4; | |
506 | [--sp] = r3; | |
507 | SP += -12; | |
508 | call (p5); | |
509 | SP += 24; | |
510 | [sp + PT_R0] = r0; | |
511 | ||
512 | .Lresume_userspace: | |
513 | r7 = sp; | |
514 | r4.l = lo(ALIGN_PAGE_MASK); | |
515 | r4.h = hi(ALIGN_PAGE_MASK); | |
516 | r7 = r7 & r4; /* thread_info->flags */ | |
517 | p5 = r7; | |
518 | .Lresume_userspace_1: | |
519 | /* Disable interrupts. */ | |
520 | [--sp] = reti; | |
521 | reti = [sp++]; | |
522 | ||
523 | r7 = [p5 + TI_FLAGS]; | |
524 | r4.l = lo(_TIF_WORK_MASK); | |
525 | r4.h = hi(_TIF_WORK_MASK); | |
526 | r7 = r7 & r4; | |
527 | ||
528 | .Lsyscall_resched: | |
529 | cc = BITTST(r7, TIF_NEED_RESCHED); | |
530 | if !cc jump .Lsyscall_sigpending; | |
531 | ||
532 | /* Reenable interrupts. */ | |
533 | [--sp] = reti; | |
534 | r0 = [sp++]; | |
535 | ||
536 | SP += -12; | |
537 | call _schedule; | |
538 | SP += 12; | |
539 | ||
540 | jump .Lresume_userspace_1; | |
541 | ||
542 | .Lsyscall_sigpending: | |
543 | cc = BITTST(r7, TIF_RESTORE_SIGMASK); | |
544 | if cc jump .Lsyscall_do_signals; | |
545 | cc = BITTST(r7, TIF_SIGPENDING); | |
546 | if !cc jump .Lsyscall_really_exit; | |
547 | .Lsyscall_do_signals: | |
548 | /* Reenable interrupts. */ | |
549 | [--sp] = reti; | |
550 | r0 = [sp++]; | |
551 | ||
552 | r0 = sp; | |
553 | SP += -12; | |
554 | call _do_signal; | |
555 | SP += 12; | |
556 | ||
557 | .Lsyscall_really_exit: | |
558 | r5 = [sp + PT_RESERVED]; | |
559 | rets = r5; | |
560 | rts; | |
51be24c3 | 561 | ENDPROC(_system_call) |
1394f032 BW |
562 | |
563 | _sys_trace: | |
564 | call _syscall_trace; | |
565 | ||
566 | /* Execute the appropriate system call */ | |
567 | ||
568 | p4 = [SP + PT_P0]; | |
569 | p5.l = _sys_call_table; | |
570 | p5.h = _sys_call_table; | |
571 | p5 = p5 + (p4 << 2); | |
572 | r0 = [sp + PT_R0]; | |
573 | r1 = [sp + PT_R1]; | |
574 | r2 = [sp + PT_R2]; | |
575 | r3 = [sp + PT_R3]; | |
576 | r4 = [sp + PT_R4]; | |
577 | r5 = [sp + PT_R5]; | |
578 | p5 = [p5]; | |
579 | ||
580 | [--sp] = r5; | |
581 | [--sp] = r4; | |
582 | [--sp] = r3; | |
583 | SP += -12; | |
584 | call (p5); | |
585 | SP += 24; | |
586 | [sp + PT_R0] = r0; | |
587 | ||
588 | call _syscall_trace; | |
589 | jump .Lresume_userspace; | |
51be24c3 | 590 | ENDPROC(_sys_trace) |
1394f032 BW |
591 | |
592 | ENTRY(_resume) | |
593 | /* | |
594 | * Beware - when entering resume, prev (the current task) is | |
595 | * in r0, next (the new task) is in r1. | |
596 | */ | |
597 | p0 = r0; | |
598 | p1 = r1; | |
599 | [--sp] = rets; | |
600 | [--sp] = fp; | |
601 | [--sp] = (r7:4, p5:3); | |
602 | ||
603 | /* save usp */ | |
604 | p2 = usp; | |
605 | [p0+(TASK_THREAD+THREAD_USP)] = p2; | |
606 | ||
607 | /* save current kernel stack pointer */ | |
608 | [p0+(TASK_THREAD+THREAD_KSP)] = sp; | |
609 | ||
610 | /* save program counter */ | |
611 | r1.l = _new_old_task; | |
612 | r1.h = _new_old_task; | |
613 | [p0+(TASK_THREAD+THREAD_PC)] = r1; | |
614 | ||
615 | /* restore the kernel stack pointer */ | |
616 | sp = [p1+(TASK_THREAD+THREAD_KSP)]; | |
617 | ||
618 | /* restore user stack pointer */ | |
619 | p0 = [p1+(TASK_THREAD+THREAD_USP)]; | |
620 | usp = p0; | |
621 | ||
622 | /* restore pc */ | |
623 | p0 = [p1+(TASK_THREAD+THREAD_PC)]; | |
624 | jump (p0); | |
625 | ||
626 | /* | |
627 | * Following code actually lands up in a new (old) task. | |
628 | */ | |
629 | ||
630 | _new_old_task: | |
631 | (r7:4, p5:3) = [sp++]; | |
632 | fp = [sp++]; | |
633 | rets = [sp++]; | |
634 | ||
635 | /* | |
636 | * When we come out of resume, r0 carries "old" task, becuase we are | |
637 | * in "new" task. | |
638 | */ | |
639 | rts; | |
51be24c3 | 640 | ENDPROC(_resume) |
1394f032 BW |
641 | |
642 | ENTRY(_ret_from_exception) | |
643 | p2.l = lo(IPEND); | |
644 | p2.h = hi(IPEND); | |
645 | ||
646 | csync; | |
647 | r0 = [p2]; | |
648 | [sp + PT_IPEND] = r0; | |
649 | ||
650 | 1: | |
d5c4b5e3 | 651 | r2 = LO(~0x37) (Z); |
1394f032 BW |
652 | r0 = r2 & r0; |
653 | cc = r0 == 0; | |
654 | if !cc jump 4f; /* if not return to user mode, get out */ | |
655 | ||
656 | /* Make sure any pending system call or deferred exception | |
657 | * return in ILAT for this process to get executed, otherwise | |
658 | * in case context switch happens, system call of | |
659 | * first process (i.e in ILAT) will be carried | |
660 | * forward to the switched process | |
661 | */ | |
662 | ||
663 | p2.l = lo(ILAT); | |
664 | p2.h = hi(ILAT); | |
665 | r0 = [p2]; | |
666 | r1 = (EVT_IVG14 | EVT_IVG15) (z); | |
667 | r0 = r0 & r1; | |
668 | cc = r0 == 0; | |
669 | if !cc jump 5f; | |
670 | ||
671 | /* Set the stack for the current process */ | |
672 | r7 = sp; | |
673 | r4.l = lo(ALIGN_PAGE_MASK); | |
674 | r4.h = hi(ALIGN_PAGE_MASK); | |
675 | r7 = r7 & r4; /* thread_info->flags */ | |
676 | p5 = r7; | |
677 | r7 = [p5 + TI_FLAGS]; | |
678 | r4.l = lo(_TIF_WORK_MASK); | |
679 | r4.h = hi(_TIF_WORK_MASK); | |
680 | r7 = r7 & r4; | |
681 | cc = r7 == 0; | |
682 | if cc jump 4f; | |
683 | ||
684 | p0.l = lo(EVT15); | |
685 | p0.h = hi(EVT15); | |
686 | p1.l = _schedule_and_signal; | |
687 | p1.h = _schedule_and_signal; | |
688 | [p0] = p1; | |
689 | csync; | |
690 | raise 15; /* raise evt14 to do signal or reschedule */ | |
691 | 4: | |
692 | r0 = syscfg; | |
693 | bitclr(r0, 0); | |
694 | syscfg = r0; | |
695 | 5: | |
696 | rts; | |
51be24c3 | 697 | ENDPROC(_ret_from_exception) |
1394f032 BW |
698 | |
699 | ENTRY(_return_from_int) | |
700 | /* If someone else already raised IRQ 15, do nothing. */ | |
701 | csync; | |
702 | p2.l = lo(ILAT); | |
703 | p2.h = hi(ILAT); | |
704 | r0 = [p2]; | |
705 | cc = bittst (r0, EVT_IVG15_P); | |
706 | if cc jump 2f; | |
707 | ||
708 | /* if not return to user mode, get out */ | |
709 | p2.l = lo(IPEND); | |
710 | p2.h = hi(IPEND); | |
711 | r0 = [p2]; | |
712 | r1 = 0x17(Z); | |
713 | r2 = ~r1; | |
714 | r2.h = 0; | |
715 | r0 = r2 & r0; | |
716 | r1 = 1; | |
717 | r1 = r0 - r1; | |
718 | r2 = r0 & r1; | |
719 | cc = r2 == 0; | |
720 | if !cc jump 2f; | |
721 | ||
722 | /* Lower the interrupt level to 15. */ | |
723 | p0.l = lo(EVT15); | |
724 | p0.h = hi(EVT15); | |
725 | p1.l = _schedule_and_signal_from_int; | |
726 | p1.h = _schedule_and_signal_from_int; | |
727 | [p0] = p1; | |
728 | csync; | |
1aafd909 | 729 | #if ANOMALY_05000281 |
b3f8b927 RG |
730 | r0.l = _safe_speculative_execution; |
731 | r0.h = _safe_speculative_execution; | |
1394f032 BW |
732 | reti = r0; |
733 | #endif | |
734 | r0 = 0x801f (z); | |
735 | STI r0; | |
736 | raise 15; /* raise evt15 to do signal or reschedule */ | |
737 | rti; | |
738 | 2: | |
739 | rts; | |
51be24c3 | 740 | ENDPROC(_return_from_int) |
1394f032 BW |
741 | |
742 | ENTRY(_lower_to_irq14) | |
1aafd909 | 743 | #if ANOMALY_05000281 |
b3f8b927 RG |
744 | r0.l = _safe_speculative_execution; |
745 | r0.h = _safe_speculative_execution; | |
1394f032 BW |
746 | reti = r0; |
747 | #endif | |
748 | r0 = 0x401f; | |
749 | sti r0; | |
750 | raise 14; | |
751 | rti; | |
752 | ENTRY(_evt14_softirq) | |
753 | #ifdef CONFIG_DEBUG_HWERR | |
754 | r0 = 0x3f; | |
755 | sti r0; | |
756 | #else | |
757 | cli r0; | |
758 | #endif | |
759 | [--sp] = RETI; | |
760 | SP += 4; | |
761 | rts; | |
762 | ||
763 | _schedule_and_signal_from_int: | |
764 | /* To end up here, vector 15 was changed - so we have to change it | |
765 | * back. | |
766 | */ | |
767 | p0.l = lo(EVT15); | |
768 | p0.h = hi(EVT15); | |
769 | p1.l = _evt_system_call; | |
770 | p1.h = _evt_system_call; | |
771 | [p0] = p1; | |
772 | csync; | |
c824498d BS |
773 | |
774 | /* Set orig_p0 to -1 to indicate this isn't the end of a syscall. */ | |
775 | r0 = -1 (x); | |
776 | [sp + PT_ORIG_P0] = r0; | |
777 | ||
1394f032 BW |
778 | p1 = rets; |
779 | [sp + PT_RESERVED] = p1; | |
780 | ||
781 | p0.l = _irq_flags; | |
782 | p0.h = _irq_flags; | |
783 | r0 = [p0]; | |
784 | sti r0; | |
785 | ||
7adfb58f BS |
786 | r0 = sp; |
787 | sp += -12; | |
788 | call _finish_atomic_sections; | |
789 | sp += 12; | |
1394f032 BW |
790 | jump.s .Lresume_userspace; |
791 | ||
792 | _schedule_and_signal: | |
793 | SAVE_CONTEXT_SYSCALL | |
794 | /* To end up here, vector 15 was changed - so we have to change it | |
795 | * back. | |
796 | */ | |
797 | p0.l = lo(EVT15); | |
798 | p0.h = hi(EVT15); | |
799 | p1.l = _evt_system_call; | |
800 | p1.h = _evt_system_call; | |
801 | [p0] = p1; | |
802 | csync; | |
803 | p0.l = 1f; | |
804 | p0.h = 1f; | |
805 | [sp + PT_RESERVED] = P0; | |
806 | call .Lresume_userspace; | |
807 | 1: | |
808 | RESTORE_CONTEXT | |
809 | rti; | |
51be24c3 | 810 | ENDPROC(_lower_to_irq14) |
1394f032 BW |
811 | |
812 | /* Make sure when we start, that the circular buffer is initialized properly | |
813 | * R0 and P0 are call clobbered, so we can use them here. | |
814 | */ | |
815 | ENTRY(_init_exception_buff) | |
816 | r0 = 0; | |
817 | p0.h = _in_ptr_excause; | |
818 | p0.l = _in_ptr_excause; | |
819 | [p0] = r0; | |
820 | p0.h = _out_ptr_excause; | |
821 | p0.l = _out_ptr_excause; | |
822 | [p0] = r0; | |
823 | rts; | |
51be24c3 | 824 | ENDPROC(_init_exception_buff) |
1394f032 | 825 | |
518039bc RG |
826 | /* We handle this 100% in exception space - to reduce overhead |
827 | * Only potiential problem is if the software buffer gets swapped out of the | |
828 | * CPLB table - then double fault. - so we don't let this happen in other places | |
829 | */ | |
830 | #ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND | |
831 | ENTRY(_ex_trace_buff_full) | |
832 | [--sp] = P3; | |
833 | [--sp] = P2; | |
834 | [--sp] = LC0; | |
835 | [--sp] = LT0; | |
836 | [--sp] = LB0; | |
837 | P5.L = _trace_buff_offset; | |
838 | P5.H = _trace_buff_offset; | |
839 | P3 = [P5]; /* trace_buff_offset */ | |
840 | P5.L = lo(TBUFSTAT); | |
841 | P5.H = hi(TBUFSTAT); | |
842 | R7 = [P5]; | |
843 | R7 <<= 1; /* double, since we need to read twice */ | |
844 | LC0 = R7; | |
845 | R7 <<= 2; /* need to shift over again, | |
846 | * to get the number of bytes */ | |
847 | P5.L = lo(TBUF); | |
848 | P5.H = hi(TBUF); | |
849 | R6 = ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN)*1024) - 1; | |
850 | ||
851 | P2 = R7; | |
852 | P3 = P3 + P2; | |
853 | R7 = P3; | |
854 | R7 = R7 & R6; | |
855 | P3 = R7; | |
856 | P2.L = _trace_buff_offset; | |
857 | P2.H = _trace_buff_offset; | |
858 | [P2] = P3; | |
859 | ||
860 | P2.L = _software_trace_buff; | |
861 | P2.H = _software_trace_buff; | |
862 | ||
863 | LSETUP (.Lstart, .Lend) LC0; | |
864 | .Lstart: | |
865 | R7 = [P5]; /* read TBUF */ | |
866 | P4 = P3 + P2; | |
867 | [P4] = R7; | |
868 | P3 += -4; | |
869 | R7 = P3; | |
870 | R7 = R7 & R6; | |
871 | .Lend: | |
872 | P3 = R7; | |
873 | ||
874 | LB0 = [sp++]; | |
875 | LT0 = [sp++]; | |
876 | LC0 = [sp++]; | |
877 | P2 = [sp++]; | |
878 | P3 = [sp++]; | |
8d6c2420 | 879 | jump _bfin_return_from_exception; |
337d390b | 880 | ENDPROC(_ex_trace_buff_full) |
518039bc RG |
881 | |
882 | #if CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN == 4 | |
883 | .data | |
884 | #else | |
885 | .section .l1.data.B | |
337d390b | 886 | #endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN */ |
518039bc RG |
887 | ENTRY(_trace_buff_offset) |
888 | .long 0; | |
889 | ALIGN | |
890 | ENTRY(_software_trace_buff) | |
891 | .rept ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN)*256); | |
892 | .long 0 | |
893 | .endr | |
337d390b RG |
894 | #endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND */ |
895 | ||
896 | #if CONFIG_EARLY_PRINTK | |
9cb07b23 | 897 | __INIT |
337d390b RG |
898 | ENTRY(_early_trap) |
899 | SAVE_ALL_SYS | |
900 | trace_buffer_stop(p0,r0); | |
901 | ||
902 | /* Turn caches off, to ensure we don't get double exceptions */ | |
903 | ||
904 | P4.L = LO(IMEM_CONTROL); | |
905 | P4.H = HI(IMEM_CONTROL); | |
906 | ||
907 | R5 = [P4]; /* Control Register*/ | |
908 | BITCLR(R5,ENICPLB_P); | |
909 | CLI R1; | |
910 | SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */ | |
911 | .align 8; | |
912 | [P4] = R5; | |
913 | SSYNC; | |
914 | ||
915 | P4.L = LO(DMEM_CONTROL); | |
916 | P4.H = HI(DMEM_CONTROL); | |
917 | R5 = [P4]; | |
918 | BITCLR(R5,ENDCPLB_P); | |
919 | SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */ | |
920 | .align 8; | |
921 | [P4] = R5; | |
922 | SSYNC; | |
923 | STI R1; | |
924 | ||
925 | r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */ | |
926 | r1 = RETX; | |
927 | ||
928 | SP += -12; | |
929 | call _early_trap_c; | |
930 | SP += 12; | |
931 | ENDPROC(_early_trap) | |
9cb07b23 | 932 | __FINIT |
337d390b | 933 | #endif /* CONFIG_EARLY_PRINTK */ |
518039bc | 934 | |
1394f032 BW |
935 | /* |
936 | * Put these in the kernel data section - that should always be covered by | |
937 | * a CPLB. This is needed to ensure we don't get double fault conditions | |
938 | */ | |
939 | ||
940 | #ifdef CONFIG_SYSCALL_TAB_L1 | |
941 | .section .l1.data | |
942 | #else | |
943 | .data | |
944 | #endif | |
f26fbc48 | 945 | |
1ffe6646 | 946 | ENTRY(_ex_table) |
1394f032 | 947 | /* entry for each EXCAUSE[5:0] |
9401e618 | 948 | * This table must be in sync with the table in ./kernel/traps.c |
1394f032 BW |
949 | * EXCPT instruction can provide 4 bits of EXCAUSE, allowing 16 to be user defined |
950 | */ | |
1ffe6646 | 951 | .long _ex_syscall /* 0x00 - User Defined - Linux Syscall */ |
1394f032 | 952 | .long _ex_soft_bp /* 0x01 - User Defined - Software breakpoint */ |
1ffe6646 | 953 | .long _ex_replaceable /* 0x02 - User Defined */ |
9401e618 | 954 | .long _ex_trap_c /* 0x03 - User Defined - userspace stack overflow */ |
9f336a53 | 955 | .long _ex_trap_c /* 0x04 - User Defined - dump trace buffer */ |
1ffe6646 MF |
956 | .long _ex_replaceable /* 0x05 - User Defined */ |
957 | .long _ex_replaceable /* 0x06 - User Defined */ | |
958 | .long _ex_replaceable /* 0x07 - User Defined */ | |
959 | .long _ex_replaceable /* 0x08 - User Defined */ | |
960 | .long _ex_replaceable /* 0x09 - User Defined */ | |
961 | .long _ex_replaceable /* 0x0A - User Defined */ | |
962 | .long _ex_replaceable /* 0x0B - User Defined */ | |
963 | .long _ex_replaceable /* 0x0C - User Defined */ | |
964 | .long _ex_replaceable /* 0x0D - User Defined */ | |
965 | .long _ex_replaceable /* 0x0E - User Defined */ | |
966 | .long _ex_replaceable /* 0x0F - User Defined */ | |
1394f032 | 967 | .long _ex_single_step /* 0x10 - HW Single step */ |
518039bc RG |
968 | #ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND |
969 | .long _ex_trace_buff_full /* 0x11 - Trace Buffer Full */ | |
970 | #else | |
1394f032 | 971 | .long _ex_trap_c /* 0x11 - Trace Buffer Full */ |
518039bc | 972 | #endif |
1394f032 BW |
973 | .long _ex_trap_c /* 0x12 - Reserved */ |
974 | .long _ex_trap_c /* 0x13 - Reserved */ | |
975 | .long _ex_trap_c /* 0x14 - Reserved */ | |
976 | .long _ex_trap_c /* 0x15 - Reserved */ | |
977 | .long _ex_trap_c /* 0x16 - Reserved */ | |
978 | .long _ex_trap_c /* 0x17 - Reserved */ | |
979 | .long _ex_trap_c /* 0x18 - Reserved */ | |
980 | .long _ex_trap_c /* 0x19 - Reserved */ | |
981 | .long _ex_trap_c /* 0x1A - Reserved */ | |
982 | .long _ex_trap_c /* 0x1B - Reserved */ | |
983 | .long _ex_trap_c /* 0x1C - Reserved */ | |
984 | .long _ex_trap_c /* 0x1D - Reserved */ | |
985 | .long _ex_trap_c /* 0x1E - Reserved */ | |
986 | .long _ex_trap_c /* 0x1F - Reserved */ | |
987 | .long _ex_trap_c /* 0x20 - Reserved */ | |
988 | .long _ex_trap_c /* 0x21 - Undefined Instruction */ | |
989 | .long _ex_trap_c /* 0x22 - Illegal Instruction Combination */ | |
f26fbc48 | 990 | .long _ex_dviol /* 0x23 - Data CPLB Protection Violation */ |
1394f032 BW |
991 | .long _ex_trap_c /* 0x24 - Data access misaligned */ |
992 | .long _ex_trap_c /* 0x25 - Unrecoverable Event */ | |
f26fbc48 RG |
993 | .long _ex_dmiss /* 0x26 - Data CPLB Miss */ |
994 | .long _ex_dmult /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero */ | |
1394f032 BW |
995 | .long _ex_trap_c /* 0x28 - Emulation Watchpoint */ |
996 | .long _ex_trap_c /* 0x29 - Instruction fetch access error (535 only) */ | |
997 | .long _ex_trap_c /* 0x2A - Instruction fetch misaligned */ | |
f26fbc48 RG |
998 | .long _ex_trap_c /* 0x2B - Instruction CPLB protection Violation */ |
999 | .long _ex_icplb_miss /* 0x2C - Instruction CPLB miss */ | |
1394f032 BW |
1000 | .long _ex_trap_c /* 0x2D - Instruction CPLB Multiple Hits */ |
1001 | .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */ | |
1002 | .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */ | |
1003 | .long _ex_trap_c /* 0x2F - Reserved */ | |
1004 | .long _ex_trap_c /* 0x30 - Reserved */ | |
1005 | .long _ex_trap_c /* 0x31 - Reserved */ | |
1006 | .long _ex_trap_c /* 0x32 - Reserved */ | |
1007 | .long _ex_trap_c /* 0x33 - Reserved */ | |
1008 | .long _ex_trap_c /* 0x34 - Reserved */ | |
1009 | .long _ex_trap_c /* 0x35 - Reserved */ | |
1010 | .long _ex_trap_c /* 0x36 - Reserved */ | |
1011 | .long _ex_trap_c /* 0x37 - Reserved */ | |
1012 | .long _ex_trap_c /* 0x38 - Reserved */ | |
1013 | .long _ex_trap_c /* 0x39 - Reserved */ | |
1014 | .long _ex_trap_c /* 0x3A - Reserved */ | |
1015 | .long _ex_trap_c /* 0x3B - Reserved */ | |
1016 | .long _ex_trap_c /* 0x3C - Reserved */ | |
1017 | .long _ex_trap_c /* 0x3D - Reserved */ | |
1018 | .long _ex_trap_c /* 0x3E - Reserved */ | |
1019 | .long _ex_trap_c /* 0x3F - Reserved */ | |
1ffe6646 | 1020 | END(_ex_table) |
1394f032 | 1021 | |
1394f032 | 1022 | ENTRY(_sys_call_table) |
0b95f22b | 1023 | .long _sys_restart_syscall /* 0 */ |
1394f032 BW |
1024 | .long _sys_exit |
1025 | .long _sys_fork | |
1026 | .long _sys_read | |
1027 | .long _sys_write | |
1028 | .long _sys_open /* 5 */ | |
1029 | .long _sys_close | |
1030 | .long _sys_ni_syscall /* old waitpid */ | |
1031 | .long _sys_creat | |
1032 | .long _sys_link | |
1033 | .long _sys_unlink /* 10 */ | |
1034 | .long _sys_execve | |
1035 | .long _sys_chdir | |
1036 | .long _sys_time | |
1037 | .long _sys_mknod | |
1038 | .long _sys_chmod /* 15 */ | |
1039 | .long _sys_chown /* chown16 */ | |
1040 | .long _sys_ni_syscall /* old break syscall holder */ | |
1041 | .long _sys_ni_syscall /* old stat */ | |
1042 | .long _sys_lseek | |
1043 | .long _sys_getpid /* 20 */ | |
1044 | .long _sys_mount | |
1045 | .long _sys_ni_syscall /* old umount */ | |
1046 | .long _sys_setuid | |
1047 | .long _sys_getuid | |
1048 | .long _sys_stime /* 25 */ | |
1049 | .long _sys_ptrace | |
1050 | .long _sys_alarm | |
1051 | .long _sys_ni_syscall /* old fstat */ | |
1052 | .long _sys_pause | |
1053 | .long _sys_ni_syscall /* old utime */ /* 30 */ | |
1054 | .long _sys_ni_syscall /* old stty syscall holder */ | |
1055 | .long _sys_ni_syscall /* old gtty syscall holder */ | |
1056 | .long _sys_access | |
1057 | .long _sys_nice | |
1058 | .long _sys_ni_syscall /* 35 */ /* old ftime syscall holder */ | |
1059 | .long _sys_sync | |
1060 | .long _sys_kill | |
1061 | .long _sys_rename | |
1062 | .long _sys_mkdir | |
1063 | .long _sys_rmdir /* 40 */ | |
1064 | .long _sys_dup | |
1065 | .long _sys_pipe | |
1066 | .long _sys_times | |
1067 | .long _sys_ni_syscall /* old prof syscall holder */ | |
1068 | .long _sys_brk /* 45 */ | |
1069 | .long _sys_setgid | |
1070 | .long _sys_getgid | |
1071 | .long _sys_ni_syscall /* old sys_signal */ | |
1072 | .long _sys_geteuid /* geteuid16 */ | |
1073 | .long _sys_getegid /* getegid16 */ /* 50 */ | |
1074 | .long _sys_acct | |
1075 | .long _sys_umount /* recycled never used phys() */ | |
1076 | .long _sys_ni_syscall /* old lock syscall holder */ | |
1077 | .long _sys_ioctl | |
1078 | .long _sys_fcntl /* 55 */ | |
1079 | .long _sys_ni_syscall /* old mpx syscall holder */ | |
1080 | .long _sys_setpgid | |
1081 | .long _sys_ni_syscall /* old ulimit syscall holder */ | |
1082 | .long _sys_ni_syscall /* old old uname */ | |
1083 | .long _sys_umask /* 60 */ | |
1084 | .long _sys_chroot | |
1085 | .long _sys_ustat | |
1086 | .long _sys_dup2 | |
1087 | .long _sys_getppid | |
1088 | .long _sys_getpgrp /* 65 */ | |
1089 | .long _sys_setsid | |
1090 | .long _sys_ni_syscall /* old sys_sigaction */ | |
1091 | .long _sys_sgetmask | |
1092 | .long _sys_ssetmask | |
1093 | .long _sys_setreuid /* setreuid16 */ /* 70 */ | |
1094 | .long _sys_setregid /* setregid16 */ | |
1095 | .long _sys_ni_syscall /* old sys_sigsuspend */ | |
1096 | .long _sys_ni_syscall /* old sys_sigpending */ | |
1097 | .long _sys_sethostname | |
1098 | .long _sys_setrlimit /* 75 */ | |
1099 | .long _sys_ni_syscall /* old getrlimit */ | |
1100 | .long _sys_getrusage | |
1101 | .long _sys_gettimeofday | |
1102 | .long _sys_settimeofday | |
1103 | .long _sys_getgroups /* getgroups16 */ /* 80 */ | |
1104 | .long _sys_setgroups /* setgroups16 */ | |
1105 | .long _sys_ni_syscall /* old_select */ | |
1106 | .long _sys_symlink | |
1107 | .long _sys_ni_syscall /* old lstat */ | |
1108 | .long _sys_readlink /* 85 */ | |
1109 | .long _sys_uselib | |
1110 | .long _sys_ni_syscall /* sys_swapon */ | |
1111 | .long _sys_reboot | |
1112 | .long _sys_ni_syscall /* old_readdir */ | |
1113 | .long _sys_ni_syscall /* sys_mmap */ /* 90 */ | |
1114 | .long _sys_munmap | |
1115 | .long _sys_truncate | |
1116 | .long _sys_ftruncate | |
1117 | .long _sys_fchmod | |
1118 | .long _sys_fchown /* fchown16 */ /* 95 */ | |
1119 | .long _sys_getpriority | |
1120 | .long _sys_setpriority | |
1121 | .long _sys_ni_syscall /* old profil syscall holder */ | |
1122 | .long _sys_statfs | |
1123 | .long _sys_fstatfs /* 100 */ | |
1124 | .long _sys_ni_syscall | |
1125 | .long _sys_ni_syscall /* old sys_socketcall */ | |
1126 | .long _sys_syslog | |
1127 | .long _sys_setitimer | |
1128 | .long _sys_getitimer /* 105 */ | |
1129 | .long _sys_newstat | |
1130 | .long _sys_newlstat | |
1131 | .long _sys_newfstat | |
1132 | .long _sys_ni_syscall /* old uname */ | |
1133 | .long _sys_ni_syscall /* iopl for i386 */ /* 110 */ | |
1134 | .long _sys_vhangup | |
1135 | .long _sys_ni_syscall /* obsolete idle() syscall */ | |
1136 | .long _sys_ni_syscall /* vm86old for i386 */ | |
1137 | .long _sys_wait4 | |
1138 | .long _sys_ni_syscall /* 115 */ /* sys_swapoff */ | |
1139 | .long _sys_sysinfo | |
1140 | .long _sys_ni_syscall /* old sys_ipc */ | |
1141 | .long _sys_fsync | |
1142 | .long _sys_ni_syscall /* old sys_sigreturn */ | |
1143 | .long _sys_clone /* 120 */ | |
1144 | .long _sys_setdomainname | |
1145 | .long _sys_newuname | |
1146 | .long _sys_ni_syscall /* old sys_modify_ldt */ | |
1147 | .long _sys_adjtimex | |
1148 | .long _sys_ni_syscall /* 125 */ /* sys_mprotect */ | |
1149 | .long _sys_ni_syscall /* old sys_sigprocmask */ | |
1150 | .long _sys_ni_syscall /* old "creat_module" */ | |
1151 | .long _sys_init_module | |
1152 | .long _sys_delete_module | |
1153 | .long _sys_ni_syscall /* 130: old "get_kernel_syms" */ | |
1154 | .long _sys_quotactl | |
1155 | .long _sys_getpgid | |
1156 | .long _sys_fchdir | |
1157 | .long _sys_bdflush | |
1158 | .long _sys_ni_syscall /* 135 */ /* sys_sysfs */ | |
1159 | .long _sys_personality | |
1160 | .long _sys_ni_syscall /* for afs_syscall */ | |
1161 | .long _sys_setfsuid /* setfsuid16 */ | |
1162 | .long _sys_setfsgid /* setfsgid16 */ | |
1163 | .long _sys_llseek /* 140 */ | |
1164 | .long _sys_getdents | |
1165 | .long _sys_ni_syscall /* sys_select */ | |
1166 | .long _sys_flock | |
1167 | .long _sys_ni_syscall /* sys_msync */ | |
1168 | .long _sys_readv /* 145 */ | |
1169 | .long _sys_writev | |
1170 | .long _sys_getsid | |
1171 | .long _sys_fdatasync | |
1172 | .long _sys_sysctl | |
1173 | .long _sys_ni_syscall /* 150 */ /* sys_mlock */ | |
1174 | .long _sys_ni_syscall /* sys_munlock */ | |
1175 | .long _sys_ni_syscall /* sys_mlockall */ | |
1176 | .long _sys_ni_syscall /* sys_munlockall */ | |
1177 | .long _sys_sched_setparam | |
1178 | .long _sys_sched_getparam /* 155 */ | |
1179 | .long _sys_sched_setscheduler | |
1180 | .long _sys_sched_getscheduler | |
1181 | .long _sys_sched_yield | |
1182 | .long _sys_sched_get_priority_max | |
1183 | .long _sys_sched_get_priority_min /* 160 */ | |
1184 | .long _sys_sched_rr_get_interval | |
1185 | .long _sys_nanosleep | |
0b95f22b | 1186 | .long _sys_mremap |
1394f032 BW |
1187 | .long _sys_setresuid /* setresuid16 */ |
1188 | .long _sys_getresuid /* getresuid16 */ /* 165 */ | |
1189 | .long _sys_ni_syscall /* for vm86 */ | |
1190 | .long _sys_ni_syscall /* old "query_module" */ | |
1191 | .long _sys_ni_syscall /* sys_poll */ | |
0b95f22b | 1192 | .long _sys_nfsservctl |
1394f032 BW |
1193 | .long _sys_setresgid /* setresgid16 */ /* 170 */ |
1194 | .long _sys_getresgid /* getresgid16 */ | |
1195 | .long _sys_prctl | |
1196 | .long _sys_rt_sigreturn | |
1197 | .long _sys_rt_sigaction | |
1198 | .long _sys_rt_sigprocmask /* 175 */ | |
1199 | .long _sys_rt_sigpending | |
1200 | .long _sys_rt_sigtimedwait | |
1201 | .long _sys_rt_sigqueueinfo | |
1202 | .long _sys_rt_sigsuspend | |
1203 | .long _sys_pread64 /* 180 */ | |
1204 | .long _sys_pwrite64 | |
1205 | .long _sys_lchown /* lchown16 */ | |
1206 | .long _sys_getcwd | |
1207 | .long _sys_capget | |
1208 | .long _sys_capset /* 185 */ | |
1209 | .long _sys_sigaltstack | |
1210 | .long _sys_sendfile | |
1211 | .long _sys_ni_syscall /* streams1 */ | |
1212 | .long _sys_ni_syscall /* streams2 */ | |
1213 | .long _sys_vfork /* 190 */ | |
1214 | .long _sys_getrlimit | |
1215 | .long _sys_mmap2 | |
1216 | .long _sys_truncate64 | |
1217 | .long _sys_ftruncate64 | |
1218 | .long _sys_stat64 /* 195 */ | |
1219 | .long _sys_lstat64 | |
1220 | .long _sys_fstat64 | |
1221 | .long _sys_chown | |
1222 | .long _sys_getuid | |
1223 | .long _sys_getgid /* 200 */ | |
1224 | .long _sys_geteuid | |
1225 | .long _sys_getegid | |
1226 | .long _sys_setreuid | |
1227 | .long _sys_setregid | |
1228 | .long _sys_getgroups /* 205 */ | |
1229 | .long _sys_setgroups | |
1230 | .long _sys_fchown | |
1231 | .long _sys_setresuid | |
1232 | .long _sys_getresuid | |
1233 | .long _sys_setresgid /* 210 */ | |
1234 | .long _sys_getresgid | |
1235 | .long _sys_lchown | |
1236 | .long _sys_setuid | |
1237 | .long _sys_setgid | |
1238 | .long _sys_setfsuid /* 215 */ | |
1239 | .long _sys_setfsgid | |
1240 | .long _sys_pivot_root | |
1241 | .long _sys_ni_syscall /* sys_mincore */ | |
1242 | .long _sys_ni_syscall /* sys_madvise */ | |
1243 | .long _sys_getdents64 /* 220 */ | |
1244 | .long _sys_fcntl64 | |
1245 | .long _sys_ni_syscall /* reserved for TUX */ | |
1246 | .long _sys_ni_syscall | |
1247 | .long _sys_gettid | |
0b95f22b | 1248 | .long _sys_readahead /* 225 */ |
1394f032 BW |
1249 | .long _sys_setxattr |
1250 | .long _sys_lsetxattr | |
1251 | .long _sys_fsetxattr | |
1252 | .long _sys_getxattr | |
1253 | .long _sys_lgetxattr /* 230 */ | |
1254 | .long _sys_fgetxattr | |
1255 | .long _sys_listxattr | |
1256 | .long _sys_llistxattr | |
1257 | .long _sys_flistxattr | |
1258 | .long _sys_removexattr /* 235 */ | |
1259 | .long _sys_lremovexattr | |
1260 | .long _sys_fremovexattr | |
1261 | .long _sys_tkill | |
1262 | .long _sys_sendfile64 | |
1263 | .long _sys_futex /* 240 */ | |
1264 | .long _sys_sched_setaffinity | |
1265 | .long _sys_sched_getaffinity | |
1266 | .long _sys_ni_syscall /* sys_set_thread_area */ | |
1267 | .long _sys_ni_syscall /* sys_get_thread_area */ | |
1268 | .long _sys_io_setup /* 245 */ | |
1269 | .long _sys_io_destroy | |
1270 | .long _sys_io_getevents | |
1271 | .long _sys_io_submit | |
1272 | .long _sys_io_cancel | |
1273 | .long _sys_ni_syscall /* 250 */ /* sys_alloc_hugepages */ | |
1274 | .long _sys_ni_syscall /* sys_freec_hugepages */ | |
1275 | .long _sys_exit_group | |
1276 | .long _sys_lookup_dcookie | |
1277 | .long _sys_bfin_spinlock | |
1278 | .long _sys_epoll_create /* 255 */ | |
1279 | .long _sys_epoll_ctl | |
1280 | .long _sys_epoll_wait | |
1281 | .long _sys_ni_syscall /* remap_file_pages */ | |
1282 | .long _sys_set_tid_address | |
1283 | .long _sys_timer_create /* 260 */ | |
1284 | .long _sys_timer_settime | |
1285 | .long _sys_timer_gettime | |
1286 | .long _sys_timer_getoverrun | |
1287 | .long _sys_timer_delete | |
1288 | .long _sys_clock_settime /* 265 */ | |
1289 | .long _sys_clock_gettime | |
1290 | .long _sys_clock_getres | |
1291 | .long _sys_clock_nanosleep | |
1292 | .long _sys_statfs64 | |
1293 | .long _sys_fstatfs64 /* 270 */ | |
1294 | .long _sys_tgkill | |
1295 | .long _sys_utimes | |
1296 | .long _sys_fadvise64_64 | |
1297 | .long _sys_ni_syscall /* vserver */ | |
1298 | .long _sys_ni_syscall /* 275, mbind */ | |
1299 | .long _sys_ni_syscall /* get_mempolicy */ | |
1300 | .long _sys_ni_syscall /* set_mempolicy */ | |
1301 | .long _sys_mq_open | |
1302 | .long _sys_mq_unlink | |
1303 | .long _sys_mq_timedsend /* 280 */ | |
1304 | .long _sys_mq_timedreceive | |
1305 | .long _sys_mq_notify | |
1306 | .long _sys_mq_getsetattr | |
1307 | .long _sys_ni_syscall /* kexec_load */ | |
1308 | .long _sys_waitid /* 285 */ | |
1309 | .long _sys_add_key | |
1310 | .long _sys_request_key | |
1311 | .long _sys_keyctl | |
1312 | .long _sys_ioprio_set | |
1313 | .long _sys_ioprio_get /* 290 */ | |
1314 | .long _sys_inotify_init | |
1315 | .long _sys_inotify_add_watch | |
1316 | .long _sys_inotify_rm_watch | |
1317 | .long _sys_ni_syscall /* migrate_pages */ | |
1318 | .long _sys_openat /* 295 */ | |
1319 | .long _sys_mkdirat | |
1320 | .long _sys_mknodat | |
1321 | .long _sys_fchownat | |
1322 | .long _sys_futimesat | |
1323 | .long _sys_fstatat64 /* 300 */ | |
1324 | .long _sys_unlinkat | |
1325 | .long _sys_renameat | |
1326 | .long _sys_linkat | |
1327 | .long _sys_symlinkat | |
1328 | .long _sys_readlinkat /* 305 */ | |
1329 | .long _sys_fchmodat | |
1330 | .long _sys_faccessat | |
1331 | .long _sys_pselect6 | |
1332 | .long _sys_ppoll | |
1333 | .long _sys_unshare /* 310 */ | |
1334 | .long _sys_sram_alloc | |
1335 | .long _sys_sram_free | |
1336 | .long _sys_dma_memcpy | |
1337 | .long _sys_accept | |
1338 | .long _sys_bind /* 315 */ | |
1339 | .long _sys_connect | |
1340 | .long _sys_getpeername | |
1341 | .long _sys_getsockname | |
1342 | .long _sys_getsockopt | |
1343 | .long _sys_listen /* 320 */ | |
1344 | .long _sys_recv | |
1345 | .long _sys_recvfrom | |
1346 | .long _sys_recvmsg | |
1347 | .long _sys_send | |
1348 | .long _sys_sendmsg /* 325 */ | |
1349 | .long _sys_sendto | |
1350 | .long _sys_setsockopt | |
1351 | .long _sys_shutdown | |
1352 | .long _sys_socket | |
1353 | .long _sys_socketpair /* 330 */ | |
1354 | .long _sys_semctl | |
1355 | .long _sys_semget | |
1356 | .long _sys_semop | |
1357 | .long _sys_msgctl | |
1358 | .long _sys_msgget /* 335 */ | |
1359 | .long _sys_msgrcv | |
1360 | .long _sys_msgsnd | |
1361 | .long _sys_shmat | |
1362 | .long _sys_shmctl | |
1363 | .long _sys_shmdt /* 340 */ | |
1364 | .long _sys_shmget | |
0b95f22b BW |
1365 | .long _sys_splice |
1366 | .long _sys_sync_file_range | |
1367 | .long _sys_tee | |
1368 | .long _sys_vmsplice /* 345 */ | |
1369 | .long _sys_epoll_pwait | |
1370 | .long _sys_utimensat | |
1371 | .long _sys_signalfd | |
4d672e7a | 1372 | .long _sys_ni_syscall |
0b95f22b BW |
1373 | .long _sys_eventfd /* 350 */ |
1374 | .long _sys_pread64 | |
1375 | .long _sys_pwrite64 | |
1376 | .long _sys_fadvise64 | |
1377 | .long _sys_set_robust_list | |
1378 | .long _sys_get_robust_list /* 355 */ | |
1379 | .long _sys_fallocate | |
fc97551d | 1380 | .long _sys_semtimedop |
1394f032 BW |
1381 | .rept NR_syscalls-(.-_sys_call_table)/4 |
1382 | .long _sys_ni_syscall | |
1383 | .endr | |
1384 | _excpt_saved_imask: | |
1385 | .long 0; | |
1386 | ||
1387 | _exception_stack: | |
1388 | .rept 1024 | |
1389 | .long 0; | |
1390 | .endr | |
1391 | _exception_stack_top: | |
1392 | ||
1aafd909 | 1393 | #if ANOMALY_05000261 |
1394f032 BW |
1394 | /* Used by the assembly entry point to work around an anomaly. */ |
1395 | _last_cplb_fault_retx: | |
1396 | .long 0; | |
1397 | #endif | |
1398 | /* | |
1399 | * Single instructions can have multiple faults, which need to be | |
1400 | * handled by traps.c, in irq5. We store the exception cause to ensure | |
1401 | * we don't miss a double fault condition | |
1402 | */ | |
1403 | ENTRY(_in_ptr_excause) | |
1404 | .long 0; | |
1405 | ENTRY(_out_ptr_excause) | |
1406 | .long 0; | |
1407 | ALIGN | |
1408 | ENTRY(_excause_circ_buf) | |
1409 | .rept 4 | |
1410 | .long 0 | |
1411 | .endr |