Update copyright notices with scripts/update-copyrights.
[glibc.git] / sysdeps / unix / sysv / linux / i386 / posix_fadvise64.S
blob5f9de9d80e148fdc188534e9faef6a692e4c1f8b
1 /* Copyright (C) 1995-2013 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>
19 #include <bp-sym.h>
20 #include <bp-asm.h>
22 #define EINVAL  22
23 #define ENOSYS  38
24 #define EOVERFLOW 75
26 #define SVRSP   16              /* saved register space */
27 #define PARMS   LINKAGE+SVRSP   /* space for 4 saved regs */
28 #define FD      PARMS
29 #define OFFLO   FD+4
30 #define OFFHI   OFFLO+4
31 #define LENLO   OFFHI+4
32 #define LENHI   LENLO+4
33 #define FLAGS   LENHI+4
35         .text
36 ENTRY (BP_SYM (__posix_fadvise64_l64))
38         /* Save registers.  */
39         pushl   %ebp
40         cfi_adjust_cfa_offset (4)
41         pushl   %ebx
42         cfi_adjust_cfa_offset (4)
43         pushl   %esi
44         cfi_adjust_cfa_offset (4)
45         pushl   %edi
46         cfi_adjust_cfa_offset (4)
48         movl    FD(%esp), %ebx
49         cfi_rel_offset (ebx, 8)
50         movl    OFFLO(%esp), %ecx
51         movl    OFFHI(%esp), %edx
52         movl    LENLO(%esp), %esi
53         cfi_rel_offset (esi, 4)
54         movl    LENHI(%esp), %edi
55         cfi_rel_offset (edi, 0)
56         movl    FLAGS(%esp), %ebp
57         cfi_rel_offset (ebp, 12)
59         movl    $SYS_ify(fadvise64_64), %eax
60         ENTER_KERNEL
62         /* Restore registers.  */
63         popl    %edi
64         cfi_adjust_cfa_offset (-4)
65         cfi_restore (edi)
66         popl    %esi
67         cfi_adjust_cfa_offset (-4)
68         cfi_restore (esi)
69         popl    %ebx
70         cfi_adjust_cfa_offset (-4)
71         cfi_restore (ebx)
72         popl    %ebp
73         cfi_adjust_cfa_offset (-4)
74         cfi_restore (ebp)
76         /* The function returns zero, or the error number.  So all we
77            have to do is negate the value passed back from the kernel.  */
78         /* If 0 > %eax > -4096 there was an error.  */
79         negl    %eax
81         /* Successful; return the syscall's value.  */
82         ret
84 END (BP_SYM (__posix_fadvise64_l64))
86         .section        .text.compat, "ax"
87 ENTRY (__posix_fadvise64_l32)
88         DO_CALL (fadvise64, 5)
89         negl %eax
90         ret
91 PSEUDO_END_ERRVAL (__posix_fadvise64_l32)
93 default_symbol_version (__posix_fadvise64_l64, posix_fadvise64, GLIBC_2.3.3)
94 symbol_version (__posix_fadvise64_l32, posix_fadvise64, GLIBC_2.2)