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