Blame view
arch/powerpc/kernel/sys_ppc32.c
21 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
/* * sys_ppc32.c: Conversion between 32bit and 64bit native syscalls. * * Copyright (C) 2001 IBM * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) * * These routines maintain argument size conversion between 32bit and 64bit * environment. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ |
1da177e4c Linux-2.6.12-rc2 |
16 17 18 19 20 21 22 23 |
#include <linux/kernel.h> #include <linux/sched.h> #include <linux/fs.h> #include <linux/mm.h> #include <linux/file.h> #include <linux/signal.h> #include <linux/resource.h> #include <linux/times.h> |
1da177e4c Linux-2.6.12-rc2 |
24 25 26 27 28 |
#include <linux/smp.h> #include <linux/smp_lock.h> #include <linux/sem.h> #include <linux/msg.h> #include <linux/shm.h> |
1da177e4c Linux-2.6.12-rc2 |
29 30 31 |
#include <linux/poll.h> #include <linux/personality.h> #include <linux/stat.h> |
1da177e4c Linux-2.6.12-rc2 |
32 |
#include <linux/mman.h> |
1da177e4c Linux-2.6.12-rc2 |
33 |
#include <linux/in.h> |
1da177e4c Linux-2.6.12-rc2 |
34 35 36 37 |
#include <linux/syscalls.h> #include <linux/unistd.h> #include <linux/sysctl.h> #include <linux/binfmts.h> |
1da177e4c Linux-2.6.12-rc2 |
38 39 40 |
#include <linux/security.h> #include <linux/compat.h> #include <linux/ptrace.h> |
1da177e4c Linux-2.6.12-rc2 |
41 |
#include <linux/elf.h> |
cba4fbbff remove include/as... |
42 |
#include <linux/ipc.h> |
1da177e4c Linux-2.6.12-rc2 |
43 |
|
1da177e4c Linux-2.6.12-rc2 |
44 45 |
#include <asm/ptrace.h> #include <asm/types.h> |
1da177e4c Linux-2.6.12-rc2 |
46 47 |
#include <asm/uaccess.h> #include <asm/unistd.h> |
1da177e4c Linux-2.6.12-rc2 |
48 49 |
#include <asm/time.h> #include <asm/mmu_context.h> |
d387899f3 powerpc: Move iSe... |
50 |
#include <asm/ppc-pci.h> |
369cf4b94 [POWERPC] fix mis... |
51 |
#include <asm/syscalls.h> |
1da177e4c Linux-2.6.12-rc2 |
52 |
|
1da177e4c Linux-2.6.12-rc2 |
53 |
|
1da177e4c Linux-2.6.12-rc2 |
54 55 56 57 58 59 60 |
asmlinkage long ppc32_select(u32 n, compat_ulong_t __user *inp, compat_ulong_t __user *outp, compat_ulong_t __user *exp, compat_uptr_t tvp_x) { /* sign extend n */ return compat_sys_select((int)n, inp, outp, exp, compat_ptr(tvp_x)); } |
1da177e4c Linux-2.6.12-rc2 |
61 62 63 64 65 |
/* Note: it is necessary to treat option as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
66 |
asmlinkage long compat_sys_sysfs(u32 option, u32 arg1, u32 arg2) |
1da177e4c Linux-2.6.12-rc2 |
67 68 69 |
{ return sys_sysfs((int)option, arg1, arg2); } |
1da177e4c Linux-2.6.12-rc2 |
70 |
#ifdef CONFIG_SYSVIPC |
b09a4913b powerpc: change s... |
71 |
long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr, |
1da177e4c Linux-2.6.12-rc2 |
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
u32 fifth) { int version; version = call >> 16; /* hack for backward compatibility */ call &= 0xffff; switch (call) { case SEMTIMEDOP: if (fifth) /* sign extend semid */ return compat_sys_semtimedop((int)first, compat_ptr(ptr), second, compat_ptr(fifth)); /* else fall through for normal semop() */ case SEMOP: /* struct sembuf is the same on 32 and 64bit :)) */ /* sign extend semid */ return sys_semtimedop((int)first, compat_ptr(ptr), second, NULL); case SEMGET: /* sign extend key, nsems */ return sys_semget((int)first, (int)second, third); case SEMCTL: /* sign extend semid, semnum */ return compat_sys_semctl((int)first, (int)second, third, compat_ptr(ptr)); case MSGSND: /* sign extend msqid */ return compat_sys_msgsnd((int)first, (int)second, third, compat_ptr(ptr)); case MSGRCV: /* sign extend msqid, msgtyp */ return compat_sys_msgrcv((int)first, second, (int)fifth, third, version, compat_ptr(ptr)); case MSGGET: /* sign extend key */ return sys_msgget((int)first, second); case MSGCTL: /* sign extend msqid */ return compat_sys_msgctl((int)first, second, compat_ptr(ptr)); case SHMAT: /* sign extend shmid */ return compat_sys_shmat((int)first, second, third, version, compat_ptr(ptr)); case SHMDT: return sys_shmdt(compat_ptr(ptr)); case SHMGET: /* sign extend key_t */ return sys_shmget((int)first, second, third); case SHMCTL: /* sign extend shmid */ return compat_sys_shmctl((int)first, second, compat_ptr(ptr)); default: return -ENOSYS; } return -ENOSYS; } #endif /* Note: it is necessary to treat out_fd and in_fd as unsigned ints, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
142 |
asmlinkage long compat_sys_sendfile(u32 out_fd, u32 in_fd, compat_off_t __user * offset, u32 count) |
1da177e4c Linux-2.6.12-rc2 |
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
{ mm_segment_t old_fs = get_fs(); int ret; off_t of; off_t __user *up; if (offset && get_user(of, offset)) return -EFAULT; /* The __user pointer cast is valid because of the set_fs() */ set_fs(KERNEL_DS); up = offset ? (off_t __user *) &of : NULL; ret = sys_sendfile((int)out_fd, (int)in_fd, up, count); set_fs(old_fs); if (offset && put_user(of, offset)) return -EFAULT; return ret; } |
b09a4913b powerpc: change s... |
163 |
asmlinkage int compat_sys_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, s32 count) |
1da177e4c Linux-2.6.12-rc2 |
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
{ mm_segment_t old_fs = get_fs(); int ret; loff_t lof; loff_t __user *up; if (offset && get_user(lof, offset)) return -EFAULT; /* The __user pointer cast is valid because of the set_fs() */ set_fs(KERNEL_DS); up = offset ? (loff_t __user *) &lof : NULL; ret = sys_sendfile64(out_fd, in_fd, up, count); set_fs(old_fs); if (offset && put_user(lof, offset)) return -EFAULT; return ret; } |
b09a4913b powerpc: change s... |
184 |
long compat_sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, |
1da177e4c Linux-2.6.12-rc2 |
185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
unsigned long a3, unsigned long a4, unsigned long a5, struct pt_regs *regs) { int error; char * filename; filename = getname((char __user *) a0); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; flush_fp_to_thread(current); flush_altivec_to_thread(current); error = compat_do_execve(filename, compat_ptr(a1), compat_ptr(a2), regs); |
1da177e4c Linux-2.6.12-rc2 |
199 200 201 202 203 |
putname(filename); out: return error; } |
1da177e4c Linux-2.6.12-rc2 |
204 205 206 207 208 |
/* Note: it is necessary to treat option as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
209 |
asmlinkage long compat_sys_prctl(u32 option, u32 arg2, u32 arg3, u32 arg4, u32 arg5) |
1da177e4c Linux-2.6.12-rc2 |
210 211 212 213 214 215 216 217 218 219 220 221 222 |
{ return sys_prctl((int)option, (unsigned long) arg2, (unsigned long) arg3, (unsigned long) arg4, (unsigned long) arg5); } /* Note: it is necessary to treat pid as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
223 |
asmlinkage long compat_sys_sched_rr_get_interval(u32 pid, struct compat_timespec __user *interval) |
1da177e4c Linux-2.6.12-rc2 |
224 225 226 227 228 229 230 231 232 233 234 235 236 |
{ struct timespec t; int ret; mm_segment_t old_fs = get_fs (); /* The __user pointer cast is valid because of the set_fs() */ set_fs (KERNEL_DS); ret = sys_sched_rr_get_interval((int)pid, (struct timespec __user *) &t); set_fs (old_fs); if (put_compat_timespec(&t, interval)) return -EFAULT; return ret; } |
1da177e4c Linux-2.6.12-rc2 |
237 238 239 240 241 |
/* Note: it is necessary to treat mode as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
242 |
asmlinkage long compat_sys_access(const char __user * filename, u32 mode) |
1da177e4c Linux-2.6.12-rc2 |
243 244 245 246 247 248 249 250 251 252 |
{ return sys_access(filename, (int)mode); } /* Note: it is necessary to treat mode as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
253 |
asmlinkage long compat_sys_creat(const char __user * pathname, u32 mode) |
1da177e4c Linux-2.6.12-rc2 |
254 255 256 257 258 259 260 261 262 263 |
{ return sys_creat(pathname, (int)mode); } /* Note: it is necessary to treat pid and options as unsigned ints, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
264 |
asmlinkage long compat_sys_waitpid(u32 pid, unsigned int __user * stat_addr, u32 options) |
1da177e4c Linux-2.6.12-rc2 |
265 266 267 268 269 270 271 272 273 274 |
{ return sys_waitpid((int)pid, stat_addr, (int)options); } /* Note: it is necessary to treat gidsetsize as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
275 |
asmlinkage long compat_sys_getgroups(u32 gidsetsize, gid_t __user *grouplist) |
1da177e4c Linux-2.6.12-rc2 |
276 277 278 279 280 281 282 283 284 285 |
{ return sys_getgroups((int)gidsetsize, grouplist); } /* Note: it is necessary to treat pid as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
286 |
asmlinkage long compat_sys_getpgid(u32 pid) |
1da177e4c Linux-2.6.12-rc2 |
287 288 289 |
{ return sys_getpgid((int)pid); } |
1da177e4c Linux-2.6.12-rc2 |
290 291 292 293 294 295 |
/* Note: it is necessary to treat pid as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
296 |
asmlinkage long compat_sys_getsid(u32 pid) |
1da177e4c Linux-2.6.12-rc2 |
297 298 299 300 301 302 303 304 305 306 |
{ return sys_getsid((int)pid); } /* Note: it is necessary to treat pid and sig as unsigned ints, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
307 |
asmlinkage long compat_sys_kill(u32 pid, u32 sig) |
1da177e4c Linux-2.6.12-rc2 |
308 309 310 311 312 313 314 315 316 317 |
{ return sys_kill((int)pid, (int)sig); } /* Note: it is necessary to treat mode as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
318 |
asmlinkage long compat_sys_mkdir(const char __user * pathname, u32 mode) |
1da177e4c Linux-2.6.12-rc2 |
319 320 321 |
{ return sys_mkdir(pathname, (int)mode); } |
b09a4913b powerpc: change s... |
322 |
long compat_sys_nice(u32 increment) |
1da177e4c Linux-2.6.12-rc2 |
323 324 325 326 327 328 329 330 331 332 |
{ /* sign extend increment */ return sys_nice((int)increment); } off_t ppc32_lseek(unsigned int fd, u32 offset, unsigned int origin) { /* sign extend n */ return sys_lseek(fd, (int)offset, origin); } |
dd90bbd5f powerpc: Add comp... |
333 334 335 336 337 338 339 340 341 342 343 |
long compat_sys_truncate(const char __user * path, u32 length) { /* sign extend length */ return sys_truncate(path, (int)length); } long compat_sys_ftruncate(int fd, u32 length) { /* sign extend length */ return sys_ftruncate(fd, (int)length); } |
1da177e4c Linux-2.6.12-rc2 |
344 345 346 347 348 |
/* Note: it is necessary to treat bufsiz as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
349 |
asmlinkage long compat_sys_readlink(const char __user * path, char __user * buf, u32 bufsiz) |
1da177e4c Linux-2.6.12-rc2 |
350 351 352 353 354 355 356 357 358 |
{ return sys_readlink(path, buf, (int)bufsiz); } /* Note: it is necessary to treat option as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
359 |
asmlinkage long compat_sys_sched_get_priority_max(u32 policy) |
1da177e4c Linux-2.6.12-rc2 |
360 361 362 363 364 365 366 367 368 369 |
{ return sys_sched_get_priority_max((int)policy); } /* Note: it is necessary to treat policy as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
370 |
asmlinkage long compat_sys_sched_get_priority_min(u32 policy) |
1da177e4c Linux-2.6.12-rc2 |
371 372 373 374 375 376 377 378 379 380 |
{ return sys_sched_get_priority_min((int)policy); } /* Note: it is necessary to treat pid as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
381 |
asmlinkage long compat_sys_sched_getparam(u32 pid, struct sched_param __user *param) |
1da177e4c Linux-2.6.12-rc2 |
382 383 384 385 386 387 388 389 390 391 |
{ return sys_sched_getparam((int)pid, param); } /* Note: it is necessary to treat pid as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
392 |
asmlinkage long compat_sys_sched_getscheduler(u32 pid) |
1da177e4c Linux-2.6.12-rc2 |
393 394 395 396 397 398 399 400 401 402 |
{ return sys_sched_getscheduler((int)pid); } /* Note: it is necessary to treat pid as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
403 |
asmlinkage long compat_sys_sched_setparam(u32 pid, struct sched_param __user *param) |
1da177e4c Linux-2.6.12-rc2 |
404 405 406 407 408 409 410 411 412 413 |
{ return sys_sched_setparam((int)pid, param); } /* Note: it is necessary to treat pid and policy as unsigned ints, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
414 |
asmlinkage long compat_sys_sched_setscheduler(u32 pid, u32 policy, struct sched_param __user *param) |
1da177e4c Linux-2.6.12-rc2 |
415 416 417 418 419 420 421 422 423 424 |
{ return sys_sched_setscheduler((int)pid, (int)policy, param); } /* Note: it is necessary to treat len as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
425 |
asmlinkage long compat_sys_setdomainname(char __user *name, u32 len) |
1da177e4c Linux-2.6.12-rc2 |
426 427 428 429 430 431 432 433 434 435 |
{ return sys_setdomainname(name, (int)len); } /* Note: it is necessary to treat gidsetsize as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
436 |
asmlinkage long compat_sys_setgroups(u32 gidsetsize, gid_t __user *grouplist) |
1da177e4c Linux-2.6.12-rc2 |
437 438 439 |
{ return sys_setgroups((int)gidsetsize, grouplist); } |
b09a4913b powerpc: change s... |
440 |
asmlinkage long compat_sys_sethostname(char __user *name, u32 len) |
1da177e4c Linux-2.6.12-rc2 |
441 442 443 444 445 446 447 448 449 450 451 |
{ /* sign extend len */ return sys_sethostname(name, (int)len); } /* Note: it is necessary to treat pid and pgid as unsigned ints, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
452 |
asmlinkage long compat_sys_setpgid(u32 pid, u32 pgid) |
1da177e4c Linux-2.6.12-rc2 |
453 454 455 |
{ return sys_setpgid((int)pid, (int)pgid); } |
b09a4913b powerpc: change s... |
456 |
long compat_sys_getpriority(u32 which, u32 who) |
79c2cc7b6 [PATCH] ppc64: ad... |
457 458 459 460 |
{ /* sign extend which and who */ return sys_getpriority((int)which, (int)who); } |
1da177e4c Linux-2.6.12-rc2 |
461 |
|
b09a4913b powerpc: change s... |
462 |
long compat_sys_setpriority(u32 which, u32 who, u32 niceval) |
1da177e4c Linux-2.6.12-rc2 |
463 464 465 466 |
{ /* sign extend which, who and niceval */ return sys_setpriority((int)which, (int)who, (int)niceval); } |
b09a4913b powerpc: change s... |
467 |
long compat_sys_ioprio_get(u32 which, u32 who) |
79c2cc7b6 [PATCH] ppc64: ad... |
468 469 470 471 |
{ /* sign extend which and who */ return sys_ioprio_get((int)which, (int)who); } |
b09a4913b powerpc: change s... |
472 |
long compat_sys_ioprio_set(u32 which, u32 who, u32 ioprio) |
79c2cc7b6 [PATCH] ppc64: ad... |
473 474 475 476 |
{ /* sign extend which, who and ioprio */ return sys_ioprio_set((int)which, (int)who, (int)ioprio); } |
1da177e4c Linux-2.6.12-rc2 |
477 478 479 480 481 |
/* Note: it is necessary to treat newmask as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
482 |
asmlinkage long compat_sys_ssetmask(u32 newmask) |
1da177e4c Linux-2.6.12-rc2 |
483 484 485 |
{ return sys_ssetmask((int) newmask); } |
b09a4913b powerpc: change s... |
486 |
asmlinkage long compat_sys_syslog(u32 type, char __user * buf, u32 len) |
1da177e4c Linux-2.6.12-rc2 |
487 488 489 490 491 492 493 494 495 496 497 |
{ /* sign extend len */ return sys_syslog(type, buf, (int)len); } /* Note: it is necessary to treat mask as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ |
b09a4913b powerpc: change s... |
498 |
asmlinkage long compat_sys_umask(u32 mask) |
1da177e4c Linux-2.6.12-rc2 |
499 500 501 |
{ return sys_umask((int)mask); } |
b89a81712 [PATCH] sysctl: A... |
502 |
#ifdef CONFIG_SYSCTL_SYSCALL |
1da177e4c Linux-2.6.12-rc2 |
503 504 505 506 507 508 509 510 511 |
struct __sysctl_args32 { u32 name; int nlen; u32 oldval; u32 oldlenp; u32 newval; u32 newlen; u32 __unused[4]; }; |
b09a4913b powerpc: change s... |
512 |
asmlinkage long compat_sys_sysctl(struct __sysctl_args32 __user *args) |
1da177e4c Linux-2.6.12-rc2 |
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 |
{ struct __sysctl_args32 tmp; int error; size_t oldlen; size_t __user *oldlenp = NULL; unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7; if (copy_from_user(&tmp, args, sizeof(tmp))) return -EFAULT; if (tmp.oldval && tmp.oldlenp) { /* Duh, this is ugly and might not work if sysctl_args is in read-only memory, but do_sysctl does indirectly a lot of uaccess in both directions and we'd have to basically copy the whole sysctl.c here, and glibc's __sysctl uses rw memory for the structure anyway. */ oldlenp = (size_t __user *)addr; if (get_user(oldlen, (compat_size_t __user *)compat_ptr(tmp.oldlenp)) || put_user(oldlen, oldlenp)) return -EFAULT; } lock_kernel(); error = do_sysctl(compat_ptr(tmp.name), tmp.nlen, compat_ptr(tmp.oldval), oldlenp, compat_ptr(tmp.newval), tmp.newlen); unlock_kernel(); if (oldlenp) { if (!error) { if (get_user(oldlen, oldlenp) || put_user(oldlen, (compat_size_t __user *)compat_ptr(tmp.oldlenp))) error = -EFAULT; } copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)); } return error; } #endif |
b09a4913b powerpc: change s... |
552 |
unsigned long compat_sys_mmap2(unsigned long addr, size_t len, |
1da177e4c Linux-2.6.12-rc2 |
553 554 555 556 557 558 |
unsigned long prot, unsigned long flags, unsigned long fd, unsigned long pgoff) { /* This should remain 12 even if PAGE_SIZE changes */ return sys_mmap(addr, len, prot, flags, fd, pgoff << 12); } |
b09a4913b powerpc: change s... |
559 |
long compat_sys_tgkill(u32 tgid, u32 pid, int sig) |
1da177e4c Linux-2.6.12-rc2 |
560 561 562 563 564 565 566 567 568 |
{ /* sign extend tgid, pid */ return sys_tgkill((int)tgid, (int)pid, sig); } /* * long long munging: * The 32 bit ABI passes long longs in an odd even register pair. */ |
b09a4913b powerpc: change s... |
569 |
compat_ssize_t compat_sys_pread64(unsigned int fd, char __user *ubuf, compat_size_t count, |
1da177e4c Linux-2.6.12-rc2 |
570 571 572 573 |
u32 reg6, u32 poshi, u32 poslo) { return sys_pread64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo); } |
b09a4913b powerpc: change s... |
574 |
compat_ssize_t compat_sys_pwrite64(unsigned int fd, char __user *ubuf, compat_size_t count, |
1da177e4c Linux-2.6.12-rc2 |
575 576 577 578 |
u32 reg6, u32 poshi, u32 poslo) { return sys_pwrite64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo); } |
b09a4913b powerpc: change s... |
579 |
compat_ssize_t compat_sys_readahead(int fd, u32 r4, u32 offhi, u32 offlo, u32 count) |
1da177e4c Linux-2.6.12-rc2 |
580 581 582 |
{ return sys_readahead(fd, ((loff_t)offhi << 32) | offlo, count); } |
b09a4913b powerpc: change s... |
583 |
asmlinkage int compat_sys_truncate64(const char __user * path, u32 reg4, |
1da177e4c Linux-2.6.12-rc2 |
584 585 586 587 |
unsigned long high, unsigned long low) { return sys_truncate(path, (high << 32) | low); } |
97ac73506 sys_fallocate() i... |
588 589 590 591 592 593 |
asmlinkage long compat_sys_fallocate(int fd, int mode, u32 offhi, u32 offlo, u32 lenhi, u32 lenlo) { return sys_fallocate(fd, mode, ((loff_t)offhi << 32) | offlo, ((loff_t)lenhi << 32) | lenlo); } |
b09a4913b powerpc: change s... |
594 |
asmlinkage int compat_sys_ftruncate64(unsigned int fd, u32 reg4, unsigned long high, |
1da177e4c Linux-2.6.12-rc2 |
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 |
unsigned long low) { return sys_ftruncate(fd, (high << 32) | low); } long ppc32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char __user *buf, size_t len) { return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low, buf, len); } long ppc32_fadvise64(int fd, u32 unused, u32 offset_high, u32 offset_low, size_t len, int advice) { return sys_fadvise64(fd, (u64)offset_high << 32 | offset_low, len, advice); } |
b09a4913b powerpc: change s... |
613 |
asmlinkage long compat_sys_add_key(const char __user *_type, |
1da177e4c Linux-2.6.12-rc2 |
614 615 616 617 618 619 620 |
const char __user *_description, const void __user *_payload, u32 plen, u32 ringid) { return sys_add_key(_type, _description, _payload, plen, ringid); } |
b09a4913b powerpc: change s... |
621 |
asmlinkage long compat_sys_request_key(const char __user *_type, |
1da177e4c Linux-2.6.12-rc2 |
622 623 624 625 626 627 |
const char __user *_description, const char __user *_callout_info, u32 destringid) { return sys_request_key(_type, _description, _callout_info, destringid); } |
edd5cd4a9 Introduce fixed s... |
628 629 630 631 632 633 634 635 636 |
asmlinkage long compat_sys_sync_file_range2(int fd, unsigned int flags, unsigned offset_hi, unsigned offset_lo, unsigned nbytes_hi, unsigned nbytes_lo) { loff_t offset = ((loff_t)offset_hi << 32) | offset_lo; loff_t nbytes = ((loff_t)nbytes_hi << 32) | nbytes_lo; return sys_sync_file_range(fd, offset, nbytes, flags); } |