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