sys_parisc32.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. /* Note: it is necessary to treat out_fd and in_fd as unsigned ints, with the
  57. * corresponding cast to a signed int to insure that the proper conversion
  58. * (sign extension) between the register representation of a signed int (msr in
  59. * 32-bit mode) and the register representation of a signed int (msr in 64-bit
  60. * mode) is performed.
  61. */
  62. asmlinkage long sys32_sendfile(u32 out_fd, u32 in_fd,
  63. compat_off_t __user *offset, compat_size_t count)
  64. {
  65. return compat_sys_sendfile((int)out_fd, (int)in_fd, offset, count);
  66. }
  67. asmlinkage long sys32_sendfile64(u32 out_fd, u32 in_fd,
  68. compat_loff_t __user *offset, compat_size_t count)
  69. {
  70. return sys_sendfile64((int)out_fd, (int)in_fd,
  71. (loff_t __user *)offset, count);
  72. }
  73. asmlinkage long sys32_semctl(int semid, int semnum, int cmd, union semun arg)
  74. {
  75. union semun u;
  76. if (cmd == SETVAL) {
  77. /* Ugh. arg is a union of int,ptr,ptr,ptr, so is 8 bytes.
  78. * The int should be in the first 4, but our argument
  79. * frobbing has left it in the last 4.
  80. */
  81. u.val = *((int *)&arg + 1);
  82. return sys_semctl (semid, semnum, cmd, u);
  83. }
  84. return sys_semctl (semid, semnum, cmd, arg);
  85. }
  86. long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char __user *buf,
  87. size_t len)
  88. {
  89. return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low,
  90. buf, len);
  91. }
  92. asmlinkage long compat_sys_fanotify_mark(int fan_fd, int flags, u32 mask_hi,
  93. u32 mask_lo, int fd,
  94. const char __user *pathname)
  95. {
  96. return sys_fanotify_mark(fan_fd, flags, ((u64)mask_hi << 32) | mask_lo,
  97. fd, pathname);
  98. }