Commit | Line | Data |
---|---|---|
51533b61 MS |
1 | /* |
2 | * Copyright (C) 2000-2003 Axis Communications AB | |
3 | * | |
4 | * Authors: Bjorn Wesen (bjornw@axis.com) | |
5 | * Tobias Anderberg (tobiasa@axis.com), CRISv32 port. | |
6 | * | |
7 | * Code for the system-call and fault low-level handling routines. | |
8 | * | |
9 | * NOTE: This code handles signal-recognition, which happens every time | |
10 | * after a timer-interrupt and after each system call. | |
11 | * | |
12 | * Stack layout in 'ret_from_system_call': | |
ffc8b00d | 13 | * ptrace needs to have all regs on the stack. |
51533b61 MS |
14 | * if the order here is changed, it needs to be |
15 | * updated in fork.c:copy_process, signal.c:do_signal, | |
16 | * ptrace.c and ptrace.h | |
17 | * | |
18 | */ | |
19 | ||
51533b61 MS |
20 | #include <linux/linkage.h> |
21 | #include <linux/sys.h> | |
22 | #include <asm/unistd.h> | |
23 | #include <asm/errno.h> | |
24 | #include <asm/thread_info.h> | |
5a077369 | 25 | #include <asm/asm-offsets.h> |
51533b61 | 26 | |
556dcee7 JN |
27 | #include <hwregs/asm/reg_map_asm.h> |
28 | #include <hwregs/asm/intr_vect_defs_asm.h> | |
51533b61 MS |
29 | |
30 | ;; Exported functions. | |
31 | .globl system_call | |
32 | .globl ret_from_intr | |
33 | .globl ret_from_fork | |
69b58a67 | 34 | .globl ret_from_kernel_thread |
51533b61 MS |
35 | .globl resume |
36 | .globl multiple_interrupt | |
37 | .globl nmi_interrupt | |
38 | .globl spurious_interrupt | |
39 | .globl do_sigtrap | |
40 | .globl gdb_handle_exception | |
41 | .globl sys_call_table | |
42 | ||
43 | ; Check if preemptive kernel scheduling should be done. | |
44 | #ifdef CONFIG_PREEMPT | |
45 | _resume_kernel: | |
46 | di | |
47 | ; Load current task struct. | |
48 | movs.w -8192, $r0 ; THREAD_SIZE = 8192 | |
49 | and.d $sp, $r0 | |
50 | ||
51 | addoq +TI_preempt_count, $r0, $acr | |
52 | move.d [$acr], $r10 ; Preemption disabled? | |
53 | bne _Rexit | |
54 | nop | |
55 | ||
56 | _need_resched: | |
57 | addoq +TI_flags, $r0, $acr | |
58 | move.d [$acr], $r10 | |
59 | btstq TIF_NEED_RESCHED, $r10 ; Check if need_resched is set. | |
60 | bpl _Rexit | |
61 | nop | |
62 | ||
63 | ; Do preemptive kernel scheduling. | |
64 | jsr preempt_schedule_irq | |
65 | nop | |
66 | ||
67 | ; Load new task struct. | |
68 | movs.w -8192, $r0 ; THREAD_SIZE = 8192. | |
69 | and.d $sp, $r0 | |
70 | ||
71 | ; One more time with new task. | |
72 | ba _need_resched | |
73 | nop | |
74 | #else | |
75 | #define _resume_kernel _Rexit | |
76 | #endif | |
77 | ||
78 | ; Called at exit from fork. schedule_tail must be called to drop | |
79 | ; spinlock if CONFIG_PREEMPT. | |
a80a635f | 80 | .type ret_from_fork,@function |
51533b61 MS |
81 | ret_from_fork: |
82 | jsr schedule_tail | |
83 | nop | |
84 | ba ret_from_sys_call | |
85 | nop | |
a80a635f | 86 | .size ret_from_fork, . - ret_from_fork |
51533b61 | 87 | |
69b58a67 AV |
88 | .type ret_from_kernel_thread,@function |
89 | ret_from_kernel_thread: | |
90 | jsr schedule_tail | |
91 | nop | |
92 | move.d $r2, $r10 | |
93 | jsr $r1 | |
94 | nop | |
1703a219 AV |
95 | moveq 0, $r9 ; no syscall restarts, TYVM... |
96 | ba ret_from_sys_call | |
69b58a67 AV |
97 | nop |
98 | .size ret_from_kernel_thread, . - ret_from_kernel_thread | |
99 | ||
a80a635f | 100 | .type ret_from_intr,@function |
51533b61 MS |
101 | ret_from_intr: |
102 | ;; Check for resched if preemptive kernel, or if we're going back to | |
103 | ;; user-mode. This test matches the user_regs(regs) macro. Don't simply | |
104 | ;; test CCS since that doesn't necessarily reflect what mode we'll | |
105 | ;; return into. | |
106 | addoq +PT_ccs, $sp, $acr | |
107 | move.d [$acr], $r0 | |
108 | btstq 16, $r0 ; User-mode flag. | |
109 | bpl _resume_kernel | |
a80a635f | 110 | .size ret_from_intr, . - ret_from_intr + 2 ; +2 includes the dslot. |
51533b61 MS |
111 | |
112 | ; Note that di below is in delay slot. | |
a80a635f | 113 | .type _resume_userspace,@function |
51533b61 MS |
114 | _resume_userspace: |
115 | di ; So need_resched and sigpending don't change. | |
116 | ||
117 | movs.w -8192, $r0 ; THREAD_SIZE == 8192 | |
118 | and.d $sp, $r0 | |
119 | ||
120 | addoq +TI_flags, $r0, $acr ; current->work | |
121 | move.d [$acr], $r10 | |
122 | and.d _TIF_WORK_MASK, $r10 ; Work to be done on return? | |
123 | bne _work_pending | |
124 | nop | |
125 | ba _Rexit | |
126 | nop | |
a80a635f | 127 | .size _resume_userspace, . - _resume_userspace |
51533b61 MS |
128 | |
129 | ;; The system_call is called by a BREAK instruction, which looks pretty | |
130 | ;; much like any other exception. | |
131 | ;; | |
132 | ;; System calls can't be made from interrupts but we still stack ERP | |
133 | ;; to have a complete stack frame. | |
134 | ;; | |
135 | ;; In r9 we have the wanted syscall number. Arguments come in r10,r11,r12, | |
136 | ;; r13,mof,srp | |
137 | ;; | |
138 | ;; This function looks on the _surface_ like spaghetti programming, but it's | |
139 | ;; really designed so that the fast-path does not force cache-loading of | |
140 | ;; non-used instructions. Only the non-common cases cause the outlined code | |
141 | ;; to run.. | |
142 | ||
a80a635f | 143 | .type system_call,@function |
51533b61 MS |
144 | system_call: |
145 | ;; Stack-frame similar to the irq heads, which is reversed in | |
146 | ;; ret_from_sys_call. | |
cd4f2011 JN |
147 | |
148 | sub.d 92, $sp ; Skip EXS and EDA. | |
149 | movem $r13, [$sp] | |
150 | move.d $sp, $r8 | |
151 | addq 14*4, $r8 | |
152 | move.d $acr, $r0 | |
153 | move $srs, $r1 | |
154 | move $mof, $r2 | |
155 | move $spc, $r3 | |
156 | move $ccs, $r4 | |
157 | move $srp, $r5 | |
158 | move $erp, $r6 | |
51533b61 | 159 | subq 4, $sp |
cd4f2011 JN |
160 | movem $r6, [$r8] |
161 | ei ; Enable interrupts while processing syscalls. | |
162 | move.d $r10, [$sp] | |
51533b61 | 163 | |
cd4f2011 | 164 | ; Set S-bit when kernel debugging to keep hardware breakpoints active. |
51533b61 MS |
165 | #ifdef CONFIG_ETRAX_KGDB |
166 | move $ccs, $r0 | |
167 | or.d (1<<9), $r0 | |
168 | move $r0, $ccs | |
169 | #endif | |
170 | ||
171 | movs.w -ENOSYS, $r0 | |
172 | addoq +PT_r10, $sp, $acr | |
173 | move.d $r0, [$acr] | |
174 | ||
175 | ;; Check if this process is syscall-traced. | |
176 | movs.w -8192, $r0 ; THREAD_SIZE == 8192 | |
177 | and.d $sp, $r0 | |
178 | ||
179 | addoq +TI_flags, $r0, $acr | |
180 | move.d [$acr], $r0 | |
181 | btstq TIF_SYSCALL_TRACE, $r0 | |
182 | bmi _syscall_trace_entry | |
183 | nop | |
184 | ||
185 | _syscall_traced: | |
186 | ;; Check for sanity in the requested syscall number. | |
187 | cmpu.w NR_syscalls, $r9 | |
188 | bhs ret_from_sys_call | |
189 | lslq 2, $r9 ; Multiply by 4, in the delay slot. | |
190 | ||
191 | ;; The location on the stack for the register structure is passed as a | |
192 | ;; seventh argument. Some system calls need this. | |
193 | move.d $sp, $r0 | |
194 | subq 4, $sp | |
195 | move.d $r0, [$sp] | |
196 | ||
197 | ;; The registers carrying parameters (R10-R13) are intact. The optional | |
25985edc | 198 | ;; fifth and sixth parameters is in MOF and SRP respectively. Put them |
51533b61 MS |
199 | ;; back on the stack. |
200 | subq 4, $sp | |
201 | move $srp, [$sp] | |
202 | subq 4, $sp | |
203 | move $mof, [$sp] | |
204 | ||
205 | ;; Actually to the system call. | |
206 | addo.d +sys_call_table, $r9, $acr | |
207 | move.d [$acr], $acr | |
208 | jsr $acr | |
209 | nop | |
210 | ||
211 | addq 3*4, $sp ; Pop the mof, srp and regs parameters. | |
212 | addoq +PT_r10, $sp, $acr | |
213 | move.d $r10, [$acr] ; Save the return value. | |
214 | ||
215 | moveq 1, $r9 ; "Parameter" to ret_from_sys_call to | |
216 | ; show it was a sys call. | |
217 | ||
218 | ;; Fall through into ret_from_sys_call to return. | |
219 | ||
220 | ret_from_sys_call: | |
221 | ;; R9 is a parameter: | |
222 | ;; >= 1 from syscall | |
223 | ;; 0 from irq | |
224 | ||
225 | ;; Get the current task-struct pointer. | |
226 | movs.w -8192, $r0 ; THREAD_SIZE == 8192 | |
227 | and.d $sp, $r0 | |
228 | ||
229 | di ; Make sure need_resched and sigpending don't change. | |
230 | ||
231 | addoq +TI_flags, $r0, $acr | |
232 | move.d [$acr], $r1 | |
233 | and.d _TIF_ALLWORK_MASK, $r1 | |
234 | bne _syscall_exit_work | |
235 | nop | |
a80a635f | 236 | .size system_call, . - system_call |
51533b61 | 237 | |
a80a635f | 238 | .type _Rexit,@function |
51533b61 MS |
239 | _Rexit: |
240 | ;; This epilogue MUST match the prologues in multiple_interrupt, irq.h | |
241 | ;; and ptregs.h. | |
242 | addq 4, $sp ; Skip orig_r10. | |
243 | movem [$sp+], $r13 ; Registers R0-R13. | |
244 | move.d [$sp+], $acr | |
245 | move [$sp], $srs | |
246 | addq 4, $sp | |
247 | move [$sp+], $mof | |
248 | move [$sp+], $spc | |
249 | move [$sp+], $ccs | |
250 | move [$sp+], $srp | |
251 | move [$sp+], $erp | |
252 | addq 8, $sp ; Skip EXS, EDA. | |
253 | jump $erp | |
254 | rfe ; Restore condition code stack in delay-slot. | |
a80a635f | 255 | .size _Rexit, . - _Rexit |
51533b61 MS |
256 | |
257 | ;; We get here after doing a syscall if extra work might need to be done | |
258 | ;; perform syscall exit tracing if needed. | |
259 | ||
a80a635f | 260 | .type _syscall_exit_work,@function |
51533b61 MS |
261 | _syscall_exit_work: |
262 | ;; R0 contains current at this point and irq's are disabled. | |
263 | ||
264 | addoq +TI_flags, $r0, $acr | |
265 | move.d [$acr], $r1 | |
266 | btstq TIF_SYSCALL_TRACE, $r1 | |
267 | bpl _work_pending | |
268 | nop | |
269 | ei | |
270 | move.d $r9, $r1 ; Preserve R9. | |
271 | jsr do_syscall_trace | |
272 | nop | |
273 | move.d $r1, $r9 | |
274 | ba _resume_userspace | |
275 | nop | |
a80a635f | 276 | .size _syscall_exit_work, . - _syscall_exit_work |
51533b61 | 277 | |
a80a635f | 278 | .type _work_pending,@function |
51533b61 MS |
279 | _work_pending: |
280 | addoq +TI_flags, $r0, $acr | |
281 | move.d [$acr], $r10 | |
282 | btstq TIF_NEED_RESCHED, $r10 ; Need resched? | |
283 | bpl _work_notifysig ; No, must be signal/notify. | |
284 | nop | |
a80a635f | 285 | .size _work_pending, . - _work_pending |
51533b61 | 286 | |
a80a635f | 287 | .type _work_resched,@function |
51533b61 MS |
288 | _work_resched: |
289 | move.d $r9, $r1 ; Preserve R9. | |
290 | jsr schedule | |
291 | nop | |
292 | move.d $r1, $r9 | |
293 | di | |
294 | ||
295 | addoq +TI_flags, $r0, $acr | |
296 | move.d [$acr], $r1 | |
297 | and.d _TIF_WORK_MASK, $r1 ; Ignore sycall trace counter. | |
298 | beq _Rexit | |
299 | nop | |
300 | btstq TIF_NEED_RESCHED, $r1 | |
301 | bmi _work_resched ; current->work.need_resched. | |
302 | nop | |
a80a635f | 303 | .size _work_resched, . - _work_resched |
51533b61 | 304 | |
a80a635f | 305 | .type _work_notifysig,@function |
51533b61 MS |
306 | _work_notifysig: |
307 | ;; Deal with pending signals and notify-resume requests. | |
308 | ||
309 | addoq +TI_flags, $r0, $acr | |
ffc8b00d JN |
310 | move.d [$acr], $r12 ; The thread_info_flags parameter. |
311 | move.d $sp, $r11 ; The regs param. | |
51533b61 | 312 | jsr do_notify_resume |
ffc8b00d | 313 | move.d $r9, $r10 ; do_notify_resume syscall/irq param. |
51533b61 MS |
314 | |
315 | ba _Rexit | |
316 | nop | |
a80a635f | 317 | .size _work_notifysig, . - _work_notifysig |
51533b61 MS |
318 | |
319 | ;; We get here as a sidetrack when we've entered a syscall with the | |
320 | ;; trace-bit set. We need to call do_syscall_trace and then continue | |
321 | ;; with the call. | |
322 | ||
323 | _syscall_trace_entry: | |
324 | ;; PT_r10 in the frame contains -ENOSYS as required, at this point. | |
325 | ||
326 | jsr do_syscall_trace | |
327 | nop | |
328 | ||
329 | ;; Now re-enter the syscall code to do the syscall itself. We need to | |
330 | ;; restore R9 here to contain the wanted syscall, and the other | |
331 | ;; parameter-bearing registers. | |
332 | addoq +PT_r9, $sp, $acr | |
333 | move.d [$acr], $r9 | |
334 | addoq +PT_orig_r10, $sp, $acr | |
335 | move.d [$acr], $r10 ; PT_r10 is already -ENOSYS. | |
336 | addoq +PT_r11, $sp, $acr | |
337 | move.d [$acr], $r11 | |
338 | addoq +PT_r12, $sp, $acr | |
339 | move.d [$acr], $r12 | |
340 | addoq +PT_r13, $sp, $acr | |
341 | move.d [$acr], $r13 | |
342 | addoq +PT_mof, $sp, $acr | |
343 | move [$acr], $mof | |
344 | addoq +PT_srp, $sp, $acr | |
345 | move [$acr], $srp | |
346 | ||
347 | ba _syscall_traced | |
348 | nop | |
349 | ||
350 | ;; Resume performs the actual task-switching, by switching stack | |
351 | ;; pointers. Input arguments are: | |
352 | ;; | |
353 | ;; R10 = prev | |
354 | ;; R11 = next | |
355 | ;; R12 = thread offset in task struct. | |
356 | ;; | |
357 | ;; Returns old current in R10. | |
358 | ||
a80a635f | 359 | .type resume,@function |
51533b61 | 360 | resume: |
43f6cdd7 JN |
361 | subq 4, $sp ; Make space for srp. |
362 | ||
51533b61 MS |
363 | add.d $r12, $r10 ; R10 = current tasks tss. |
364 | addoq +THREAD_ccs, $r10, $acr | |
43f6cdd7 | 365 | move $srp, [$sp] ; Keep old/new PC on the stack. |
51533b61 MS |
366 | move $ccs, [$acr] ; Save IRQ enable state. |
367 | di | |
368 | ||
369 | addoq +THREAD_usp, $r10, $acr | |
43f6cdd7 | 370 | subq 10*4, $sp ; Make room for R9. |
51533b61 MS |
371 | move $usp, [$acr] ; Save user-mode stackpointer. |
372 | ||
373 | ;; See copy_thread for the reason why register R9 is saved. | |
51533b61 MS |
374 | movem $r9, [$sp] ; Save non-scratch registers and R9. |
375 | ||
376 | addoq +THREAD_ksp, $r10, $acr | |
43f6cdd7 | 377 | move.d $sp, $r10 ; Return last running task in R10. |
51533b61 MS |
378 | move.d $sp, [$acr] ; Save kernel SP for old task. |
379 | ||
51533b61 MS |
380 | and.d -8192, $r10 ; Get thread_info from stackpointer. |
381 | addoq +TI_task, $r10, $acr | |
51533b61 | 382 | add.d $r12, $r11 ; Find the new tasks tss. |
43f6cdd7 | 383 | move.d [$acr], $r10 ; Get task. |
51533b61 MS |
384 | addoq +THREAD_ksp, $r11, $acr |
385 | move.d [$acr], $sp ; Switch to new stackframe. | |
43f6cdd7 | 386 | addoq +THREAD_usp, $r11, $acr |
51533b61 MS |
387 | movem [$sp+], $r9 ; Restore non-scratch registers and R9. |
388 | ||
51533b61 MS |
389 | move [$acr], $usp ; Restore user-mode stackpointer. |
390 | ||
391 | addoq +THREAD_ccs, $r11, $acr | |
43f6cdd7 JN |
392 | move.d [$sp+], $r11 |
393 | jump $r11 ; Restore PC. | |
51533b61 | 394 | move [$acr], $ccs ; Restore IRQ enable status. |
a80a635f | 395 | .size resume, . - resume |
51533b61 MS |
396 | |
397 | nmi_interrupt: | |
398 | ||
399 | ;; If we receive a watchdog interrupt while it is not expected, then set | |
400 | ;; up a canonical frame and dump register contents before dying. | |
401 | ||
402 | ;; This prologue MUST match the one in irq.h and the struct in ptregs.h! | |
403 | subq 12, $sp ; Skip EXS, EDA. | |
404 | move $nrp, [$sp] | |
405 | subq 4, $sp | |
406 | move $srp, [$sp] | |
407 | subq 4, $sp | |
408 | move $ccs, [$sp] | |
409 | subq 4, $sp | |
410 | move $spc, [$sp] | |
411 | subq 4, $sp | |
412 | move $mof, [$sp] | |
413 | subq 4, $sp | |
414 | move $srs, [$sp] | |
415 | subq 4, $sp | |
416 | move.d $acr, [$sp] | |
417 | subq 14*4, $sp ; Make room for R0-R13. | |
418 | movem $r13, [$sp] ; Push R0-R13. | |
419 | subq 4, $sp | |
420 | move.d $r10, [$sp] ; Push orig_r10. | |
421 | move.d REG_ADDR(intr_vect, regi_irq, r_nmi), $r0 | |
422 | move.d [$r0], $r0 | |
423 | btstq REG_BIT(intr_vect, r_nmi, watchdog), $r0 | |
424 | bpl 1f | |
425 | nop | |
ffc8b00d | 426 | jsr handle_watchdog_bite ; In time.c. |
51533b61 MS |
427 | move.d $sp, $r10 ; Pointer to registers |
428 | 1: btstq REG_BIT(intr_vect, r_nmi, ext), $r0 | |
429 | bpl 1f | |
430 | nop | |
431 | jsr handle_nmi | |
432 | move.d $sp, $r10 ; Pointer to registers | |
433 | 1: addq 4, $sp ; Skip orig_r10 | |
434 | movem [$sp+], $r13 | |
435 | move.d [$sp+], $acr | |
436 | move [$sp], $srs | |
437 | addq 4, $sp | |
438 | move [$sp+], $mof | |
439 | move [$sp+], $spc | |
440 | move [$sp+], $ccs | |
441 | move [$sp+], $srp | |
442 | move [$sp+], $nrp | |
443 | addq 8, $sp ; Skip EXS, EDA. | |
444 | jump $nrp | |
445 | rfn | |
446 | ||
447 | .comm cause_of_death, 4 ;; Don't declare this anywhere. | |
448 | ||
449 | spurious_interrupt: | |
450 | di | |
451 | jump hard_reset_now | |
452 | nop | |
453 | ||
454 | ;; This handles the case when multiple interrupts arrive at the same | |
455 | ;; time. Jump to the first set interrupt bit in a priotiry fashion. The | |
456 | ;; hardware will call the unserved interrupts after the handler | |
457 | ;; finishes. | |
a80a635f | 458 | .type multiple_interrupt, @function |
51533b61 MS |
459 | multiple_interrupt: |
460 | ;; This prologue MUST match the one in irq.h and the struct in ptregs.h! | |
461 | subq 12, $sp ; Skip EXS, EDA. | |
462 | move $erp, [$sp] | |
463 | subq 4, $sp | |
464 | move $srp, [$sp] | |
465 | subq 4, $sp | |
466 | move $ccs, [$sp] | |
467 | subq 4, $sp | |
468 | move $spc, [$sp] | |
469 | subq 4, $sp | |
470 | move $mof, [$sp] | |
471 | subq 4, $sp | |
472 | move $srs, [$sp] | |
473 | subq 4, $sp | |
474 | move.d $acr, [$sp] | |
475 | subq 14*4, $sp ; Make room for R0-R13. | |
476 | movem $r13, [$sp] ; Push R0-R13. | |
477 | subq 4, $sp | |
478 | move.d $r10, [$sp] ; Push orig_r10. | |
479 | ||
480 | ; Set S-bit when kernel debugging to keep hardware breakpoints active. | |
481 | #ifdef CONFIG_ETRAX_KGDB | |
482 | move $ccs, $r0 | |
483 | or.d (1<<9), $r0 | |
484 | move $r0, $ccs | |
485 | #endif | |
486 | ||
487 | jsr crisv32_do_multiple | |
488 | move.d $sp, $r10 | |
489 | jump ret_from_intr | |
490 | nop | |
a80a635f | 491 | .size multiple_interrupt, . - multiple_interrupt |
51533b61 MS |
492 | |
493 | do_sigtrap: | |
494 | ;; Sigtraps the process that executed the BREAK instruction. Creates a | |
495 | ;; frame that Rexit expects. | |
496 | subq 4, $sp | |
497 | move $eda, [$sp] | |
498 | subq 4, $sp | |
499 | move $exs, [$sp] | |
500 | subq 4, $sp | |
501 | move $erp, [$sp] | |
502 | subq 4, $sp | |
503 | move $srp, [$sp] | |
504 | subq 4, $sp | |
505 | move $ccs, [$sp] | |
506 | subq 4, $sp | |
507 | move $spc, [$sp] | |
508 | subq 4, $sp | |
509 | move $mof, [$sp] | |
510 | subq 4, $sp | |
511 | move $srs, [$sp] | |
512 | subq 4, $sp | |
513 | move.d $acr, [$sp] | |
514 | di ; Need to disable irq's at this point. | |
515 | subq 14*4, $sp ; Make room for r0-r13. | |
516 | movem $r13, [$sp] ; Push the r0-r13 registers. | |
517 | subq 4, $sp | |
518 | move.d $r10, [$sp] ; Push orig_r10. | |
519 | ||
520 | movs.w -8192, $r9 ; THREAD_SIZE == 8192 | |
521 | and.d $sp, $r9 | |
522 | ||
523 | ;; thread_info as first parameter | |
524 | move.d $r9, $r10 | |
525 | moveq 5, $r11 ; SIGTRAP as second argument. | |
526 | jsr ugdb_trap_user | |
527 | nop | |
528 | jump ret_from_intr ; Use the return routine for interrupts. | |
529 | nop | |
530 | ||
531 | gdb_handle_exception: | |
532 | subq 4, $sp | |
533 | move.d $r0, [$sp] | |
534 | #ifdef CONFIG_ETRAX_KGDB | |
535 | move $ccs, $r0 ; U-flag not affected by previous insns. | |
536 | btstq 16, $r0 ; Test the U-flag. | |
537 | bmi _ugdb_handle_exception ; Go to user mode debugging. | |
538 | nop ; Empty delay-slot (cannot pop R0 here). | |
539 | ba kgdb_handle_exception ; Go to kernel debugging. | |
540 | move.d [$sp+], $r0 ; Restore R0 in delay slot. | |
541 | #endif | |
542 | ||
543 | _ugdb_handle_exception: | |
544 | ba do_sigtrap ; SIGTRAP the offending process. | |
545 | move.d [$sp+], $r0 ; Restore R0 in delay slot. | |
546 | ||
547 | .data | |
548 | ||
549 | .section .rodata,"a" | |
550 | sys_call_table: | |
551 | .long sys_restart_syscall ; 0 - old "setup()" system call, used | |
552 | ; for restarting. | |
553 | .long sys_exit | |
554 | .long sys_fork | |
555 | .long sys_read | |
556 | .long sys_write | |
557 | .long sys_open /* 5 */ | |
558 | .long sys_close | |
559 | .long sys_waitpid | |
560 | .long sys_creat | |
561 | .long sys_link | |
562 | .long sys_unlink /* 10 */ | |
563 | .long sys_execve | |
564 | .long sys_chdir | |
565 | .long sys_time | |
566 | .long sys_mknod | |
567 | .long sys_chmod /* 15 */ | |
568 | .long sys_lchown16 | |
569 | .long sys_ni_syscall /* old break syscall holder */ | |
570 | .long sys_stat | |
571 | .long sys_lseek | |
572 | .long sys_getpid /* 20 */ | |
573 | .long sys_mount | |
574 | .long sys_oldumount | |
575 | .long sys_setuid16 | |
576 | .long sys_getuid16 | |
577 | .long sys_stime /* 25 */ | |
578 | .long sys_ptrace | |
579 | .long sys_alarm | |
580 | .long sys_fstat | |
581 | .long sys_pause | |
582 | .long sys_utime /* 30 */ | |
583 | .long sys_ni_syscall /* old stty syscall holder */ | |
584 | .long sys_ni_syscall /* old gtty syscall holder */ | |
585 | .long sys_access | |
586 | .long sys_nice | |
587 | .long sys_ni_syscall /* 35 old ftime syscall holder */ | |
588 | .long sys_sync | |
589 | .long sys_kill | |
590 | .long sys_rename | |
591 | .long sys_mkdir | |
592 | .long sys_rmdir /* 40 */ | |
593 | .long sys_dup | |
594 | .long sys_pipe | |
595 | .long sys_times | |
596 | .long sys_ni_syscall /* old prof syscall holder */ | |
597 | .long sys_brk /* 45 */ | |
598 | .long sys_setgid16 | |
599 | .long sys_getgid16 | |
600 | .long sys_signal | |
601 | .long sys_geteuid16 | |
602 | .long sys_getegid16 /* 50 */ | |
603 | .long sys_acct | |
604 | .long sys_umount /* recycled never used phys( */ | |
605 | .long sys_ni_syscall /* old lock syscall holder */ | |
606 | .long sys_ioctl | |
607 | .long sys_fcntl /* 55 */ | |
608 | .long sys_ni_syscall /* old mpx syscall holder */ | |
609 | .long sys_setpgid | |
610 | .long sys_ni_syscall /* old ulimit syscall holder */ | |
611 | .long sys_ni_syscall /* old sys_olduname holder */ | |
612 | .long sys_umask /* 60 */ | |
613 | .long sys_chroot | |
614 | .long sys_ustat | |
615 | .long sys_dup2 | |
616 | .long sys_getppid | |
617 | .long sys_getpgrp /* 65 */ | |
618 | .long sys_setsid | |
619 | .long sys_sigaction | |
620 | .long sys_sgetmask | |
621 | .long sys_ssetmask | |
622 | .long sys_setreuid16 /* 70 */ | |
623 | .long sys_setregid16 | |
624 | .long sys_sigsuspend | |
625 | .long sys_sigpending | |
626 | .long sys_sethostname | |
627 | .long sys_setrlimit /* 75 */ | |
628 | .long sys_old_getrlimit | |
629 | .long sys_getrusage | |
630 | .long sys_gettimeofday | |
631 | .long sys_settimeofday | |
632 | .long sys_getgroups16 /* 80 */ | |
633 | .long sys_setgroups16 | |
634 | .long sys_select /* was old_select in Linux/E100 */ | |
635 | .long sys_symlink | |
636 | .long sys_lstat | |
637 | .long sys_readlink /* 85 */ | |
638 | .long sys_uselib | |
639 | .long sys_swapon | |
640 | .long sys_reboot | |
e55380ed | 641 | .long sys_old_readdir |
a4679373 | 642 | .long sys_old_mmap /* 90 */ |
51533b61 MS |
643 | .long sys_munmap |
644 | .long sys_truncate | |
645 | .long sys_ftruncate | |
646 | .long sys_fchmod | |
647 | .long sys_fchown16 /* 95 */ | |
648 | .long sys_getpriority | |
649 | .long sys_setpriority | |
650 | .long sys_ni_syscall /* old profil syscall holder */ | |
651 | .long sys_statfs | |
652 | .long sys_fstatfs /* 100 */ | |
653 | .long sys_ni_syscall /* sys_ioperm in i386 */ | |
654 | .long sys_socketcall | |
655 | .long sys_syslog | |
656 | .long sys_setitimer | |
657 | .long sys_getitimer /* 105 */ | |
658 | .long sys_newstat | |
659 | .long sys_newlstat | |
660 | .long sys_newfstat | |
661 | .long sys_ni_syscall /* old sys_uname holder */ | |
662 | .long sys_ni_syscall /* sys_iopl in i386 */ | |
663 | .long sys_vhangup | |
664 | .long sys_ni_syscall /* old "idle" system call */ | |
665 | .long sys_ni_syscall /* vm86old in i386 */ | |
666 | .long sys_wait4 | |
667 | .long sys_swapoff /* 115 */ | |
668 | .long sys_sysinfo | |
669 | .long sys_ipc | |
670 | .long sys_fsync | |
671 | .long sys_sigreturn | |
672 | .long sys_clone /* 120 */ | |
673 | .long sys_setdomainname | |
674 | .long sys_newuname | |
675 | .long sys_ni_syscall /* sys_modify_ldt */ | |
676 | .long sys_adjtimex | |
677 | .long sys_mprotect /* 125 */ | |
678 | .long sys_sigprocmask | |
679 | .long sys_ni_syscall /* old "create_module" */ | |
680 | .long sys_init_module | |
681 | .long sys_delete_module | |
682 | .long sys_ni_syscall /* 130: old "get_kernel_syms" */ | |
683 | .long sys_quotactl | |
684 | .long sys_getpgid | |
685 | .long sys_fchdir | |
686 | .long sys_bdflush | |
687 | .long sys_sysfs /* 135 */ | |
688 | .long sys_personality | |
689 | .long sys_ni_syscall /* for afs_syscall */ | |
690 | .long sys_setfsuid16 | |
691 | .long sys_setfsgid16 | |
692 | .long sys_llseek /* 140 */ | |
693 | .long sys_getdents | |
694 | .long sys_select | |
695 | .long sys_flock | |
696 | .long sys_msync | |
697 | .long sys_readv /* 145 */ | |
698 | .long sys_writev | |
699 | .long sys_getsid | |
700 | .long sys_fdatasync | |
701 | .long sys_sysctl | |
702 | .long sys_mlock /* 150 */ | |
703 | .long sys_munlock | |
704 | .long sys_mlockall | |
705 | .long sys_munlockall | |
706 | .long sys_sched_setparam | |
707 | .long sys_sched_getparam /* 155 */ | |
708 | .long sys_sched_setscheduler | |
709 | .long sys_sched_getscheduler | |
710 | .long sys_sched_yield | |
711 | .long sys_sched_get_priority_max | |
712 | .long sys_sched_get_priority_min /* 160 */ | |
713 | .long sys_sched_rr_get_interval | |
714 | .long sys_nanosleep | |
715 | .long sys_mremap | |
716 | .long sys_setresuid16 | |
717 | .long sys_getresuid16 /* 165 */ | |
718 | .long sys_ni_syscall /* sys_vm86 */ | |
719 | .long sys_ni_syscall /* Old sys_query_module */ | |
720 | .long sys_poll | |
f5b94099 | 721 | .long sys_ni_syscall /* Old nfsservctl */ |
51533b61 MS |
722 | .long sys_setresgid16 /* 170 */ |
723 | .long sys_getresgid16 | |
724 | .long sys_prctl | |
725 | .long sys_rt_sigreturn | |
726 | .long sys_rt_sigaction | |
727 | .long sys_rt_sigprocmask /* 175 */ | |
728 | .long sys_rt_sigpending | |
729 | .long sys_rt_sigtimedwait | |
730 | .long sys_rt_sigqueueinfo | |
731 | .long sys_rt_sigsuspend | |
732 | .long sys_pread64 /* 180 */ | |
733 | .long sys_pwrite64 | |
734 | .long sys_chown16 | |
735 | .long sys_getcwd | |
736 | .long sys_capget | |
737 | .long sys_capset /* 185 */ | |
738 | .long sys_sigaltstack | |
739 | .long sys_sendfile | |
740 | .long sys_ni_syscall /* streams1 */ | |
741 | .long sys_ni_syscall /* streams2 */ | |
742 | .long sys_vfork /* 190 */ | |
743 | .long sys_getrlimit | |
744 | .long sys_mmap2 | |
745 | .long sys_truncate64 | |
746 | .long sys_ftruncate64 | |
747 | .long sys_stat64 /* 195 */ | |
748 | .long sys_lstat64 | |
749 | .long sys_fstat64 | |
750 | .long sys_lchown | |
751 | .long sys_getuid | |
752 | .long sys_getgid /* 200 */ | |
753 | .long sys_geteuid | |
754 | .long sys_getegid | |
755 | .long sys_setreuid | |
756 | .long sys_setregid | |
757 | .long sys_getgroups /* 205 */ | |
758 | .long sys_setgroups | |
759 | .long sys_fchown | |
760 | .long sys_setresuid | |
761 | .long sys_getresuid | |
762 | .long sys_setresgid /* 210 */ | |
763 | .long sys_getresgid | |
764 | .long sys_chown | |
765 | .long sys_setuid | |
766 | .long sys_setgid | |
767 | .long sys_setfsuid /* 215 */ | |
768 | .long sys_setfsgid | |
769 | .long sys_pivot_root | |
770 | .long sys_mincore | |
771 | .long sys_madvise | |
772 | .long sys_getdents64 /* 220 */ | |
773 | .long sys_fcntl64 | |
774 | .long sys_ni_syscall /* reserved for TUX */ | |
775 | .long sys_ni_syscall | |
776 | .long sys_gettid | |
777 | .long sys_readahead /* 225 */ | |
778 | .long sys_setxattr | |
779 | .long sys_lsetxattr | |
780 | .long sys_fsetxattr | |
781 | .long sys_getxattr | |
782 | .long sys_lgetxattr /* 230 */ | |
783 | .long sys_fgetxattr | |
784 | .long sys_listxattr | |
785 | .long sys_llistxattr | |
786 | .long sys_flistxattr | |
787 | .long sys_removexattr /* 235 */ | |
788 | .long sys_lremovexattr | |
789 | .long sys_fremovexattr | |
790 | .long sys_tkill | |
791 | .long sys_sendfile64 | |
792 | .long sys_futex /* 240 */ | |
793 | .long sys_sched_setaffinity | |
794 | .long sys_sched_getaffinity | |
795 | .long sys_ni_syscall /* sys_set_thread_area */ | |
796 | .long sys_ni_syscall /* sys_get_thread_area */ | |
797 | .long sys_io_setup /* 245 */ | |
798 | .long sys_io_destroy | |
799 | .long sys_io_getevents | |
800 | .long sys_io_submit | |
801 | .long sys_io_cancel | |
802 | .long sys_fadvise64 /* 250 */ | |
803 | .long sys_ni_syscall | |
804 | .long sys_exit_group | |
805 | .long sys_lookup_dcookie | |
806 | .long sys_epoll_create | |
807 | .long sys_epoll_ctl /* 255 */ | |
808 | .long sys_epoll_wait | |
809 | .long sys_remap_file_pages | |
ffc8b00d JN |
810 | .long sys_set_tid_address |
811 | .long sys_timer_create | |
812 | .long sys_timer_settime /* 260 */ | |
813 | .long sys_timer_gettime | |
814 | .long sys_timer_getoverrun | |
815 | .long sys_timer_delete | |
816 | .long sys_clock_settime | |
817 | .long sys_clock_gettime /* 265 */ | |
818 | .long sys_clock_getres | |
819 | .long sys_clock_nanosleep | |
51533b61 MS |
820 | .long sys_statfs64 |
821 | .long sys_fstatfs64 | |
822 | .long sys_tgkill /* 270 */ | |
823 | .long sys_utimes | |
ffc8b00d | 824 | .long sys_fadvise64_64 |
51533b61 MS |
825 | .long sys_ni_syscall /* sys_vserver */ |
826 | .long sys_ni_syscall /* sys_mbind */ | |
827 | .long sys_ni_syscall /* 275 sys_get_mempolicy */ | |
828 | .long sys_ni_syscall /* sys_set_mempolicy */ | |
829 | .long sys_mq_open | |
830 | .long sys_mq_unlink | |
831 | .long sys_mq_timedsend | |
832 | .long sys_mq_timedreceive /* 280 */ | |
833 | .long sys_mq_notify | |
834 | .long sys_mq_getsetattr | |
835 | .long sys_ni_syscall /* reserved for kexec */ | |
836 | .long sys_waitid | |
ffc8b00d JN |
837 | .long sys_ni_syscall /* 285 */ /* available */ |
838 | .long sys_add_key | |
839 | .long sys_request_key | |
840 | .long sys_keyctl | |
841 | .long sys_ioprio_set | |
842 | .long sys_ioprio_get /* 290 */ | |
843 | .long sys_inotify_init | |
844 | .long sys_inotify_add_watch | |
845 | .long sys_inotify_rm_watch | |
846 | .long sys_migrate_pages | |
847 | .long sys_openat /* 295 */ | |
848 | .long sys_mkdirat | |
849 | .long sys_mknodat | |
850 | .long sys_fchownat | |
851 | .long sys_futimesat | |
852 | .long sys_fstatat64 /* 300 */ | |
853 | .long sys_unlinkat | |
854 | .long sys_renameat | |
855 | .long sys_linkat | |
856 | .long sys_symlinkat | |
857 | .long sys_readlinkat /* 305 */ | |
858 | .long sys_fchmodat | |
859 | .long sys_faccessat | |
860 | .long sys_pselect6 | |
861 | .long sys_ppoll | |
862 | .long sys_unshare /* 310 */ | |
863 | .long sys_set_robust_list | |
864 | .long sys_get_robust_list | |
865 | .long sys_splice | |
866 | .long sys_sync_file_range | |
867 | .long sys_tee /* 315 */ | |
868 | .long sys_vmsplice | |
869 | .long sys_move_pages | |
870 | .long sys_getcpu | |
871 | .long sys_epoll_pwait | |
872 | .long sys_utimensat /* 320 */ | |
873 | .long sys_signalfd | |
7800029d | 874 | .long sys_timerfd_create |
ffc8b00d JN |
875 | .long sys_eventfd |
876 | .long sys_fallocate | |
7800029d JN |
877 | .long sys_timerfd_settime /* 325 */ |
878 | .long sys_timerfd_gettime | |
6d3d4be4 JN |
879 | .long sys_signalfd4 |
880 | .long sys_eventfd2 | |
881 | .long sys_epoll_create1 | |
882 | .long sys_dup3 /* 330 */ | |
883 | .long sys_pipe2 | |
884 | .long sys_inotify_init1 | |
885 | .long sys_preadv | |
886 | .long sys_pwritev | |
7b21fddd | 887 | .long sys_setns /* 335 */ |
51533b61 MS |
888 | |
889 | /* | |
890 | * NOTE!! This doesn't have to be exact - we just have | |
891 | * to make sure we have _enough_ of the "sys_ni_syscall" | |
892 | * entries. Don't panic if you notice that this hasn't | |
893 | * been shrunk every time we add a new system call. | |
894 | */ | |
895 | ||
896 | .rept NR_syscalls - (.-sys_call_table) / 4 | |
897 | .long sys_ni_syscall | |
898 | .endr | |
899 |