aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/kernel/sys_microblaze.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/microblaze/kernel/sys_microblaze.c')
-rw-r--r--arch/microblaze/kernel/sys_microblaze.c118
1 files changed, 9 insertions, 109 deletions
diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c
index 31905ff590b7..b96f1682bb24 100644
--- a/arch/microblaze/kernel/sys_microblaze.c
+++ b/arch/microblaze/kernel/sys_microblaze.c
@@ -15,7 +15,6 @@
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/smp.h> 17#include <linux/smp.h>
18#include <linux/smp_lock.h>
19#include <linux/syscalls.h> 18#include <linux/syscalls.h>
20#include <linux/sem.h> 19#include <linux/sem.h>
21#include <linux/msg.h> 20#include <linux/msg.h>
@@ -34,120 +33,21 @@
34#include <linux/unistd.h> 33#include <linux/unistd.h>
35 34
36#include <asm/syscalls.h> 35#include <asm/syscalls.h>
37/*
38 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
39 *
40 * This is really horribly ugly. This will be remove with new toolchain.
41 */
42asmlinkage int
43sys_ipc(uint call, int first, int second, int third, void *ptr, long fifth)
44{
45 int version, ret;
46
47 version = call >> 16; /* hack for backward compatibility */
48 call &= 0xffff;
49
50 ret = -EINVAL;
51 switch (call) {
52 case SEMOP:
53 ret = sys_semop(first, (struct sembuf *)ptr, second);
54 break;
55 case SEMGET:
56 ret = sys_semget(first, second, third);
57 break;
58 case SEMCTL:
59 {
60 union semun fourth;
61
62 if (!ptr)
63 break;
64 ret = (access_ok(VERIFY_READ, ptr, sizeof(long)) ? 0 : -EFAULT)
65 || (get_user(fourth.__pad, (void **)ptr)) ;
66 if (ret)
67 break;
68 ret = sys_semctl(first, second, third, fourth);
69 break;
70 }
71 case MSGSND:
72 ret = sys_msgsnd(first, (struct msgbuf *) ptr, second, third);
73 break;
74 case MSGRCV:
75 switch (version) {
76 case 0: {
77 struct ipc_kludge tmp;
78
79 if (!ptr)
80 break;
81 ret = (access_ok(VERIFY_READ, ptr, sizeof(tmp))
82 ? 0 : -EFAULT) || copy_from_user(&tmp,
83 (struct ipc_kludge *) ptr, sizeof(tmp));
84 if (ret)
85 break;
86 ret = sys_msgrcv(first, tmp.msgp, second, tmp.msgtyp,
87 third);
88 break;
89 }
90 default:
91 ret = sys_msgrcv(first, (struct msgbuf *) ptr,
92 second, fifth, third);
93 break;
94 }
95 break;
96 case MSGGET:
97 ret = sys_msgget((key_t) first, second);
98 break;
99 case MSGCTL:
100 ret = sys_msgctl(first, second, (struct msqid_ds *) ptr);
101 break;
102 case SHMAT:
103 switch (version) {
104 default: {
105 ulong raddr;
106 ret = access_ok(VERIFY_WRITE, (ulong *) third,
107 sizeof(ulong)) ? 0 : -EFAULT;
108 if (ret)
109 break;
110 ret = do_shmat(first, (char *) ptr, second, &raddr);
111 if (ret)
112 break;
113 ret = put_user(raddr, (ulong *) third);
114 break;
115 }
116 case 1: /* iBCS2 emulator entry point */
117 if (!segment_eq(get_fs(), get_ds()))
118 break;
119 ret = do_shmat(first, (char *) ptr, second,
120 (ulong *) third);
121 break;
122 }
123 break;
124 case SHMDT:
125 ret = sys_shmdt((char *)ptr);
126 break;
127 case SHMGET:
128 ret = sys_shmget(first, second, third);
129 break;
130 case SHMCTL:
131 ret = sys_shmctl(first, second, (struct shmid_ds *) ptr);
132 break;
133 }
134 return ret;
135}
136 36
137asmlinkage int sys_vfork(struct pt_regs *regs) 37asmlinkage long microblaze_vfork(struct pt_regs *regs)
138{ 38{
139 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->r1, 39 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->r1,
140 regs, 0, NULL, NULL); 40 regs, 0, NULL, NULL);
141} 41}
142 42
143asmlinkage int sys_clone(int flags, unsigned long stack, struct pt_regs *regs) 43asmlinkage long microblaze_clone(int flags, unsigned long stack, struct pt_regs *regs)
144{ 44{
145 if (!stack) 45 if (!stack)
146 stack = regs->r1; 46 stack = regs->r1;
147 return do_fork(flags, stack, regs, 0, NULL, NULL); 47 return do_fork(flags, stack, regs, 0, NULL, NULL);
148} 48}
149 49
150asmlinkage int sys_execve(char __user *filenamei, char __user *__user *argv, 50asmlinkage long microblaze_execve(char __user *filenamei, char __user *__user *argv,
151 char __user *__user *envp, struct pt_regs *regs) 51 char __user *__user *envp, struct pt_regs *regs)
152{ 52{
153 int error; 53 int error;
@@ -163,8 +63,8 @@ out:
163 return error; 63 return error;
164} 64}
165 65
166asmlinkage unsigned long 66asmlinkage long
167sys_mmap2(unsigned long addr, size_t len, 67sys_mmap2(unsigned long addr, unsigned long len,
168 unsigned long prot, unsigned long flags, 68 unsigned long prot, unsigned long flags,
169 unsigned long fd, unsigned long pgoff) 69 unsigned long fd, unsigned long pgoff)
170{ 70{
@@ -189,18 +89,18 @@ out:
189 return ret; 89 return ret;
190} 90}
191 91
192asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len, 92asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
193 unsigned long prot, unsigned long flags, 93 unsigned long prot, unsigned long flags,
194 unsigned long fd, off_t offset) 94 unsigned long fd, off_t pgoff)
195{ 95{
196 int err = -EINVAL; 96 int err = -EINVAL;
197 97
198 if (offset & ~PAGE_MASK) { 98 if (pgoff & ~PAGE_MASK) {
199 printk(KERN_INFO "no pagemask in mmap\r\n"); 99 printk(KERN_INFO "no pagemask in mmap\r\n");
200 goto out; 100 goto out;
201 } 101 }
202 102
203 err = sys_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); 103 err = sys_mmap2(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT);
204out: 104out:
205 return err; 105 return err;
206} 106}