syscall.S 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* Copyright (C) 2005-2017 Free Software Foundation, Inc.
  2. The GNU C Library is free software; you can redistribute it and/or
  3. modify it under the terms of the GNU Lesser General Public License as
  4. published by the Free Software Foundation; either version 2.1 of the
  5. License, or (at your option) any later version.
  6. The GNU C Library is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  9. Lesser General Public License for more details.
  10. You should have received a copy of the GNU Lesser General Public
  11. License along with the GNU C Library; if not, see
  12. <http://www.gnu.org/licenses/>. */
  13. #include <sysdep.h>
  14. /* syscall (int nr, ...)
  15. AArch64 system calls take between 0 and 7 arguments. On entry here nr
  16. is in w0 and any other system call arguments are in register x1..x7.
  17. For kernel entry we need to move the system call nr to x8 then
  18. load the remaining arguments to register. */
  19. ENTRY (syscall)
  20. uxtw x8, w0
  21. mov x0, x1
  22. mov x1, x2
  23. mov x2, x3
  24. mov x3, x4
  25. mov x4, x5
  26. mov x5, x6
  27. mov x6, x7
  28. svc 0x0
  29. cmn x0, #4095
  30. b.cs 1f
  31. RET
  32. 1:
  33. b SYSCALL_ERROR
  34. PSEUDO_END (syscall)