aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/scall64-64.S
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/mips/kernel/scall64-64.S
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/mips/kernel/scall64-64.S')
-rw-r--r--arch/mips/kernel/scall64-64.S451
1 files changed, 451 insertions, 0 deletions
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
new file mode 100644
index 000000000000..32efb888160a
--- /dev/null
+++ b/arch/mips/kernel/scall64-64.S
@@ -0,0 +1,451 @@
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 */
10#include <linux/config.h>
11#include <linux/errno.h>
12#include <asm/asm.h>
13#include <asm/asmmacro.h>
14#include <asm/mipsregs.h>
15#include <asm/regdef.h>
16#include <asm/stackframe.h>
17#include <asm/offset.h>
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
29NESTED(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
37 STI
38 .set at
39#endif
40
41 dsubu t0, v0, __NR_64_Linux # check syscall number
42 sltiu t0, t0, __NR_64_Linux_syscalls + 1
43#if !defined(CONFIG_MIPS32_O32) && !defined(CONFIG_MIPS32_N32)
44 ld t1, PT_EPC(sp) # skip syscall on return
45 daddiu t1, 4 # skip to next instruction
46 sd t1, PT_EPC(sp)
47#endif
48 beqz t0, illegal_syscall
49
50 dsll t0, v0, 3 # offset into table
51 ld t2, (sys_call_table - (__NR_64_Linux * 8))(t0)
52 # syscall routine
53
54 sd a3, PT_R26(sp) # save a3 for syscall restarting
55
56 li t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
57 LONG_L t0, TI_FLAGS($28) # syscall tracing enabled?
58 and t0, t1, t0
59 bnez t0, syscall_trace_entry
60
61 jalr t2 # Do The Real Thing (TM)
62
63 li t0, -EMAXERRNO - 1 # error?
64 sltu t0, t0, v0
65 sd t0, PT_R7(sp) # set error flag
66 beqz t0, 1f
67
68 dnegu v0 # error
69 sd v0, PT_R0(sp) # set flag for syscall
70 # restarting
711: sd v0, PT_R2(sp) # result
72
73n64_syscall_exit:
74 local_irq_disable # make sure need_resched and
75 # signals dont change between
76 # sampling and return
77 LONG_L a2, TI_FLAGS($28) # current->work
78 li t0, _TIF_ALLWORK_MASK
79 and t0, a2, t0
80 bnez t0, n64_syscall_exit_work
81
82 j restore_partial
83
84n64_syscall_exit_work:
85 j syscall_exit_work_partial
86
87/* ------------------------------------------------------------------------ */
88
89syscall_trace_entry:
90 SAVE_STATIC
91 move s0, t2
92 move a0, sp
93 li a1, 0
94 jal do_syscall_trace
95
96 ld a0, PT_R4(sp) # Restore argument registers
97 ld a1, PT_R5(sp)
98 ld a2, PT_R6(sp)
99 ld a3, PT_R7(sp)
100 ld a4, PT_R8(sp)
101 ld a5, PT_R9(sp)
102 jalr s0
103
104 li t0, -EMAXERRNO - 1 # error?
105 sltu t0, t0, v0
106 sd t0, PT_R7(sp) # set error flag
107 beqz t0, 1f
108
109 dnegu v0 # error
110 sd v0, PT_R0(sp) # set flag for syscall restarting
1111: sd v0, PT_R2(sp) # result
112
113 j syscall_exit
114
115illegal_syscall:
116 /* This also isn't a 64-bit syscall, throw an error. */
117 li v0, -ENOSYS # error
118 sd v0, PT_R2(sp)
119 li t0, 1 # set error flag
120 sd t0, PT_R7(sp)
121 j n64_syscall_exit
122 END(handle_sys64)
123
124 LEAF(mips_atomic_set)
125 andi v0, a1, 3 # must be word aligned
126 bnez v0, bad_alignment
127
128 LONG_L v1, TI_ADDR_LIMIT($28) # in legal address range?
129 LONG_ADDIU a0, a1, 4
130 or a0, a0, a1
131 and a0, a0, v1
132 bltz a0, bad_address
133
134#ifdef CONFIG_CPU_HAS_LLSC
135 /* Ok, this is the ll/sc case. World is sane :-) */
1361: ll v0, (a1)
137 move a0, a2
1382: sc a0, (a1)
139#if R10000_LLSC_WAR
140 beqzl a0, 1b
141#else
142 beqz a0, 1b
143#endif
144
145 .section __ex_table,"a"
146 PTR 1b, bad_stack
147 PTR 2b, bad_stack
148 .previous
149#else
150 sw a1, 16(sp)
151 sw a2, 20(sp)
152
153 move a0, sp
154 move a2, a1
155 li a1, 1
156 jal do_page_fault
157
158 lw a1, 16(sp)
159 lw a2, 20(sp)
160
161 /*
162 * At this point the page should be readable and writable unless
163 * there was no more memory available.
164 */
1651: lw v0, (a1)
1662: sw a2, (a1)
167
168 .section __ex_table,"a"
169 PTR 1b, no_mem
170 PTR 2b, no_mem
171 .previous
172#endif
173
174 sd zero, PT_R7(sp) # success
175 sd v0, PT_R2(sp) # result
176
177 /* Success, so skip usual error handling garbage. */
178 li t0, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
179 LONG_L a2, TI_FLAGS($28) # syscall tracing enabled?
180 and t0, a2, t0
181 bnez t0, 1f
182
183 j n64_syscall_exit
184
1851: SAVE_STATIC
186 move a0, sp
187 li a1, 1
188 jal do_syscall_trace
189 j syscall_exit
190
191no_mem: li v0, -ENOMEM
192 jr ra
193
194bad_address:
195 li v0, -EFAULT
196 jr ra
197
198bad_alignment:
199 li v0, -EINVAL
200 jr ra
201 END(mips_atomic_set)
202
203 LEAF(sys_sysmips)
204 beq a0, MIPS_ATOMIC_SET, mips_atomic_set
205 j _sys_sysmips
206 END(sys_sysmips)
207
208 .align 3
209sys_call_table:
210 PTR sys_read /* 5000 */
211 PTR sys_write
212 PTR sys_open
213 PTR sys_close
214 PTR sys_newstat
215 PTR sys_newfstat /* 5005 */
216 PTR sys_newlstat
217 PTR sys_poll
218 PTR sys_lseek
219 PTR old_mmap
220 PTR sys_mprotect /* 5010 */
221 PTR sys_munmap
222 PTR sys_brk
223 PTR sys_rt_sigaction
224 PTR sys_rt_sigprocmask
225 PTR sys_ioctl /* 5015 */
226 PTR sys_pread64
227 PTR sys_pwrite64
228 PTR sys_readv
229 PTR sys_writev
230 PTR sys_access /* 5020 */
231 PTR sys_pipe
232 PTR sys_select
233 PTR sys_sched_yield
234 PTR sys_mremap
235 PTR sys_msync /* 5025 */
236 PTR sys_mincore
237 PTR sys_madvise
238 PTR sys_shmget
239 PTR sys_shmat
240 PTR sys_shmctl /* 5030 */
241 PTR sys_dup
242 PTR sys_dup2
243 PTR sys_pause
244 PTR sys_nanosleep
245 PTR sys_getitimer /* 5035 */
246 PTR sys_setitimer
247 PTR sys_alarm
248 PTR sys_getpid
249 PTR sys_sendfile64
250 PTR sys_socket /* 5040 */
251 PTR sys_connect
252 PTR sys_accept
253 PTR sys_sendto
254 PTR sys_recvfrom
255 PTR sys_sendmsg /* 5045 */
256 PTR sys_recvmsg
257 PTR sys_shutdown
258 PTR sys_bind
259 PTR sys_listen
260 PTR sys_getsockname /* 5050 */
261 PTR sys_getpeername
262 PTR sys_socketpair
263 PTR sys_setsockopt
264 PTR sys_getsockopt
265 PTR sys_clone /* 5055 */
266 PTR sys_fork
267 PTR sys_execve
268 PTR sys_exit
269 PTR sys_wait4
270 PTR sys_kill /* 5060 */
271 PTR sys_newuname
272 PTR sys_semget
273 PTR sys_semop
274 PTR sys_semctl
275 PTR sys_shmdt /* 5065 */
276 PTR sys_msgget
277 PTR sys_msgsnd
278 PTR sys_msgrcv
279 PTR sys_msgctl
280 PTR sys_fcntl /* 5070 */
281 PTR sys_flock
282 PTR sys_fsync
283 PTR sys_fdatasync
284 PTR sys_truncate
285 PTR sys_ftruncate /* 5075 */
286 PTR sys_getdents
287 PTR sys_getcwd
288 PTR sys_chdir
289 PTR sys_fchdir
290 PTR sys_rename /* 5080 */
291 PTR sys_mkdir
292 PTR sys_rmdir
293 PTR sys_creat
294 PTR sys_link
295 PTR sys_unlink /* 5085 */
296 PTR sys_symlink
297 PTR sys_readlink
298 PTR sys_chmod
299 PTR sys_fchmod
300 PTR sys_chown /* 5090 */
301 PTR sys_fchown
302 PTR sys_lchown
303 PTR sys_umask
304 PTR sys_gettimeofday
305 PTR sys_getrlimit /* 5095 */
306 PTR sys_getrusage
307 PTR sys_sysinfo
308 PTR sys_times
309 PTR sys_ptrace
310 PTR sys_getuid /* 5100 */
311 PTR sys_syslog
312 PTR sys_getgid
313 PTR sys_setuid
314 PTR sys_setgid
315 PTR sys_geteuid /* 5105 */
316 PTR sys_getegid
317 PTR sys_setpgid
318 PTR sys_getppid
319 PTR sys_getpgrp
320 PTR sys_setsid /* 5110 */
321 PTR sys_setreuid
322 PTR sys_setregid
323 PTR sys_getgroups
324 PTR sys_setgroups
325 PTR sys_setresuid /* 5115 */
326 PTR sys_getresuid
327 PTR sys_setresgid
328 PTR sys_getresgid
329 PTR sys_getpgid
330 PTR sys_setfsuid /* 5120 */
331 PTR sys_setfsgid
332 PTR sys_getsid
333 PTR sys_capget
334 PTR sys_capset
335 PTR sys_rt_sigpending /* 5125 */
336 PTR sys_rt_sigtimedwait
337 PTR sys_rt_sigqueueinfo
338 PTR sys_rt_sigsuspend
339 PTR sys_sigaltstack
340 PTR sys_utime /* 5130 */
341 PTR sys_mknod
342 PTR sys_personality
343 PTR sys_ustat
344 PTR sys_statfs
345 PTR sys_fstatfs /* 5135 */
346 PTR sys_sysfs
347 PTR sys_getpriority
348 PTR sys_setpriority
349 PTR sys_sched_setparam
350 PTR sys_sched_getparam /* 5140 */
351 PTR sys_sched_setscheduler
352 PTR sys_sched_getscheduler
353 PTR sys_sched_get_priority_max
354 PTR sys_sched_get_priority_min
355 PTR sys_sched_rr_get_interval /* 5145 */
356 PTR sys_mlock
357 PTR sys_munlock
358 PTR sys_mlockall
359 PTR sys_munlockall
360 PTR sys_vhangup /* 5150 */
361 PTR sys_pivot_root
362 PTR sys_sysctl
363 PTR sys_prctl
364 PTR sys_adjtimex
365 PTR sys_setrlimit /* 5155 */
366 PTR sys_chroot
367 PTR sys_sync
368 PTR sys_acct
369 PTR sys_settimeofday
370 PTR sys_mount /* 5160 */
371 PTR sys_umount
372 PTR sys_swapon
373 PTR sys_swapoff
374 PTR sys_reboot
375 PTR sys_sethostname /* 5165 */
376 PTR sys_setdomainname
377 PTR sys_ni_syscall /* was create_module */
378 PTR sys_init_module
379 PTR sys_delete_module
380 PTR sys_ni_syscall /* 5170, was get_kernel_syms */
381 PTR sys_ni_syscall /* was query_module */
382 PTR sys_quotactl
383 PTR sys_nfsservctl
384 PTR sys_ni_syscall /* res. for getpmsg */
385 PTR sys_ni_syscall /* 5175 for putpmsg */
386 PTR sys_ni_syscall /* res. for afs_syscall */
387 PTR sys_ni_syscall /* res. for security */
388 PTR sys_gettid
389 PTR sys_readahead
390 PTR sys_setxattr /* 5180 */
391 PTR sys_lsetxattr
392 PTR sys_fsetxattr
393 PTR sys_getxattr
394 PTR sys_lgetxattr
395 PTR sys_fgetxattr /* 5185 */
396 PTR sys_listxattr
397 PTR sys_llistxattr
398 PTR sys_flistxattr
399 PTR sys_removexattr
400 PTR sys_lremovexattr /* 5190 */
401 PTR sys_fremovexattr
402 PTR sys_tkill
403 PTR sys_ni_syscall
404 PTR sys_futex
405 PTR sys_sched_setaffinity /* 5195 */
406 PTR sys_sched_getaffinity
407 PTR sys_cacheflush
408 PTR sys_cachectl
409 PTR sys_sysmips
410 PTR sys_io_setup /* 5200 */
411 PTR sys_io_destroy
412 PTR sys_io_getevents
413 PTR sys_io_submit
414 PTR sys_io_cancel
415 PTR sys_exit_group /* 5205 */
416 PTR sys_lookup_dcookie
417 PTR sys_epoll_create
418 PTR sys_epoll_ctl
419 PTR sys_epoll_wait
420 PTR sys_remap_file_pages /* 5210 */
421 PTR sys_rt_sigreturn
422 PTR sys_set_tid_address
423 PTR sys_restart_syscall
424 PTR sys_semtimedop
425 PTR sys_fadvise64_64 /* 5215 */
426 PTR sys_timer_create
427 PTR sys_timer_settime
428 PTR sys_timer_gettime
429 PTR sys_timer_getoverrun
430 PTR sys_timer_delete /* 5220 */
431 PTR sys_clock_settime
432 PTR sys_clock_gettime
433 PTR sys_clock_getres
434 PTR sys_clock_nanosleep
435 PTR sys_tgkill /* 5225 */
436 PTR sys_utimes
437 PTR sys_mbind
438 PTR sys_ni_syscall /* sys_get_mempolicy */
439 PTR sys_ni_syscall /* sys_set_mempolicy */
440 PTR sys_mq_open /* 5230 */
441 PTR sys_mq_unlink
442 PTR sys_mq_timedsend
443 PTR sys_mq_timedreceive
444 PTR sys_mq_notify
445 PTR sys_mq_getsetattr /* 5235 */
446 PTR sys_ni_syscall /* sys_vserver */
447 PTR sys_waitid
448 PTR sys_ni_syscall /* available, was setaltroot */
449 PTR sys_add_key
450 PTR sys_request_key /* 5240 */
451 PTR sys_keyctl