sys_parisc32.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. * sys_parisc32.c: Conversion between 32bit and 64bit native syscalls.
  3. *
  4. * Copyright (C) 2000-2001 Hewlett Packard Company
  5. * Copyright (C) 2000 John Marvin
  6. * Copyright (C) 2001 Matthew Wilcox
  7. *
  8. * These routines maintain argument size conversion between 32bit and 64bit
  9. * environment. Based heavily on sys_ia32.c and sys_sparc32.c.
  10. */
  11. #include <linux/compat.h>
  12. #include <linux/kernel.h>
  13. #include <linux/sched.h>
  14. #include <linux/fs.h>
  15. #include <linux/mm.h>
  16. #include <linux/file.h>
  17. #include <linux/signal.h>
  18. #include <linux/resource.h>
  19. #include <linux/times.h>
  20. #include <linux/time.h>
  21. #include <linux/smp.h>
  22. #include <linux/sem.h>
  23. #include <linux/shm.h>
  24. #include <linux/slab.h>
  25. #include <linux/uio.h>
  26. #include <linux/ncp_fs.h>
  27. #include <linux/poll.h>
  28. #include <linux/personality.h>
  29. #include <linux/stat.h>
  30. #include <linux/highmem.h>
  31. #include <linux/highuid.h>
  32. #include <linux/mman.h>
  33. #include <linux/binfmts.h>
  34. #include <linux/namei.h>
  35. #include <linux/vfs.h>
  36. #include <linux/ptrace.h>
  37. #include <linux/swap.h>
  38. #include <linux/syscalls.h>
  39. #include <asm/types.h>
  40. #include <asm/uaccess.h>
  41. #include <asm/mmu_context.h>
  42. #include "sys32.h"
  43. #undef DEBUG
  44. #ifdef DEBUG
  45. #define DBG(x) printk x
  46. #else
  47. #define DBG(x)
  48. #endif
  49. asmlinkage long sys32_unimplemented(int r26, int r25, int r24, int r23,
  50. int r22, int r21, int r20)
  51. {
  52. printk(KERN_ERR "%s(%d): Unimplemented 32 on 64 syscall #%d!\n",
  53. current->comm, current->pid, r20);
  54. return -ENOSYS;
  55. }
  56. asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count)
  57. {
  58. mm_segment_t old_fs = get_fs();
  59. int ret;
  60. off_t of;
  61. if (offset && get_user(of, offset))
  62. return -EFAULT;
  63. set_fs(KERNEL_DS);
  64. ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL, count);
  65. set_fs(old_fs);
  66. if (offset && put_user(of, offset))
  67. return -EFAULT;
  68. return ret;
  69. }
  70. asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, s32 count)
  71. {
  72. mm_segment_t old_fs = get_fs();
  73. int ret;
  74. loff_t lof;
  75. if (offset && get_user(lof, offset))
  76. return -EFAULT;
  77. set_fs(KERNEL_DS);
  78. ret = sys_sendfile64(out_fd, in_fd, offset ? (loff_t __user *)&lof : NULL, count);
  79. set_fs(old_fs);
  80. if (offset && put_user(lof, offset))
  81. return -EFAULT;
  82. return ret;
  83. }
  84. /* lseek() needs a wrapper because 'offset' can be negative, but the top
  85. * half of the argument has been zeroed by syscall.S.
  86. */
  87. asmlinkage int sys32_lseek(unsigned int fd, int offset, unsigned int origin)
  88. {
  89. return sys_lseek(fd, offset, origin);
  90. }
  91. asmlinkage long sys32_semctl(int semid, int semnum, int cmd, union semun arg)
  92. {
  93. union semun u;
  94. if (cmd == SETVAL) {
  95. /* Ugh. arg is a union of int,ptr,ptr,ptr, so is 8 bytes.
  96. * The int should be in the first 4, but our argument
  97. * frobbing has left it in the last 4.
  98. */
  99. u.val = *((int *)&arg + 1);
  100. return sys_semctl (semid, semnum, cmd, u);
  101. }
  102. return sys_semctl (semid, semnum, cmd, arg);
  103. }
  104. long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char __user *buf,
  105. size_t len)
  106. {
  107. return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low,
  108. buf, len);
  109. }
  110. asmlinkage long compat_sys_fanotify_mark(int fan_fd, int flags, u32 mask_hi,
  111. u32 mask_lo, int fd,
  112. const char __user *pathname)
  113. {
  114. return sys_fanotify_mark(fan_fd, flags, ((u64)mask_hi << 32) | mask_lo,
  115. fd, pathname);
  116. }