Update copyright notices with scripts/update-copyrights
[glibc.git] / sysdeps / unix / sysv / linux / i386 / posix_fadvise64.S
blob642229951a2e5fab9c6e2d3300d5169f436f9b7f
1 /* Copyright (C) 1995-2014 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
14    You should have received a copy of the GNU Lesser General Public
15    License along with the GNU C Library; if not, see
16    <http://www.gnu.org/licenses/>.  */
18 #include <sysdep.h>
20 #define EINVAL  22
21 #define ENOSYS  38
22 #define EOVERFLOW 75
24 #define SVRSP   16              /* saved register space */
25 #define PARMS   4+SVRSP /* space for 4 saved regs */
26 #define FD      PARMS
27 #define OFFLO   FD+4
28 #define OFFHI   OFFLO+4
29 #define LENLO   OFFHI+4
30 #define LENHI   LENLO+4
31 #define FLAGS   LENHI+4
33         .text
34 ENTRY (__posix_fadvise64_l64)
36         /* Save registers.  */
37         pushl   %ebp
38         cfi_adjust_cfa_offset (4)
39         pushl   %ebx
40         cfi_adjust_cfa_offset (4)
41         pushl   %esi
42         cfi_adjust_cfa_offset (4)
43         pushl   %edi
44         cfi_adjust_cfa_offset (4)
46         movl    FD(%esp), %ebx
47         cfi_rel_offset (ebx, 8)
48         movl    OFFLO(%esp), %ecx
49         movl    OFFHI(%esp), %edx
50         movl    LENLO(%esp), %esi
51         cfi_rel_offset (esi, 4)
52         movl    LENHI(%esp), %edi
53         cfi_rel_offset (edi, 0)
54         movl    FLAGS(%esp), %ebp
55         cfi_rel_offset (ebp, 12)
57         movl    $SYS_ify(fadvise64_64), %eax
58         ENTER_KERNEL
60         /* Restore registers.  */
61         popl    %edi
62         cfi_adjust_cfa_offset (-4)
63         cfi_restore (edi)
64         popl    %esi
65         cfi_adjust_cfa_offset (-4)
66         cfi_restore (esi)
67         popl    %ebx
68         cfi_adjust_cfa_offset (-4)
69         cfi_restore (ebx)
70         popl    %ebp
71         cfi_adjust_cfa_offset (-4)
72         cfi_restore (ebp)
74         /* The function returns zero, or the error number.  So all we
75            have to do is negate the value passed back from the kernel.  */
76         /* If 0 > %eax > -4096 there was an error.  */
77         negl    %eax
79         /* Successful; return the syscall's value.  */
80         ret
82 END (__posix_fadvise64_l64)
84         .section        .text.compat, "ax"
85 ENTRY (__posix_fadvise64_l32)
86         DO_CALL (fadvise64, 5)
87         negl %eax
88         ret
89 PSEUDO_END_ERRVAL (__posix_fadvise64_l32)
91 default_symbol_version (__posix_fadvise64_l64, posix_fadvise64, GLIBC_2.3.3)
92 symbol_version (__posix_fadvise64_l32, posix_fadvise64, GLIBC_2.2)