sysdep.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* Copyright (C) 2011-2014 Free Software Foundation, Inc.
  2. The GNU C Library is free software; you can redistribute it and/or
  3. modify it under the terms of the GNU Lesser General Public License as
  4. published by the Free Software Foundation; either version 2.1 of the
  5. License, or (at your option) any later version.
  6. The GNU C Library is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  9. Lesser General Public License for more details.
  10. You should have received a copy of the GNU Lesser General Public
  11. License along with the GNU C Library; if not, see
  12. <http://www.gnu.org/licenses/>. */
  13. #ifndef _LINUX_OR1K_SYSDEP_H
  14. #define _LINUX_OR1K_SYSDEP_H 1
  15. #include <common/sysdep.h>
  16. #include <sys/syscall.h>
  17. /* In order to get __set_errno() definition in INLINE_SYSCALL. */
  18. #ifndef __ASSEMBLER__
  19. #include <errno.h>
  20. #endif
  21. #undef SYS_ify
  22. #define SYS_ify(syscall_name) (__NR_##syscall_name)
  23. #ifdef __ASSEMBLER__
  24. /* Local label name for asm code. */
  25. #define L(name) .L##name
  26. #undef ret_ERRVAL
  27. #define ret_ERRVAL l.jr r9; l.nop
  28. #define ret_NOERRNO l.jr r9; l.nop
  29. #undef DO_CALL
  30. #define DO_CALL(syscall_name) \
  31. l.addi r11, r0, SYS_ify (syscall_name); \
  32. l.sys 1; \
  33. l.nop
  34. /* Make use of .size directive. */
  35. #define ASM_SIZE_DIRECTIVE(name) .size name,.-name;
  36. /* Define an entry point visible from C. */
  37. #define ENTRY(name) \
  38. .globl C_SYMBOL_NAME(name); \
  39. .type C_SYMBOL_NAME(name),@function; \
  40. .align 4; \
  41. C_LABEL(name) \
  42. cfi_startproc; \
  43. #undef END
  44. #define END(name) \
  45. cfi_endproc; \
  46. ASM_SIZE_DIRECTIVE(name)
  47. /* Since C identifiers are not normally prefixed with an underscore
  48. on this system, the asm identifier `syscall_error' intrudes on the
  49. C name space. Make sure we use an innocuous name. */
  50. #define syscall_error __syscall_error
  51. /* Specify the size in bytes of a machine register. */
  52. #define REGSIZE 4
  53. #endif /* __ASSEMBLER__ */
  54. #endif /* linux/or1k/sysdep.h */