1 /* Copyright (C) 1995-2000,2002,2003,2004,2005,2006
2 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
7 License as published by the Free Software Foundation; either
8 version 2.1 of the 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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24 #include <kernel-features.h>
30 #define SVRSP 16 /* saved register space */
31 #define PARMS LINKAGE+SVRSP /* space for 4 saved regs */
40 ENTRY (BP_SYM (__posix_fadvise64_l64))
42 #ifdef __NR_fadvise64_64
46 cfi_adjust_cfa_offset (4)
48 cfi_adjust_cfa_offset (4)
50 cfi_adjust_cfa_offset (4)
52 cfi_adjust_cfa_offset (4)
55 cfi_rel_offset (ebx, 8)
56 movl OFFLO(%esp), %ecx
57 movl OFFHI(%esp), %edx
58 movl LENLO(%esp), %esi
59 cfi_rel_offset (esi, 4)
60 movl LENHI(%esp), %edi
61 cfi_rel_offset (edi, 0)
62 movl FLAGS(%esp), %ebp
63 cfi_rel_offset (ebp, 12)
65 movl $SYS_ify(fadvise64_64), %eax
68 /* Restore registers. */
70 cfi_adjust_cfa_offset (-4)
73 cfi_adjust_cfa_offset (-4)
76 cfi_adjust_cfa_offset (-4)
79 cfi_adjust_cfa_offset (-4)
82 #ifndef __ASSUME_FADVISE64_64_SYSCALL
87 /* The function returns zero, or the error number. So all we
88 have to do is negate the value passed back from the kernel. */
89 /* If 0 > %eax > -4096 there was an error. */
92 /* Successful; return the syscall's value. */
96 #if defined __NR_fadvise64 \
97 && (!defined __ASSUME_FADVISE64_64_SYSCALL || !defined __NR_fadvise64_64)
98 1: /* Save registers. */
100 cfi_adjust_cfa_offset (4)
102 cfi_adjust_cfa_offset (4)
104 cfi_adjust_cfa_offset (4)
106 /* Overflow check. */
108 movl $-EOVERFLOW, %eax
112 cfi_rel_offset (ebx, 8)
113 movl OFFLO(%esp), %ecx
114 movl OFFHI(%esp), %edx
115 movl LENLO(%esp), %esi
116 cfi_rel_offset (esi, 4)
117 movl FLAGS(%esp), %edi
118 cfi_rel_offset (edi, 0)
120 movl $SYS_ify(fadvise64), %eax
123 /* Restore registers. */
126 cfi_adjust_cfa_offset (-4)
129 cfi_adjust_cfa_offset (-4)
132 cfi_adjust_cfa_offset (-4)
135 /* If 0 > %eax > -4096 there was an error. */
138 /* Successful; return the syscall's value. */
145 END (BP_SYM (__posix_fadvise64_l64))
147 #ifdef __NR_fadvise64
148 .section .text.compat, "ax"
149 ENTRY (__posix_fadvise64_l32)
150 DO_CALL (fadvise64, 5)
153 PSEUDO_END_ERRVAL (__posix_fadvise64_l32)
155 ENTRY (BP_SYM (__posix_fadvise64_l32))
158 END (BP_SYM (__posix_fadvise64_l32))
161 default_symbol_version (__posix_fadvise64_l64, posix_fadvise64, GLIBC_2.3.3)
162 symbol_version (__posix_fadvise64_l32, posix_fadvise64, GLIBC_2.2)