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