syscall.S 1.3 KB

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