syscall.c 878 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // SPDX-License-Identifier: GPL-2.0
  2. // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
  3. #include <linux/syscalls.h>
  4. SYSCALL_DEFINE1(set_thread_area, unsigned long, addr)
  5. {
  6. struct thread_info *ti = task_thread_info(current);
  7. struct pt_regs *reg = current_pt_regs();
  8. reg->tls = addr;
  9. ti->tp_value = addr;
  10. return 0;
  11. }
  12. SYSCALL_DEFINE6(mmap2,
  13. unsigned long, addr,
  14. unsigned long, len,
  15. unsigned long, prot,
  16. unsigned long, flags,
  17. unsigned long, fd,
  18. off_t, offset)
  19. {
  20. if (unlikely(offset & (~PAGE_MASK >> 12)))
  21. return -EINVAL;
  22. return ksys_mmap_pgoff(addr, len, prot, flags, fd,
  23. offset >> (PAGE_SHIFT - 12));
  24. }
  25. /*
  26. * for abiv1 the 64bits args should be even th, So we need mov the advice
  27. * forward.
  28. */
  29. SYSCALL_DEFINE4(csky_fadvise64_64,
  30. int, fd,
  31. int, advice,
  32. loff_t, offset,
  33. loff_t, len)
  34. {
  35. return ksys_fadvise64_64(fd, offset, len, advice);
  36. }