diff options
Diffstat (limited to 'arch/arm/kernel/sys_arm.c')
| -rw-r--r-- | arch/arm/kernel/sys_arm.c | 184 |
1 files changed, 1 insertions, 183 deletions
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c index 78ecaac65206..c23501842b98 100644 --- a/arch/arm/kernel/sys_arm.c +++ b/arch/arm/kernel/sys_arm.c | |||
| @@ -15,7 +15,6 @@ | |||
| 15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
| 16 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
| 17 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
| 18 | #include <linux/slab.h> | ||
| 19 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
| 20 | #include <linux/sem.h> | 19 | #include <linux/sem.h> |
| 21 | #include <linux/msg.h> | 20 | #include <linux/msg.h> |
| @@ -27,188 +26,7 @@ | |||
| 27 | #include <linux/file.h> | 26 | #include <linux/file.h> |
| 28 | #include <linux/ipc.h> | 27 | #include <linux/ipc.h> |
| 29 | #include <linux/uaccess.h> | 28 | #include <linux/uaccess.h> |
| 30 | 29 | #include <linux/slab.h> | |
| 31 | extern unsigned long do_mremap(unsigned long addr, unsigned long old_len, | ||
| 32 | unsigned long new_len, unsigned long flags, | ||
| 33 | unsigned long new_addr); | ||
| 34 | |||
| 35 | /* common code for old and new mmaps */ | ||
| 36 | inline long do_mmap2( | ||
| 37 | unsigned long addr, unsigned long len, | ||
| 38 | unsigned long prot, unsigned long flags, | ||
| 39 | unsigned long fd, unsigned long pgoff) | ||
| 40 | { | ||
| 41 | int error = -EINVAL; | ||
| 42 | struct file * file = NULL; | ||
| 43 | |||
| 44 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
| 45 | |||
| 46 | if (flags & MAP_FIXED && addr < FIRST_USER_ADDRESS) | ||
| 47 | goto out; | ||
| 48 | |||
| 49 | error = -EBADF; | ||
| 50 | if (!(flags & MAP_ANONYMOUS)) { | ||
| 51 | file = fget(fd); | ||
| 52 | if (!file) | ||
| 53 | goto out; | ||
| 54 | } | ||
| 55 | |||
| 56 | down_write(¤t->mm->mmap_sem); | ||
| 57 | error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | ||
| 58 | up_write(¤t->mm->mmap_sem); | ||
| 59 | |||
| 60 | if (file) | ||
| 61 | fput(file); | ||
| 62 | out: | ||
| 63 | return error; | ||
| 64 | } | ||
| 65 | |||
| 66 | struct mmap_arg_struct { | ||
| 67 | unsigned long addr; | ||
| 68 | unsigned long len; | ||
| 69 | unsigned long prot; | ||
| 70 | unsigned long flags; | ||
| 71 | unsigned long fd; | ||
| 72 | unsigned long offset; | ||
| 73 | }; | ||
| 74 | |||
| 75 | asmlinkage int old_mmap(struct mmap_arg_struct __user *arg) | ||
| 76 | { | ||
| 77 | int error = -EFAULT; | ||
| 78 | struct mmap_arg_struct a; | ||
| 79 | |||
| 80 | if (copy_from_user(&a, arg, sizeof(a))) | ||
| 81 | goto out; | ||
| 82 | |||
| 83 | error = -EINVAL; | ||
| 84 | if (a.offset & ~PAGE_MASK) | ||
| 85 | goto out; | ||
| 86 | |||
| 87 | error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); | ||
| 88 | out: | ||
| 89 | return error; | ||
| 90 | } | ||
| 91 | |||
| 92 | asmlinkage unsigned long | ||
| 93 | sys_arm_mremap(unsigned long addr, unsigned long old_len, | ||
| 94 | unsigned long new_len, unsigned long flags, | ||
| 95 | unsigned long new_addr) | ||
| 96 | { | ||
| 97 | unsigned long ret = -EINVAL; | ||
| 98 | |||
| 99 | if (flags & MREMAP_FIXED && new_addr < FIRST_USER_ADDRESS) | ||
| 100 | goto out; | ||
| 101 | |||
| 102 | down_write(¤t->mm->mmap_sem); | ||
| 103 | ret = do_mremap(addr, old_len, new_len, flags, new_addr); | ||
| 104 | up_write(¤t->mm->mmap_sem); | ||
| 105 | |||
| 106 | out: | ||
| 107 | return ret; | ||
| 108 | } | ||
| 109 | |||
| 110 | /* | ||
| 111 | * Perform the select(nd, in, out, ex, tv) and mmap() system | ||
| 112 | * calls. | ||
| 113 | */ | ||
| 114 | |||
| 115 | struct sel_arg_struct { | ||
| 116 | unsigned long n; | ||
| 117 | fd_set __user *inp, *outp, *exp; | ||
| 118 | struct timeval __user *tvp; | ||
| 119 | }; | ||
| 120 | |||
| 121 | asmlinkage int old_select(struct sel_arg_struct __user *arg) | ||
| 122 | { | ||
| 123 | struct sel_arg_struct a; | ||
| 124 | |||
| 125 | if (copy_from_user(&a, arg, sizeof(a))) | ||
| 126 | return -EFAULT; | ||
| 127 | /* sys_select() does the appropriate kernel locking */ | ||
| 128 | return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); | ||
| 129 | } | ||
| 130 | |||
| 131 | #if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT) | ||
| 132 | /* | ||
| 133 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. | ||
| 134 | * | ||
| 135 | * This is really horribly ugly. | ||
| 136 | */ | ||
| 137 | asmlinkage int sys_ipc(uint call, int first, int second, int third, | ||
| 138 | void __user *ptr, long fifth) | ||
| 139 | { | ||
| 140 | int version, ret; | ||
| 141 | |||
| 142 | version = call >> 16; /* hack for backward compatibility */ | ||
| 143 | call &= 0xffff; | ||
| 144 | |||
| 145 | switch (call) { | ||
| 146 | case SEMOP: | ||
| 147 | return sys_semtimedop (first, (struct sembuf __user *)ptr, second, NULL); | ||
| 148 | case SEMTIMEDOP: | ||
| 149 | return sys_semtimedop(first, (struct sembuf __user *)ptr, second, | ||
| 150 | (const struct timespec __user *)fifth); | ||
| 151 | |||
| 152 | case SEMGET: | ||
| 153 | return sys_semget (first, second, third); | ||
| 154 | case SEMCTL: { | ||
| 155 | union semun fourth; | ||
| 156 | if (!ptr) | ||
| 157 | return -EINVAL; | ||
| 158 | if (get_user(fourth.__pad, (void __user * __user *) ptr)) | ||
| 159 | return -EFAULT; | ||
| 160 | return sys_semctl (first, second, third, fourth); | ||
| 161 | } | ||
| 162 | |||
| 163 | case MSGSND: | ||
| 164 | return sys_msgsnd(first, (struct msgbuf __user *) ptr, | ||
| 165 | second, third); | ||
| 166 | case MSGRCV: | ||
| 167 | switch (version) { | ||
| 168 | case 0: { | ||
| 169 | struct ipc_kludge tmp; | ||
| 170 | if (!ptr) | ||
| 171 | return -EINVAL; | ||
| 172 | if (copy_from_user(&tmp,(struct ipc_kludge __user *)ptr, | ||
| 173 | sizeof (tmp))) | ||
| 174 | return -EFAULT; | ||
| 175 | return sys_msgrcv (first, tmp.msgp, second, | ||
| 176 | tmp.msgtyp, third); | ||
| 177 | } | ||
| 178 | default: | ||
| 179 | return sys_msgrcv (first, | ||
| 180 | (struct msgbuf __user *) ptr, | ||
| 181 | second, fifth, third); | ||
| 182 | } | ||
| 183 | case MSGGET: | ||
| 184 | return sys_msgget ((key_t) first, second); | ||
| 185 | case MSGCTL: | ||
| 186 | return sys_msgctl(first, second, (struct msqid_ds __user *)ptr); | ||
| 187 | |||
| 188 | case SHMAT: | ||
| 189 | switch (version) { | ||
| 190 | default: { | ||
| 191 | ulong raddr; | ||
| 192 | ret = do_shmat(first, (char __user *)ptr, second, &raddr); | ||
| 193 | if (ret) | ||
| 194 | return ret; | ||
| 195 | return put_user(raddr, (ulong __user *)third); | ||
| 196 | } | ||
| 197 | case 1: /* Of course, we don't support iBCS2! */ | ||
| 198 | return -EINVAL; | ||
| 199 | } | ||
| 200 | case SHMDT: | ||
| 201 | return sys_shmdt ((char __user *)ptr); | ||
| 202 | case SHMGET: | ||
| 203 | return sys_shmget (first, second, third); | ||
| 204 | case SHMCTL: | ||
| 205 | return sys_shmctl (first, second, | ||
| 206 | (struct shmid_ds __user *) ptr); | ||
| 207 | default: | ||
| 208 | return -ENOSYS; | ||
| 209 | } | ||
| 210 | } | ||
| 211 | #endif | ||
| 212 | 30 | ||
| 213 | /* Fork a new task - this creates a new program thread. | 31 | /* Fork a new task - this creates a new program thread. |
| 214 | * This is called indirectly via a small wrapper | 32 | * This is called indirectly via a small wrapper |
