aboutsummaryrefslogtreecommitdiffstats
path: root/arch/xtensa
diff options
context:
space:
mode:
Diffstat (limited to 'arch/xtensa')
-rw-r--r--arch/xtensa/kernel/syscalls.c152
-rw-r--r--arch/xtensa/kernel/syscalls.h57
2 files changed, 30 insertions, 179 deletions
diff --git a/arch/xtensa/kernel/syscalls.c b/arch/xtensa/kernel/syscalls.c
index abc8ed6c7026..3540d8b119f3 100644
--- a/arch/xtensa/kernel/syscalls.c
+++ b/arch/xtensa/kernel/syscalls.c
@@ -46,8 +46,6 @@
46 46
47extern void do_syscall_trace(void); 47extern void do_syscall_trace(void);
48typedef int (*syscall_t)(void *a0,...); 48typedef int (*syscall_t)(void *a0,...);
49extern int (*do_syscalls)(struct pt_regs *regs, syscall_t fun,
50 int narg);
51extern syscall_t sys_call_table[]; 49extern syscall_t sys_call_table[];
52extern unsigned char sys_narg_table[]; 50extern unsigned char sys_narg_table[];
53 51
@@ -72,10 +70,8 @@ int sys_pipe(int __user *userfds)
72/* 70/*
73 * Common code for old and new mmaps. 71 * Common code for old and new mmaps.
74 */ 72 */
75 73long sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
76static inline long do_mmap2(unsigned long addr, unsigned long len, 74 unsigned long flags, unsigned long fd, unsigned long pgoff)
77 unsigned long prot, unsigned long flags,
78 unsigned long fd, unsigned long pgoff)
79{ 75{
80 int error = -EBADF; 76 int error = -EBADF;
81 struct file * file = NULL; 77 struct file * file = NULL;
@@ -97,29 +93,6 @@ out:
97 return error; 93 return error;
98} 94}
99 95
100unsigned long old_mmap(unsigned long addr, size_t len, int prot,
101 int flags, int fd, off_t offset)
102{
103 return do_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
104}
105
106long sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
107 unsigned long flags, unsigned long fd, unsigned long pgoff)
108{
109 return do_mmap2(addr, len, prot, flags, fd, pgoff);
110}
111
112int sys_fork(struct pt_regs *regs)
113{
114 return do_fork(SIGCHLD, regs->areg[1], regs, 0, NULL, NULL);
115}
116
117int sys_vfork(struct pt_regs *regs)
118{
119 return do_fork(CLONE_VFORK|CLONE_VM|SIGCHLD, regs->areg[1],
120 regs, 0, NULL, NULL);
121}
122
123int sys_clone(struct pt_regs *regs) 96int sys_clone(struct pt_regs *regs)
124{ 97{
125 unsigned long clone_flags; 98 unsigned long clone_flags;
@@ -162,30 +135,6 @@ int sys_uname(struct old_utsname * name)
162 return -EFAULT; 135 return -EFAULT;
163} 136}
164 137
165int sys_olduname(struct oldold_utsname * name)
166{
167 int error;
168
169 if (!name)
170 return -EFAULT;
171 if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname)))
172 return -EFAULT;
173
174 error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN);
175 error -= __put_user(0,name->sysname+__OLD_UTS_LEN);
176 error -= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN);
177 error -= __put_user(0,name->nodename+__OLD_UTS_LEN);
178 error -= __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN);
179 error -= __put_user(0,name->release+__OLD_UTS_LEN);
180 error -= __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN);
181 error -= __put_user(0,name->version+__OLD_UTS_LEN);
182 error -= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN);
183 error -= __put_user(0,name->machine+__OLD_UTS_LEN);
184
185 return error ? -EFAULT : 0;
186}
187
188
189/* 138/*
190 * Build the string table for the builtin "poor man's strace". 139 * Build the string table for the builtin "poor man's strace".
191 */ 140 */
@@ -319,100 +268,3 @@ void system_call (struct pt_regs *regs)
319 regs->areg[2] = res; 268 regs->areg[2] = res;
320 do_syscall_trace(); 269 do_syscall_trace();
321} 270}
322
323/*
324 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
325 *
326 * This is really horribly ugly.
327 */
328
329int sys_ipc (uint call, int first, int second,
330 int third, void __user *ptr, long fifth)
331{
332 int version, ret;
333
334 version = call >> 16; /* hack for backward compatibility */
335 call &= 0xffff;
336 ret = -ENOSYS;
337
338 switch (call) {
339 case SEMOP:
340 ret = sys_semtimedop (first, (struct sembuf __user *)ptr,
341 second, NULL);
342 break;
343
344 case SEMTIMEDOP:
345 ret = sys_semtimedop (first, (struct sembuf __user *)ptr,
346 second, (const struct timespec *) fifth);
347 break;
348
349 case SEMGET:
350 ret = sys_semget (first, second, third);
351 break;
352
353 case SEMCTL: {
354 union semun fourth;
355
356 if (ptr && !get_user(fourth.__pad, (void *__user *) ptr))
357 ret = sys_semctl (first, second, third, fourth);
358 break;
359 }
360
361 case MSGSND:
362 ret = sys_msgsnd (first, (struct msgbuf __user*) ptr,
363 second, third);
364 break;
365
366 case MSGRCV:
367 switch (version) {
368 case 0: {
369 struct ipc_kludge tmp;
370
371 if (ptr && !copy_from_user(&tmp,
372 (struct ipc_kludge *) ptr,
373 sizeof (tmp)))
374 ret = sys_msgrcv (first, tmp.msgp, second,
375 tmp.msgtyp, third);
376 break;
377 }
378
379 default:
380 ret = sys_msgrcv (first, (struct msgbuf __user *) ptr,
381 second, 0, third);
382 break;
383 }
384 break;
385
386 case MSGGET:
387 ret = sys_msgget ((key_t) first, second);
388 break;
389
390 case MSGCTL:
391 ret = sys_msgctl (first, second, (struct msqid_ds __user*) ptr);
392 break;
393
394 case SHMAT: {
395 ulong raddr;
396 ret = do_shmat (first, (char __user *) ptr, second, &raddr);
397
398 if (!ret)
399 ret = put_user (raddr, (ulong __user *) third);
400
401 break;
402 }
403
404 case SHMDT:
405 ret = sys_shmdt ((char __user *)ptr);
406 break;
407
408 case SHMGET:
409 ret = sys_shmget (first, second, third);
410 break;
411
412 case SHMCTL:
413 ret = sys_shmctl (first, second, (struct shmid_ds __user*) ptr);
414 break;
415 }
416 return ret;
417}
418
diff --git a/arch/xtensa/kernel/syscalls.h b/arch/xtensa/kernel/syscalls.h
index 5b3f75f50feb..07580696b602 100644
--- a/arch/xtensa/kernel/syscalls.h
+++ b/arch/xtensa/kernel/syscalls.h
@@ -25,20 +25,19 @@
25 */ 25 */
26 26
27SYSCALL(0, 0) /* 00 */ 27SYSCALL(0, 0) /* 00 */
28
29SYSCALL(sys_exit, 1) 28SYSCALL(sys_exit, 1)
30SYSCALL(sys_fork, 0) 29SYSCALL(sys_ni_syscall, 0)
31SYSCALL(sys_read, 3) 30SYSCALL(sys_read, 3)
32SYSCALL(sys_write, 3) 31SYSCALL(sys_write, 3)
33SYSCALL(sys_open, 3) /* 05 */ 32SYSCALL(sys_open, 3) /* 05 */
34SYSCALL(sys_close, 1) 33SYSCALL(sys_close, 1)
35SYSCALL(sys_waitpid, 3) 34SYSCALL(sys_ni_syscall, 3)
36SYSCALL(sys_creat, 2) 35SYSCALL(sys_creat, 2)
37SYSCALL(sys_link, 2) 36SYSCALL(sys_link, 2)
38SYSCALL(sys_unlink, 1) /* 10 */ 37SYSCALL(sys_unlink, 1) /* 10 */
39SYSCALL(sys_execve, 0) 38SYSCALL(sys_execve, 0)
40SYSCALL(sys_chdir, 1) 39SYSCALL(sys_chdir, 1)
41SYSCALL(sys_time, 1) 40SYSCALL(sys_ni_syscall, 1)
42SYSCALL(sys_mknod, 3) 41SYSCALL(sys_mknod, 3)
43SYSCALL(sys_chmod, 2) /* 15 */ 42SYSCALL(sys_chmod, 2) /* 15 */
44SYSCALL(sys_lchown, 3) 43SYSCALL(sys_lchown, 3)
@@ -47,19 +46,19 @@ SYSCALL(sys_stat, 2)
47SYSCALL(sys_lseek, 3) 46SYSCALL(sys_lseek, 3)
48SYSCALL(sys_getpid, 0) /* 20 */ 47SYSCALL(sys_getpid, 0) /* 20 */
49SYSCALL(sys_mount, 5) 48SYSCALL(sys_mount, 5)
50SYSCALL(sys_oldumount, 1) 49SYSCALL(sys_ni_syscall, 1)
51SYSCALL(sys_setuid, 1) 50SYSCALL(sys_setuid, 1)
52SYSCALL(sys_getuid, 0) 51SYSCALL(sys_getuid, 0)
53SYSCALL(sys_stime, 1) /* 25 */ 52SYSCALL(sys_ni_syscall, 1) /* 25 */
54SYSCALL(sys_ptrace, 4) 53SYSCALL(sys_ptrace, 4)
55SYSCALL(sys_alarm, 1) 54SYSCALL(sys_ni_syscall, 1)
56SYSCALL(sys_fstat, 2) 55SYSCALL(sys_fstat, 2)
57SYSCALL(sys_pause, 0) 56SYSCALL(sys_ni_syscall, 0)
58SYSCALL(sys_utime, 2) /* 30 */ 57SYSCALL(sys_utime, 2) /* 30 */
59SYSCALL(sys_ni_syscall, 0) 58SYSCALL(sys_ni_syscall, 0)
60SYSCALL(sys_ni_syscall, 0) 59SYSCALL(sys_ni_syscall, 0)
61SYSCALL(sys_access, 2) 60SYSCALL(sys_access, 2)
62SYSCALL(sys_nice, 1) 61SYSCALL(sys_ni_syscall, 1)
63SYSCALL(sys_ni_syscall, 0) /* 35 */ 62SYSCALL(sys_ni_syscall, 0) /* 35 */
64SYSCALL(sys_sync, 0) 63SYSCALL(sys_sync, 0)
65SYSCALL(sys_kill, 2) 64SYSCALL(sys_kill, 2)
@@ -73,7 +72,7 @@ SYSCALL(sys_ni_syscall, 0)
73SYSCALL(sys_brk, 1) /* 45 */ 72SYSCALL(sys_brk, 1) /* 45 */
74SYSCALL(sys_setgid, 1) 73SYSCALL(sys_setgid, 1)
75SYSCALL(sys_getgid, 0) 74SYSCALL(sys_getgid, 0)
76SYSCALL(sys_ni_syscall, 0) /* was signal(2) */ 75SYSCALL(sys_ni_syscall, 0)
77SYSCALL(sys_geteuid, 0) 76SYSCALL(sys_geteuid, 0)
78SYSCALL(sys_getegid, 0) /* 50 */ 77SYSCALL(sys_getegid, 0) /* 50 */
79SYSCALL(sys_acct, 1) 78SYSCALL(sys_acct, 1)
@@ -84,21 +83,21 @@ SYSCALL(sys_fcntl, 3) /* 55 */
84SYSCALL(sys_ni_syscall, 2) 83SYSCALL(sys_ni_syscall, 2)
85SYSCALL(sys_setpgid, 2) 84SYSCALL(sys_setpgid, 2)
86SYSCALL(sys_ni_syscall, 0) 85SYSCALL(sys_ni_syscall, 0)
87SYSCALL(sys_olduname, 1) 86SYSCALL(sys_ni_syscall, 0)
88SYSCALL(sys_umask, 1) /* 60 */ 87SYSCALL(sys_umask, 1) /* 60 */
89SYSCALL(sys_chroot, 1) 88SYSCALL(sys_chroot, 1)
90SYSCALL(sys_ustat, 2) 89SYSCALL(sys_ustat, 2)
91SYSCALL(sys_dup2, 2) 90SYSCALL(sys_dup2, 2)
92SYSCALL(sys_getppid, 0) 91SYSCALL(sys_getppid, 0)
93SYSCALL(sys_getpgrp, 0) /* 65 */ 92SYSCALL(sys_ni_syscall, 0) /* 65 */
94SYSCALL(sys_setsid, 0) 93SYSCALL(sys_setsid, 0)
95SYSCALL(sys_sigaction, 3) 94SYSCALL(sys_sigaction, 3)
96SYSCALL(sys_sgetmask, 0) 95SYSCALL(sys_ni_syscall, 0)
97SYSCALL(sys_ssetmask, 1) 96SYSCALL(sys_ni_syscall, 1)
98SYSCALL(sys_setreuid, 2) /* 70 */ 97SYSCALL(sys_setreuid, 2) /* 70 */
99SYSCALL(sys_setregid, 2) 98SYSCALL(sys_setregid, 2)
100SYSCALL(sys_sigsuspend, 0) 99SYSCALL(sys_sigsuspend, 0)
101SYSCALL(sys_sigpending, 1) 100SYSCALL(sys_ni_syscall, 1)
102SYSCALL(sys_sethostname, 2) 101SYSCALL(sys_sethostname, 2)
103SYSCALL(sys_setrlimit, 2) /* 75 */ 102SYSCALL(sys_setrlimit, 2) /* 75 */
104SYSCALL(sys_getrlimit, 2) 103SYSCALL(sys_getrlimit, 2)
@@ -107,15 +106,15 @@ SYSCALL(sys_gettimeofday, 2)
107SYSCALL(sys_settimeofday, 2) 106SYSCALL(sys_settimeofday, 2)
108SYSCALL(sys_getgroups, 2) /* 80 */ 107SYSCALL(sys_getgroups, 2) /* 80 */
109SYSCALL(sys_setgroups, 2) 108SYSCALL(sys_setgroups, 2)
110SYSCALL(sys_ni_syscall, 0) /* old_select */ 109SYSCALL(sys_ni_syscall, 0)
111SYSCALL(sys_symlink, 2) 110SYSCALL(sys_symlink, 2)
112SYSCALL(sys_lstat, 2) 111SYSCALL(sys_lstat, 2)
113SYSCALL(sys_readlink, 3) /* 85 */ 112SYSCALL(sys_readlink, 3) /* 85 */
114SYSCALL(sys_uselib, 1) 113SYSCALL(sys_uselib, 1)
115SYSCALL(sys_swapon, 2) 114SYSCALL(sys_swapon, 2)
116SYSCALL(sys_reboot, 3) 115SYSCALL(sys_reboot, 3)
117SYSCALL(old_readdir, 3) 116SYSCALL(sys_ni_syscall, 3)
118SYSCALL(old_mmap, 6) /* 90 */ 117SYSCALL(sys_ni_syscall, 6) /* 90 */
119SYSCALL(sys_munmap, 2) 118SYSCALL(sys_munmap, 2)
120SYSCALL(sys_truncate, 2) 119SYSCALL(sys_truncate, 2)
121SYSCALL(sys_ftruncate, 2) 120SYSCALL(sys_ftruncate, 2)
@@ -127,7 +126,7 @@ SYSCALL(sys_ni_syscall, 0)
127SYSCALL(sys_statfs, 2) 126SYSCALL(sys_statfs, 2)
128SYSCALL(sys_fstatfs, 2) /* 100 */ 127SYSCALL(sys_fstatfs, 2) /* 100 */
129SYSCALL(sys_ni_syscall, 3) 128SYSCALL(sys_ni_syscall, 3)
130SYSCALL(sys_socketcall, 2) 129SYSCALL(sys_ni_syscall, 2)
131SYSCALL(sys_syslog, 3) 130SYSCALL(sys_syslog, 3)
132SYSCALL(sys_setitimer, 3) 131SYSCALL(sys_setitimer, 3)
133SYSCALL(sys_getitimer, 2) /* 105 */ 132SYSCALL(sys_getitimer, 2) /* 105 */
@@ -137,32 +136,32 @@ SYSCALL(sys_newfstat, 2)
137SYSCALL(sys_uname, 1) 136SYSCALL(sys_uname, 1)
138SYSCALL(sys_ni_syscall, 0) /* 110 */ 137SYSCALL(sys_ni_syscall, 0) /* 110 */
139SYSCALL(sys_vhangup, 0) 138SYSCALL(sys_vhangup, 0)
140SYSCALL(sys_ni_syscall, 0) /* was sys_idle() */ 139SYSCALL(sys_ni_syscall, 0)
141SYSCALL(sys_ni_syscall, 0) 140SYSCALL(sys_ni_syscall, 0)
142SYSCALL(sys_wait4, 4) 141SYSCALL(sys_wait4, 4)
143SYSCALL(sys_swapoff, 1) /* 115 */ 142SYSCALL(sys_swapoff, 1) /* 115 */
144SYSCALL(sys_sysinfo, 1) 143SYSCALL(sys_sysinfo, 1)
145SYSCALL(sys_ipc, 5) /* 6 really, but glibc uses only 5) */ 144SYSCALL(sys_ni_syscall, 0)
146SYSCALL(sys_fsync, 1) 145SYSCALL(sys_fsync, 1)
147SYSCALL(sys_sigreturn, 0) 146SYSCALL(sys_sigreturn, 0)
148SYSCALL(sys_clone, 0) /* 120 */ 147SYSCALL(sys_clone, 0) /* 120 */
149SYSCALL(sys_setdomainname, 2) 148SYSCALL(sys_setdomainname, 2)
150SYSCALL(sys_newuname, 1) 149SYSCALL(sys_newuname, 1)
151SYSCALL(sys_ni_syscall, 0) /* sys_modify_ldt */ 150SYSCALL(sys_ni_syscall, 0)
152SYSCALL(sys_adjtimex, 1) 151SYSCALL(sys_adjtimex, 1)
153SYSCALL(sys_mprotect, 3) /* 125 */ 152SYSCALL(sys_mprotect, 3) /* 125 */
154SYSCALL(sys_sigprocmask, 3) 153SYSCALL(sys_ni_syscall, 3)
155SYSCALL(sys_ni_syscall, 2) /* old sys_create_module */ 154SYSCALL(sys_ni_syscall, 2)
156SYSCALL(sys_init_module, 2) 155SYSCALL(sys_init_module, 2)
157SYSCALL(sys_delete_module, 1) 156SYSCALL(sys_delete_module, 1)
158SYSCALL(sys_ni_syscall, 1) /* old sys_get_kernel_sysm */ /* 130 */ 157SYSCALL(sys_ni_syscall, 1) /* 130 */
159SYSCALL(sys_quotactl, 0) 158SYSCALL(sys_quotactl, 0)
160SYSCALL(sys_getpgid, 1) 159SYSCALL(sys_getpgid, 1)
161SYSCALL(sys_fchdir, 1) 160SYSCALL(sys_fchdir, 1)
162SYSCALL(sys_bdflush, 2) 161SYSCALL(sys_bdflush, 2)
163SYSCALL(sys_sysfs, 3) /* 135 */ 162SYSCALL(sys_sysfs, 3) /* 135 */
164SYSCALL(sys_personality, 1) 163SYSCALL(sys_personality, 1)
165SYSCALL(sys_ni_syscall, 0) /* for afs_syscall */ 164SYSCALL(sys_ni_syscall, 0)
166SYSCALL(sys_setfsuid, 1) 165SYSCALL(sys_setfsuid, 1)
167SYSCALL(sys_setfsgid, 1) 166SYSCALL(sys_setfsgid, 1)
168SYSCALL(sys_llseek, 5) /* 140 */ 167SYSCALL(sys_llseek, 5) /* 140 */
@@ -212,7 +211,7 @@ SYSCALL(sys_socket, 3)
212SYSCALL(sys_socketpair, 4) 211SYSCALL(sys_socketpair, 4)
213SYSCALL(sys_setresuid, 3) /* 185 */ 212SYSCALL(sys_setresuid, 3) /* 185 */
214SYSCALL(sys_getresuid, 3) 213SYSCALL(sys_getresuid, 3)
215SYSCALL(sys_ni_syscall, 5) /* old sys_query_module */ 214SYSCALL(sys_ni_syscall, 5)
216SYSCALL(sys_poll, 3) 215SYSCALL(sys_poll, 3)
217SYSCALL(sys_nfsservctl, 3) 216SYSCALL(sys_nfsservctl, 3)
218SYSCALL(sys_setresgid, 3) /* 190 */ 217SYSCALL(sys_setresgid, 3) /* 190 */
@@ -235,7 +234,7 @@ SYSCALL(sys_sigaltstack, 0)
235SYSCALL(sys_sendfile, 4) 234SYSCALL(sys_sendfile, 4)
236SYSCALL(sys_ni_syscall, 0) 235SYSCALL(sys_ni_syscall, 0)
237SYSCALL(sys_ni_syscall, 0) 236SYSCALL(sys_ni_syscall, 0)
238SYSCALL(sys_mmap2, 6) /* 210 */ 237SYSCALL(sys_mmap, 6) /* 210 */
239SYSCALL(sys_truncate64, 2) 238SYSCALL(sys_truncate64, 2)
240SYSCALL(sys_ftruncate64, 2) 239SYSCALL(sys_ftruncate64, 2)
241SYSCALL(sys_stat64, 2) 240SYSCALL(sys_stat64, 2)
@@ -245,4 +244,4 @@ SYSCALL(sys_pivot_root, 2)
245SYSCALL(sys_mincore, 3) 244SYSCALL(sys_mincore, 3)
246SYSCALL(sys_madvise, 3) 245SYSCALL(sys_madvise, 3)
247SYSCALL(sys_getdents64, 3) 246SYSCALL(sys_getdents64, 3)
248SYSCALL(sys_vfork, 0) /* 220 */ 247SYSCALL(sys_ni_syscall, 0) /* 220 */