sync_file_range.S 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* Copyright (C) 2006, 2007 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, write to the Free
  13. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14. 02111-1307 USA. */
  15. #define _ERRNO_H 1
  16. #include <features.h>
  17. #include <bits/errno.h>
  18. #include <sys/syscall.h>
  19. .text
  20. .global sync_file_range
  21. .type sync_file_range,%function
  22. sync_file_range:
  23. #ifdef __NR_sync_file_range
  24. /* Save regs */
  25. pushl %ebx
  26. pushl %esi
  27. pushl %edi
  28. pushl %ebp
  29. movl $__NR_sync_file_range, %eax /* Syscall number in %eax. */
  30. movl 20(%esp), %ebx
  31. movl 24(%esp), %ecx
  32. movl 28(%esp), %edx
  33. movl 32(%esp), %esi
  34. movl 36(%esp), %edi
  35. movl 40(%esp), %ebp
  36. /* Do the system call trap. */
  37. int $0x80
  38. /* Restore regs */
  39. popl %ebp
  40. popl %edi
  41. popl %esi
  42. popl %ebx
  43. /* If 0 > %eax > -4096 there was an error. */
  44. cmpl $-4096, %eax
  45. ja __syscall_error
  46. #else
  47. movl $-ENOSYS, %eax
  48. jmp __syscall_error
  49. #endif
  50. /* Successful; return the syscall's value. */
  51. ret
  52. .size sync_file_range,.-sync_file_range
  53. libc_hidden_def(sync_file_range)