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