posix_fadvise64.S 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. /* Was named __libc_posix_fadvise64 for some inexplicable reason.
  21. ** google says only uclibc has *__libc*_posix_fadviseXXX,
  22. ** so it cannot be compat with anything.
  23. **
  24. ** Remove this comment and one at the end after 0.9.31
  25. */
  26. .text
  27. .global posix_fadvise64
  28. .type posix_fadvise64,%function
  29. posix_fadvise64:
  30. #if defined __NR_fadvise64_64
  31. /* Save regs */
  32. pushl %ebp
  33. pushl %ebx
  34. pushl %esi
  35. pushl %edi
  36. movl $__NR_fadvise64_64, %eax /* Syscall number in %eax. */
  37. movl 20(%esp), %ebx
  38. movl 24(%esp), %ecx
  39. movl 28(%esp), %edx
  40. movl 32(%esp), %esi
  41. movl 36(%esp), %edi
  42. movl 40(%esp), %ebp
  43. /* Do the system call trap. */
  44. int $0x80
  45. /* Restore regs */
  46. popl %edi
  47. popl %esi
  48. popl %ebx
  49. popl %ebp
  50. /* Returns 0 on success, else an error code. */
  51. negl %eax
  52. #elif defined __NR_fadvise64
  53. /* Save regs */
  54. pushl %ebx
  55. pushl %esi
  56. pushl %edi
  57. #if 0
  58. /* does len overflow long? */
  59. cmpl $0, 28(%esp)
  60. movl $-EOVERFLOW, %eax
  61. jne overflow
  62. #endif
  63. movl $__NR_fadvise64, %eax /* Syscall number in %eax. */
  64. movl 16(%esp), %ebx
  65. movl 20(%esp), %ecx
  66. movl 24(%esp), %edx
  67. movl 28(%esp), %esi
  68. movl 32(%esp), %edi
  69. /* Do the system call trap. */
  70. int $0x80
  71. overflow:
  72. /* Restore regs */
  73. popl %edi
  74. popl %esi
  75. popl %ebx
  76. /* Returns 0 on success, else an error code. */
  77. negl %eax
  78. #elif defined __UCLIBC_HAS_STUBS__
  79. movl $-ENOSYS, %eax
  80. jmp __syscall_error
  81. #endif
  82. /* Successful; return the syscall's value. */
  83. ret
  84. .size posix_fadvise64,.-posix_fadvise64
  85. /*
  86. ** libc_hidden_def(__libc_posix_fadvise64)
  87. ** #if defined __UCLIBC_HAS_LFS__ && defined __UCLIBC_HAS_ADVANCED_REALTIME__
  88. ** weak_alias(__libc_posix_fadvise64,posix_fadvise64)
  89. ** #endif
  90. */