1 /* Copyright (C) 2000-2016 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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/>. */
19 #include <common/sysdep.h>
23 # define ALIGNARG(log2) log2
24 # define ASM_SIZE_DIRECTIVE(name) .size name,.-name
26 /* Define an entry point visible from C. */
27 # define ENTRY(name) \
28 .globl C_SYMBOL_NAME(name); \
29 .type C_SYMBOL_NAME(name),@function; \
34 # define END(name) ASM_SIZE_DIRECTIVE(name)
36 /* Local label name for asm code. */
38 # define L(name) $L##name
41 /* We don't want the label for the error handler to be visible in the symbol
42 table when we define it here. */
44 # define SYSCALL_ERROR_LABEL 0f
46 # define SYSCALL_ERROR_LABEL __syscall_error
49 # define DO_CALL(syscall_name, args) \
50 addik r12,r0,SYS_ify (syscall_name); \
55 # define PSEUDO(name, syscall_name, args) \
58 DO_CALL (syscall_name, args); \
61 bgei r12,SYSCALL_ERROR_LABEL;
64 # define PSEUDO_END(name) \
65 SYSCALL_ERROR_HANDLER; \
68 # undef PSEUDO_NOERRNO
69 # define PSEUDO_NOERRNO(name, syscall_name, args) \
72 DO_CALL (syscall_name, args);
74 # undef PSEUDO_END_NOERRNO
75 # define PSEUDO_END_NOERRNO(name) \
78 /* The function has to return the error code. */
80 # define PSEUDO_ERRVAL(name, syscall_name, args) \
83 DO_CALL (syscall_name, args); \
85 # undef PSEUDO_END_ERRVAL
86 # define PSEUDO_END_ERRVAL(name) \
90 # define ret_NOERRNO \
91 rtsd r15,8; addk r0,r0,r0;
95 rtsd r15,8; rsubk r3,r3,r0;
98 # define SYSCALL_ERROR_LABEL_DCL 0
99 # if defined _LIBC_REENTRANT
100 # define SYSCALL_ERROR_HANDLER \
101 SYSCALL_ERROR_LABEL_DCL: \
108 addik r20,r20,_GLOBAL_OFFSET_TABLE_+8; \
109 brlid r15,__errno_location@PLT; \
118 # else /* !_LIBC_REENTRANT. */
119 # define SYSCALL_ERROR_HANDLER \
120 SYSCALL_ERROR_LABEL_DCL: \
122 addik r12,r12,_GLOBAL_OFFSET_TABLE_+8; \
123 lwi r12,r12,errno@GOT; \
128 # endif /* _LIBC_REENTRANT. */
130 # define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */