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