]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * This file is subject to the terms and conditions of the GNU General Public | |
3 | * License. See the file "COPYING" in the main directory of this archive | |
4 | * for more details. | |
5 | * | |
6 | * Copyright (C) 1995, 96, 97, 98, 99, 2000, 01, 02 by Ralf Baechle | |
7 | * Copyright (C) 1999, 2000 Silicon Graphics, Inc. | |
8 | * Copyright (C) 2001 MIPS Technologies, Inc. | |
9 | */ | |
1da177e4 LT |
10 | #include <linux/errno.h> |
11 | #include <asm/asm.h> | |
12 | #include <asm/asmmacro.h> | |
192ef366 | 13 | #include <asm/irqflags.h> |
1da177e4 LT |
14 | #include <asm/mipsregs.h> |
15 | #include <asm/regdef.h> | |
16 | #include <asm/stackframe.h> | |
048eb582 | 17 | #include <asm/asm-offsets.h> |
1da177e4 LT |
18 | #include <asm/sysmips.h> |
19 | #include <asm/thread_info.h> | |
20 | #include <asm/unistd.h> | |
21 | #include <asm/war.h> | |
22 | ||
23 | #ifndef CONFIG_BINFMT_ELF32 | |
24 | /* Neither O32 nor N32, so define handle_sys here */ | |
25 | #define handle_sys64 handle_sys | |
26 | #endif | |
27 | ||
28 | .align 5 | |
29 | NESTED(handle_sys64, PT_SIZE, sp) | |
30 | #if !defined(CONFIG_MIPS32_O32) && !defined(CONFIG_MIPS32_N32) | |
31 | /* | |
32 | * When 32-bit compatibility is configured scall_o32.S | |
33 | * already did this. | |
34 | */ | |
35 | .set noat | |
36 | SAVE_SOME | |
eae6c0da | 37 | TRACE_IRQS_ON_RELOAD |
1da177e4 LT |
38 | STI |
39 | .set at | |
40 | #endif | |
41 | ||
42 | dsubu t0, v0, __NR_64_Linux # check syscall number | |
43 | sltiu t0, t0, __NR_64_Linux_syscalls + 1 | |
44 | #if !defined(CONFIG_MIPS32_O32) && !defined(CONFIG_MIPS32_N32) | |
45 | ld t1, PT_EPC(sp) # skip syscall on return | |
46 | daddiu t1, 4 # skip to next instruction | |
47 | sd t1, PT_EPC(sp) | |
48 | #endif | |
49 | beqz t0, illegal_syscall | |
50 | ||
51 | dsll t0, v0, 3 # offset into table | |
52 | ld t2, (sys_call_table - (__NR_64_Linux * 8))(t0) | |
53 | # syscall routine | |
54 | ||
55 | sd a3, PT_R26(sp) # save a3 for syscall restarting | |
56 | ||
57 | li t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | |
58 | LONG_L t0, TI_FLAGS($28) # syscall tracing enabled? | |
59 | and t0, t1, t0 | |
60 | bnez t0, syscall_trace_entry | |
61 | ||
62 | jalr t2 # Do The Real Thing (TM) | |
63 | ||
64 | li t0, -EMAXERRNO - 1 # error? | |
65 | sltu t0, t0, v0 | |
66 | sd t0, PT_R7(sp) # set error flag | |
67 | beqz t0, 1f | |
68 | ||
8f5a00eb | 69 | ld t1, PT_R2(sp) # syscall number |
1da177e4 | 70 | dnegu v0 # error |
8f5a00eb | 71 | sd t1, PT_R0(sp) # save it for syscall restarting |
1da177e4 LT |
72 | 1: sd v0, PT_R2(sp) # result |
73 | ||
74 | n64_syscall_exit: | |
75 | local_irq_disable # make sure need_resched and | |
76 | # signals dont change between | |
77 | # sampling and return | |
78 | LONG_L a2, TI_FLAGS($28) # current->work | |
79 | li t0, _TIF_ALLWORK_MASK | |
80 | and t0, a2, t0 | |
81 | bnez t0, n64_syscall_exit_work | |
82 | ||
83 | j restore_partial | |
84 | ||
85 | n64_syscall_exit_work: | |
86 | j syscall_exit_work_partial | |
87 | ||
88 | /* ------------------------------------------------------------------------ */ | |
89 | ||
90 | syscall_trace_entry: | |
91 | SAVE_STATIC | |
92 | move s0, t2 | |
93 | move a0, sp | |
8b659a39 | 94 | jal syscall_trace_enter |
1da177e4 | 95 | |
04a7052c RB |
96 | move t0, s0 |
97 | RESTORE_STATIC | |
1da177e4 LT |
98 | ld a0, PT_R4(sp) # Restore argument registers |
99 | ld a1, PT_R5(sp) | |
100 | ld a2, PT_R6(sp) | |
101 | ld a3, PT_R7(sp) | |
102 | ld a4, PT_R8(sp) | |
103 | ld a5, PT_R9(sp) | |
04a7052c | 104 | jalr t0 |
1da177e4 LT |
105 | |
106 | li t0, -EMAXERRNO - 1 # error? | |
107 | sltu t0, t0, v0 | |
108 | sd t0, PT_R7(sp) # set error flag | |
109 | beqz t0, 1f | |
110 | ||
8f5a00eb | 111 | ld t1, PT_R2(sp) # syscall number |
1da177e4 | 112 | dnegu v0 # error |
8f5a00eb | 113 | sd t1, PT_R0(sp) # save it for syscall restarting |
1da177e4 LT |
114 | 1: sd v0, PT_R2(sp) # result |
115 | ||
116 | j syscall_exit | |
117 | ||
118 | illegal_syscall: | |
119 | /* This also isn't a 64-bit syscall, throw an error. */ | |
bda8229b | 120 | li v0, ENOSYS # error |
1da177e4 LT |
121 | sd v0, PT_R2(sp) |
122 | li t0, 1 # set error flag | |
123 | sd t0, PT_R7(sp) | |
124 | j n64_syscall_exit | |
125 | END(handle_sys64) | |
126 | ||
1da177e4 LT |
127 | .align 3 |
128 | sys_call_table: | |
129 | PTR sys_read /* 5000 */ | |
130 | PTR sys_write | |
131 | PTR sys_open | |
132 | PTR sys_close | |
133 | PTR sys_newstat | |
134 | PTR sys_newfstat /* 5005 */ | |
135 | PTR sys_newlstat | |
136 | PTR sys_poll | |
137 | PTR sys_lseek | |
dbda6ac0 | 138 | PTR sys_mips_mmap |
1da177e4 LT |
139 | PTR sys_mprotect /* 5010 */ |
140 | PTR sys_munmap | |
141 | PTR sys_brk | |
142 | PTR sys_rt_sigaction | |
143 | PTR sys_rt_sigprocmask | |
144 | PTR sys_ioctl /* 5015 */ | |
145 | PTR sys_pread64 | |
146 | PTR sys_pwrite64 | |
147 | PTR sys_readv | |
148 | PTR sys_writev | |
149 | PTR sys_access /* 5020 */ | |
8213bbf9 | 150 | PTR sysm_pipe |
1da177e4 LT |
151 | PTR sys_select |
152 | PTR sys_sched_yield | |
153 | PTR sys_mremap | |
154 | PTR sys_msync /* 5025 */ | |
155 | PTR sys_mincore | |
156 | PTR sys_madvise | |
157 | PTR sys_shmget | |
158 | PTR sys_shmat | |
159 | PTR sys_shmctl /* 5030 */ | |
160 | PTR sys_dup | |
161 | PTR sys_dup2 | |
162 | PTR sys_pause | |
163 | PTR sys_nanosleep | |
164 | PTR sys_getitimer /* 5035 */ | |
165 | PTR sys_setitimer | |
166 | PTR sys_alarm | |
167 | PTR sys_getpid | |
168 | PTR sys_sendfile64 | |
169 | PTR sys_socket /* 5040 */ | |
170 | PTR sys_connect | |
171 | PTR sys_accept | |
172 | PTR sys_sendto | |
173 | PTR sys_recvfrom | |
174 | PTR sys_sendmsg /* 5045 */ | |
175 | PTR sys_recvmsg | |
176 | PTR sys_shutdown | |
177 | PTR sys_bind | |
178 | PTR sys_listen | |
179 | PTR sys_getsockname /* 5050 */ | |
180 | PTR sys_getpeername | |
181 | PTR sys_socketpair | |
182 | PTR sys_setsockopt | |
183 | PTR sys_getsockopt | |
184 | PTR sys_clone /* 5055 */ | |
185 | PTR sys_fork | |
186 | PTR sys_execve | |
187 | PTR sys_exit | |
188 | PTR sys_wait4 | |
189 | PTR sys_kill /* 5060 */ | |
190 | PTR sys_newuname | |
191 | PTR sys_semget | |
192 | PTR sys_semop | |
193 | PTR sys_semctl | |
194 | PTR sys_shmdt /* 5065 */ | |
195 | PTR sys_msgget | |
196 | PTR sys_msgsnd | |
197 | PTR sys_msgrcv | |
198 | PTR sys_msgctl | |
199 | PTR sys_fcntl /* 5070 */ | |
200 | PTR sys_flock | |
201 | PTR sys_fsync | |
202 | PTR sys_fdatasync | |
203 | PTR sys_truncate | |
204 | PTR sys_ftruncate /* 5075 */ | |
205 | PTR sys_getdents | |
206 | PTR sys_getcwd | |
207 | PTR sys_chdir | |
208 | PTR sys_fchdir | |
209 | PTR sys_rename /* 5080 */ | |
210 | PTR sys_mkdir | |
211 | PTR sys_rmdir | |
212 | PTR sys_creat | |
213 | PTR sys_link | |
214 | PTR sys_unlink /* 5085 */ | |
215 | PTR sys_symlink | |
216 | PTR sys_readlink | |
217 | PTR sys_chmod | |
218 | PTR sys_fchmod | |
219 | PTR sys_chown /* 5090 */ | |
220 | PTR sys_fchown | |
221 | PTR sys_lchown | |
222 | PTR sys_umask | |
223 | PTR sys_gettimeofday | |
224 | PTR sys_getrlimit /* 5095 */ | |
225 | PTR sys_getrusage | |
226 | PTR sys_sysinfo | |
227 | PTR sys_times | |
228 | PTR sys_ptrace | |
229 | PTR sys_getuid /* 5100 */ | |
230 | PTR sys_syslog | |
231 | PTR sys_getgid | |
232 | PTR sys_setuid | |
233 | PTR sys_setgid | |
234 | PTR sys_geteuid /* 5105 */ | |
235 | PTR sys_getegid | |
236 | PTR sys_setpgid | |
237 | PTR sys_getppid | |
238 | PTR sys_getpgrp | |
239 | PTR sys_setsid /* 5110 */ | |
240 | PTR sys_setreuid | |
241 | PTR sys_setregid | |
242 | PTR sys_getgroups | |
243 | PTR sys_setgroups | |
244 | PTR sys_setresuid /* 5115 */ | |
245 | PTR sys_getresuid | |
246 | PTR sys_setresgid | |
247 | PTR sys_getresgid | |
248 | PTR sys_getpgid | |
249 | PTR sys_setfsuid /* 5120 */ | |
250 | PTR sys_setfsgid | |
251 | PTR sys_getsid | |
252 | PTR sys_capget | |
253 | PTR sys_capset | |
254 | PTR sys_rt_sigpending /* 5125 */ | |
255 | PTR sys_rt_sigtimedwait | |
256 | PTR sys_rt_sigqueueinfo | |
257 | PTR sys_rt_sigsuspend | |
258 | PTR sys_sigaltstack | |
259 | PTR sys_utime /* 5130 */ | |
260 | PTR sys_mknod | |
261 | PTR sys_personality | |
262 | PTR sys_ustat | |
263 | PTR sys_statfs | |
264 | PTR sys_fstatfs /* 5135 */ | |
265 | PTR sys_sysfs | |
266 | PTR sys_getpriority | |
267 | PTR sys_setpriority | |
268 | PTR sys_sched_setparam | |
269 | PTR sys_sched_getparam /* 5140 */ | |
270 | PTR sys_sched_setscheduler | |
271 | PTR sys_sched_getscheduler | |
272 | PTR sys_sched_get_priority_max | |
273 | PTR sys_sched_get_priority_min | |
274 | PTR sys_sched_rr_get_interval /* 5145 */ | |
275 | PTR sys_mlock | |
276 | PTR sys_munlock | |
277 | PTR sys_mlockall | |
278 | PTR sys_munlockall | |
279 | PTR sys_vhangup /* 5150 */ | |
280 | PTR sys_pivot_root | |
281 | PTR sys_sysctl | |
282 | PTR sys_prctl | |
283 | PTR sys_adjtimex | |
284 | PTR sys_setrlimit /* 5155 */ | |
285 | PTR sys_chroot | |
286 | PTR sys_sync | |
287 | PTR sys_acct | |
288 | PTR sys_settimeofday | |
289 | PTR sys_mount /* 5160 */ | |
290 | PTR sys_umount | |
291 | PTR sys_swapon | |
292 | PTR sys_swapoff | |
293 | PTR sys_reboot | |
294 | PTR sys_sethostname /* 5165 */ | |
295 | PTR sys_setdomainname | |
296 | PTR sys_ni_syscall /* was create_module */ | |
297 | PTR sys_init_module | |
298 | PTR sys_delete_module | |
299 | PTR sys_ni_syscall /* 5170, was get_kernel_syms */ | |
300 | PTR sys_ni_syscall /* was query_module */ | |
301 | PTR sys_quotactl | |
f5b94099 | 302 | PTR sys_ni_syscall /* was nfsservctl */ |
1da177e4 LT |
303 | PTR sys_ni_syscall /* res. for getpmsg */ |
304 | PTR sys_ni_syscall /* 5175 for putpmsg */ | |
305 | PTR sys_ni_syscall /* res. for afs_syscall */ | |
306 | PTR sys_ni_syscall /* res. for security */ | |
307 | PTR sys_gettid | |
308 | PTR sys_readahead | |
309 | PTR sys_setxattr /* 5180 */ | |
310 | PTR sys_lsetxattr | |
311 | PTR sys_fsetxattr | |
312 | PTR sys_getxattr | |
313 | PTR sys_lgetxattr | |
314 | PTR sys_fgetxattr /* 5185 */ | |
315 | PTR sys_listxattr | |
316 | PTR sys_llistxattr | |
317 | PTR sys_flistxattr | |
318 | PTR sys_removexattr | |
319 | PTR sys_lremovexattr /* 5190 */ | |
320 | PTR sys_fremovexattr | |
321 | PTR sys_tkill | |
322 | PTR sys_ni_syscall | |
323 | PTR sys_futex | |
324 | PTR sys_sched_setaffinity /* 5195 */ | |
325 | PTR sys_sched_getaffinity | |
326 | PTR sys_cacheflush | |
327 | PTR sys_cachectl | |
328 | PTR sys_sysmips | |
329 | PTR sys_io_setup /* 5200 */ | |
330 | PTR sys_io_destroy | |
331 | PTR sys_io_getevents | |
332 | PTR sys_io_submit | |
333 | PTR sys_io_cancel | |
334 | PTR sys_exit_group /* 5205 */ | |
335 | PTR sys_lookup_dcookie | |
336 | PTR sys_epoll_create | |
337 | PTR sys_epoll_ctl | |
338 | PTR sys_epoll_wait | |
339 | PTR sys_remap_file_pages /* 5210 */ | |
340 | PTR sys_rt_sigreturn | |
341 | PTR sys_set_tid_address | |
342 | PTR sys_restart_syscall | |
343 | PTR sys_semtimedop | |
344 | PTR sys_fadvise64_64 /* 5215 */ | |
345 | PTR sys_timer_create | |
346 | PTR sys_timer_settime | |
347 | PTR sys_timer_gettime | |
348 | PTR sys_timer_getoverrun | |
349 | PTR sys_timer_delete /* 5220 */ | |
350 | PTR sys_clock_settime | |
351 | PTR sys_clock_gettime | |
352 | PTR sys_clock_getres | |
353 | PTR sys_clock_nanosleep | |
354 | PTR sys_tgkill /* 5225 */ | |
355 | PTR sys_utimes | |
356 | PTR sys_mbind | |
357 | PTR sys_ni_syscall /* sys_get_mempolicy */ | |
358 | PTR sys_ni_syscall /* sys_set_mempolicy */ | |
359 | PTR sys_mq_open /* 5230 */ | |
360 | PTR sys_mq_unlink | |
361 | PTR sys_mq_timedsend | |
362 | PTR sys_mq_timedreceive | |
363 | PTR sys_mq_notify | |
364 | PTR sys_mq_getsetattr /* 5235 */ | |
365 | PTR sys_ni_syscall /* sys_vserver */ | |
366 | PTR sys_waitid | |
367 | PTR sys_ni_syscall /* available, was setaltroot */ | |
368 | PTR sys_add_key | |
369 | PTR sys_request_key /* 5240 */ | |
370 | PTR sys_keyctl | |
3c37026d | 371 | PTR sys_set_thread_area |
7db36c85 RB |
372 | PTR sys_inotify_init |
373 | PTR sys_inotify_add_watch | |
374 | PTR sys_inotify_rm_watch /* 5245 */ | |
72bf8914 RB |
375 | PTR sys_migrate_pages |
376 | PTR sys_openat | |
377 | PTR sys_mkdirat | |
378 | PTR sys_mknodat | |
379 | PTR sys_fchownat /* 5250 */ | |
380 | PTR sys_futimesat | |
381 | PTR sys_newfstatat | |
382 | PTR sys_unlinkat | |
383 | PTR sys_renameat | |
384 | PTR sys_linkat /* 5255 */ | |
385 | PTR sys_symlinkat | |
386 | PTR sys_readlinkat | |
387 | PTR sys_fchmodat | |
388 | PTR sys_faccessat | |
389 | PTR sys_pselect6 /* 5260 */ | |
390 | PTR sys_ppoll | |
391 | PTR sys_unshare | |
f115da9c | 392 | PTR sys_splice |
a8d587a7 | 393 | PTR sys_sync_file_range |
136d47d3 | 394 | PTR sys_tee /* 5265 */ |
722cfd90 RB |
395 | PTR sys_vmsplice |
396 | PTR sys_move_pages | |
7fdeb048 AN |
397 | PTR sys_set_robust_list |
398 | PTR sys_get_robust_list | |
583bb86f | 399 | PTR sys_kexec_load /* 5270 */ |
991ea26d | 400 | PTR sys_getcpu |
e016c38d | 401 | PTR sys_epoll_pwait |
08253b39 RB |
402 | PTR sys_ioprio_set |
403 | PTR sys_ioprio_get | |
7a6d4f38 AN |
404 | PTR sys_utimensat /* 5275 */ |
405 | PTR sys_signalfd | |
8bdd5142 | 406 | PTR sys_ni_syscall /* was timerfd */ |
7a6d4f38 | 407 | PTR sys_eventfd |
4dc46775 | 408 | PTR sys_fallocate |
6783fe62 DV |
409 | PTR sys_timerfd_create /* 5280 */ |
410 | PTR sys_timerfd_gettime | |
411 | PTR sys_timerfd_settime | |
3885b71b RB |
412 | PTR sys_signalfd4 |
413 | PTR sys_eventfd2 | |
414 | PTR sys_epoll_create1 /* 5285 */ | |
415 | PTR sys_dup3 | |
416 | PTR sys_pipe2 | |
417 | PTR sys_inotify_init1 | |
ddd9e91b | 418 | PTR sys_preadv |
e080e616 | 419 | PTR sys_pwritev /* 5290 */ |
69f16c9a | 420 | PTR sys_rt_tgsigqueueinfo |
cdd6c482 | 421 | PTR sys_perf_event_open |
54822de7 | 422 | PTR sys_accept4 |
5e844b31 | 423 | PTR sys_recvmmsg |
e080e616 | 424 | PTR sys_fanotify_init /* 5295 */ |
5e844b31 DD |
425 | PTR sys_fanotify_mark |
426 | PTR sys_prlimit64 | |
84ed9432 DD |
427 | PTR sys_name_to_handle_at |
428 | PTR sys_open_by_handle_at | |
429 | PTR sys_clock_adjtime /* 5300 */ | |
1bbf2875 | 430 | PTR sys_syncfs |
b12acf16 | 431 | PTR sys_sendmmsg |
7b21fddd | 432 | PTR sys_setns |
08253b39 | 433 | .size sys_call_table,.-sys_call_table |