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