]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/arm/sysdep.h
pretty printing.
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / arm / sysdep.h
1 /* Copyright (C) 1992, 93, 95, 96, 97 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
4 ARM changes by Philip Blundell, <pjb27@cam.ac.uk>, May 1997.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public
17 License along with the GNU C Library; see the file COPYING.LIB. If not,
18 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 #ifndef _LINUX_ARM_SYSDEP_H
22 #define _LINUX_ARM_SYSDEP_H 1
23
24 /* There is some commonality. */
25 #include <sysdeps/unix/arm/sysdep.h>
26
27 /* For Linux we can use the system call table in the header file
28 /usr/include/asm/unistd.h
29 of the kernel. But these symbols do not follow the SYS_* syntax
30 so we have to redefine the `SYS_ify' macro here. */
31 #undef SYS_ify
32 #define SWI_BASE (9 << 20)
33 #define SYS_ify(syscall_name) (SWI_BASE + __NR_##syscall_name)
34
35
36 #ifdef ASSEMBLER
37
38 /* Linux uses a negative return value to indicate syscall errors,
39 unlike most Unices, which use the condition codes' carry flag.
40
41 Since version 2.1 the return value of a system call might be
42 negative even if the call succeeded. E.g., the `lseek' system call
43 might return a large offset. Therefore we must not anymore test
44 for < 0, but test for a real error by making sure the value in %eax
45 is a real error number. Linus said he will make sure the no syscall
46 returns a value in -1 .. -4095 as a valid result so we can savely
47 test with -4095. */
48 #undef PSEUDO
49 #define PSEUDO(name, syscall_name, args) \
50 .text; \
51 ENTRY (name) \
52 DO_CALL (args, syscall_name); \
53 cmn r0, $4096; \
54 bge syscall_error;
55
56 #undef PSEUDO_END
57 #define PSEUDO_END(name) \
58 SYSCALL_ERROR_HANDLER \
59 END (name)
60
61 #ifndef PIC
62 #define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */
63 #else
64 #error Aiee
65 #endif /* PIC */
66
67 #undef DO_CALL
68 #define DO_CALL(args, syscall_name) \
69 swi SYS_ify (syscall_name);
70
71 #endif /* ASSEMBLER */
72
73 #endif /* linux/arm/sysdep.h */