1 /* Copyright (C) 2011-2014 Free Software Foundation, Inc.
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.
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.
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/>. */
17 #ifndef _LINUX_OR1K_SYSDEP_H
18 #define _LINUX_OR1K_SYSDEP_H 1
20 #include <common/sysdep.h>
21 #include <sys/syscall.h>
23 /* In order to get __set_errno() definition in INLINE_SYSCALL. */
29 #define SYS_ify(syscall_name) (__NR_##syscall_name)
33 /* Local label name for asm code. */
34 #define L(name) .L##name
37 #define ret_ERRVAL l.jr r9; l.nop
38 #define ret_NOERRNO l.jr r9; l.nop
41 #define DO_CALL(syscall_name) \
42 l.addi r11, r0, SYS_ify (syscall_name); \
46 #define PSEUDO(name, syscall_name, args) \
48 DO_CALL(syscall_name); \
49 /* if -4096 < ret < 0 holds, it's an error */ \
50 l.sfgeui r11, 0xf001; \
54 #define PSEUDO_NOERRNO(name, syscall_name, args) \
58 #define PSEUDO_END(name) \
60 l.j SYSCALL_ERROR_NAME; \
64 #define PSEUDO_END_NOERRNO(name) \
68 /* For static code, on error jump to __syscall_error directly. */
69 # define SYSCALL_ERROR_NAME __syscall_error
71 /* Use the internal name for libc/libpthread shared objects. */
72 # define SYSCALL_ERROR_NAME __GI___syscall_error
74 /* Otherwise, on error do a full PLT jump. */
75 # define SYSCALL_ERROR_NAME plt(__syscall_error)
78 /* Make use of .size directive. */
79 #define ASM_SIZE_DIRECTIVE(name) .size name,.-name;
81 /* Define an entry point visible from C. */
83 .globl C_SYMBOL_NAME(name); \
84 .type C_SYMBOL_NAME(name),@function; \
92 ASM_SIZE_DIRECTIVE(name)
94 /* Since C identifiers are not normally prefixed with an underscore
95 on this system, the asm identifier `syscall_error' intrudes on the
96 C name space. Make sure we use an innocuous name. */
97 #define syscall_error __syscall_error
99 /* Specify the size in bytes of a machine register. */
102 #endif /* __ASSEMBLER__ */
104 #endif /* linux/or1k/sysdep.h */