Blame sysdeps/unix/sysv/linux/aarch64/syscall.S

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