posix_fadvise64.S 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 posix_fadvise64
  22. .type posix_fadvise64,%function
  23. posix_fadvise64:
  24. #if defined __NR_fadvise64_64 && defined __UCLIBC_HAS_LFS__
  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 24(%esp), %ebx
  32. movl 28(%esp), %ecx
  33. movl 32(%esp), %edx
  34. movl 36(%esp), %esi
  35. movl 40(%esp), %edi
  36. movl 44(%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. /* If 0 > %eax > -4096 there was an error. */
  45. cmpl $-4096, %eax
  46. ja __syscall_error
  47. #elif defined __NR_fadvise64
  48. /* Save regs */
  49. pushl %ebx
  50. pushl %esi
  51. pushl %edi
  52. /* does len overflow long? */
  53. cmpl $0, 40(%esp)
  54. movl $-EOVERFLOW, %eax
  55. ja overflow
  56. movl $__NR_fadvise64, %eax /* Syscall number in %eax. */
  57. movl 24(%esp), %ebx
  58. movl 28(%esp), %ecx
  59. movl 32(%esp), %edx
  60. movl 36(%esp), %esi
  61. movl 44(%esp), %edi
  62. /* Do the system call trap. */
  63. int $0x80
  64. overflow:
  65. /* Restore regs */
  66. popl %edi
  67. popl %esi
  68. popl %ebx
  69. /* If 0 > %eax > -4096 there was an error. */
  70. cmpl $-4096, %eax
  71. ja __syscall_error
  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 posix_fadvise64,.-posix_fadvise64
  79. libc_hidden_def(posix_fadvise64)