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