sync_file_range.S 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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, see
  13. <http://www.gnu.org/licenses/>. */
  14. #define _ERRNO_H 1
  15. #include <features.h>
  16. #include <bits/errno.h>
  17. #include <sys/syscall.h>
  18. .text
  19. .global sync_file_range
  20. .type sync_file_range,%function
  21. sync_file_range:
  22. #ifdef __NR_sync_file_range
  23. /* Save regs */
  24. pushl %ebx
  25. pushl %esi
  26. pushl %edi
  27. pushl %ebp
  28. movl $__NR_sync_file_range, %eax /* Syscall number in %eax. */
  29. movl 20(%esp), %ebx
  30. movl 24(%esp), %ecx
  31. movl 28(%esp), %edx
  32. movl 32(%esp), %esi
  33. movl 36(%esp), %edi
  34. movl 40(%esp), %ebp
  35. /* Do the system call trap. */
  36. int $0x80
  37. /* Restore regs */
  38. popl %ebp
  39. popl %edi
  40. popl %esi
  41. popl %ebx
  42. /* If 0 > %eax > -4096 there was an error. */
  43. cmpl $-4096, %eax
  44. ja __syscall_error
  45. #else
  46. movl $-ENOSYS, %eax
  47. jmp __syscall_error
  48. #endif
  49. /* Successful; return the syscall's value. */
  50. ret
  51. .size sync_file_range,.-sync_file_range
  52. libc_hidden_def(sync_file_range)