sys_ppc32.c 21 KB

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