posix_fadvise64.S 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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.
  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.
  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.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. #define _ERRNO_H 1
  17. #include <features.h>
  18. #include <bits/errno.h>
  19. #include <sys/syscall.h>
  20. .text
  21. .global __libc_posix_fadvise64
  22. .type __libc_posix_fadvise64,%function
  23. __libc_posix_fadvise64:
  24. #if defined __NR_fadvise64_64
  25. /* Save regs */
  26. pushl %ebp
  27. pushl %ebx
  28. pushl %esi
  29. pushl %edi
  30. movl $__NR_fadvise64_64, %eax /* Syscall number in %eax. */
  31. movl 20(%esp), %ebx
  32. movl 24(%esp), %ecx
  33. movl 28(%esp), %edx
  34. movl 32(%esp), %esi
  35. movl 36(%esp), %edi
  36. movl 40(%esp), %ebp
  37. /* Do the system call trap. */
  38. int $0x80
  39. /* Restore regs */
  40. popl %edi
  41. popl %esi
  42. popl %ebx
  43. popl %ebp
  44. /* Returns 0 on success, else an error code. */
  45. negl %eax
  46. #elif defined __NR_fadvise64
  47. /* Save regs */
  48. pushl %ebx
  49. pushl %esi
  50. pushl %edi
  51. #if 0
  52. /* does len overflow long? */
  53. cmpl $0, 28(%esp)
  54. movl $-EOVERFLOW, %eax
  55. jne overflow
  56. #endif
  57. movl $__NR_fadvise64, %eax /* Syscall number in %eax. */
  58. movl 16(%esp), %ebx
  59. movl 20(%esp), %ecx
  60. movl 24(%esp), %edx
  61. movl 28(%esp), %esi
  62. movl 32(%esp), %edi
  63. /* Do the system call trap. */
  64. int $0x80
  65. overflow:
  66. /* Restore regs */
  67. popl %edi
  68. popl %esi
  69. popl %ebx
  70. /* Returns 0 on success, else an error code. */
  71. negl %eax
  72. #elif defined __UCLIBC_HAS_STUBS__
  73. movl $-ENOSYS, %eax
  74. jmp __syscall_error
  75. #endif
  76. /* Successful; return the syscall's value. */
  77. ret
  78. .size __libc_posix_fadvise64,.-__libc_posix_fadvise64
  79. libc_hidden_def(__libc_posix_fadvise64)
  80. #if defined __UCLIBC_HAS_LFS__ && defined __UCLIBC_HAS_ADVANCED_REALTIME__
  81. weak_alias(__libc_posix_fadvise64,posix_fadvise64)
  82. #endif