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