sys_sh32.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // SPDX-License-Identifier: GPL-2.0
  2. #include <linux/errno.h>
  3. #include <linux/sched.h>
  4. #include <linux/sched/task_stack.h>
  5. #include <linux/mm.h>
  6. #include <linux/smp.h>
  7. #include <linux/sem.h>
  8. #include <linux/msg.h>
  9. #include <linux/shm.h>
  10. #include <linux/stat.h>
  11. #include <linux/syscalls.h>
  12. #include <linux/mman.h>
  13. #include <linux/file.h>
  14. #include <linux/module.h>
  15. #include <linux/fs.h>
  16. #include <linux/ipc.h>
  17. #include <asm/cacheflush.h>
  18. #include <linux/uaccess.h>
  19. #include <asm/unistd.h>
  20. #include <asm/syscalls.h>
  21. /*
  22. * sys_pipe() is the normal C calling standard for creating
  23. * a pipe. It's not the way Unix traditionally does this, though.
  24. */
  25. asmlinkage int sys_sh_pipe(void)
  26. {
  27. int fd[2];
  28. int error;
  29. error = do_pipe_flags(fd, 0);
  30. if (!error) {
  31. current_pt_regs()->regs[1] = fd[1];
  32. return fd[0];
  33. }
  34. return error;
  35. }
  36. asmlinkage ssize_t sys_pread_wrapper(unsigned int fd, char __user *buf,
  37. size_t count, long dummy, loff_t pos)
  38. {
  39. return ksys_pread64(fd, buf, count, pos);
  40. }
  41. asmlinkage ssize_t sys_pwrite_wrapper(unsigned int fd, const char __user *buf,
  42. size_t count, long dummy, loff_t pos)
  43. {
  44. return ksys_pwrite64(fd, buf, count, pos);
  45. }
  46. asmlinkage int sys_fadvise64_64_wrapper(int fd, u32 offset0, u32 offset1,
  47. u32 len0, u32 len1, int advice)
  48. {
  49. #ifdef __LITTLE_ENDIAN__
  50. return ksys_fadvise64_64(fd, (u64)offset1 << 32 | offset0,
  51. (u64)len1 << 32 | len0, advice);
  52. #else
  53. return ksys_fadvise64_64(fd, (u64)offset0 << 32 | offset1,
  54. (u64)len0 << 32 | len1, advice);
  55. #endif
  56. }
  57. /*
  58. * swap the arguments the way that libc wants them instead of
  59. * moving flags ahead of the 64-bit nbytes argument
  60. */
  61. SYSCALL_DEFINE6(sh_sync_file_range6, int, fd, SC_ARG64(offset),
  62. SC_ARG64(nbytes), unsigned int, flags)
  63. {
  64. return ksys_sync_file_range(fd, SC_VAL64(loff_t, offset),
  65. SC_VAL64(loff_t, nbytes), flags);
  66. }