sysdep.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* Copyright (C) 1991, 92, 93, 96, 98, 2003 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. #include <sysdeps/generic/sysdep.h>
  16. #include <sys/syscall.h>
  17. #define HAVE_SYSCALLS
  18. /* Note that using a `PASTE' macro loses. */
  19. #ifdef __STDC__
  20. #define SYSCALL__(name, args) PSEUDO (__##name, name, args)
  21. #else
  22. #define SYSCALL__(name, args) PSEUDO (__/**/name, name, args)
  23. #endif
  24. #define SYSCALL(name, args) PSEUDO (name, name, args)
  25. /* Machine-dependent sysdep.h files are expected to define the macro
  26. PSEUDO (function_name, syscall_name) to emit assembly code to define the
  27. C-callable function FUNCTION_NAME to do system call SYSCALL_NAME.
  28. r0 and r1 are the system call outputs. MOVE(x, y) should be defined as
  29. an instruction such that "MOVE(r1, r0)" works. ret should be defined
  30. as the return instruction. */
  31. #ifndef SYS_ify
  32. #ifdef __STDC__
  33. #define SYS_ify(syscall_name) SYS_##syscall_name
  34. #else
  35. #define SYS_ify(syscall_name) SYS_/**/syscall_name
  36. #endif
  37. #endif
  38. /* Terminate a system call named SYM. This is used on some platforms
  39. to generate correct debugging information. */
  40. #ifndef PSEUDO_END
  41. #define PSEUDO_END(sym)
  42. #endif
  43. #ifndef PSEUDO_END_NOERRNO
  44. #define PSEUDO_END_NOERRNO(sym) PSEUDO_END(sym)
  45. #endif
  46. #ifndef PSEUDO_END_ERRVAL
  47. #define PSEUDO_END_ERRVAL(sym) PSEUDO_END(sym)
  48. #endif
  49. /* Wrappers around system calls should normally inline the system call code.
  50. But sometimes it is not possible or implemented and we use this code. */
  51. #ifndef INLINE_SYSCALL
  52. #define INLINE_SYSCALL(name, nr, args...) __syscall_##name (args)
  53. #endif