|
Packit |
6c4009 |
/* Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
|
|
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
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the 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 |
#include <features.h>
|
|
Packit |
6c4009 |
#include <tls.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
ENTRY(__syscall_error)
|
|
Packit |
6c4009 |
#if RTLD_PRIVATE_ERRNO
|
|
Packit |
6c4009 |
/*
|
|
Packit |
6c4009 |
* Note that the gp has to be set properly for this to work.
|
|
Packit |
6c4009 |
* As long as all syscalls are in the same load unit
|
|
Packit |
6c4009 |
* (executable or shared library) as this routine, we should
|
|
Packit |
6c4009 |
* be fine. Otherwise, we would have to first load the global
|
|
Packit |
6c4009 |
* pointer register from __gp.
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
addl r2=@gprel(rtld_errno),gp
|
|
Packit |
6c4009 |
;;
|
|
Packit |
6c4009 |
st4 [r2]=r8
|
|
Packit |
6c4009 |
mov r8=-1
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# if IS_IN (libc)
|
|
Packit |
6c4009 |
# define SYSCALL_ERROR_ERRNO __libc_errno
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
# define SYSCALL_ERROR_ERRNO errno
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
addl r2=@ltoff(@tprel(SYSCALL_ERROR_ERRNO)), gp;;
|
|
Packit |
6c4009 |
ld8 r2=[r2]
|
|
Packit |
6c4009 |
mov r3=r8;;
|
|
Packit |
6c4009 |
mov r8=-1
|
|
Packit |
6c4009 |
add r2=r2,r13;;
|
|
Packit |
6c4009 |
st4 [r2]=r3
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
ret // ret is #define'd in syscall.h!
|
|
Packit |
6c4009 |
END(__syscall_error)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
ENTRY(__ia64_syscall)
|
|
Packit |
6c4009 |
mov r15=r37 /* syscall number */
|
|
Packit |
6c4009 |
break __BREAK_SYSCALL
|
|
Packit |
6c4009 |
cmp.eq p6,p0=-1,r10 /* r10 = -1 on error */
|
|
Packit |
6c4009 |
(p6) br.cond.spnt.few __syscall_error
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
PSEUDO_END(__ia64_syscall)
|