You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

139 lines
4.7 KiB

  1. From: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
  2. Subject: Add SH supprt
  3. The test-suite logs can be found at:
  4. <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=535288>
  5. ---
  6. harness/main.c | 2 -
  7. src/libaio.h | 4 ++
  8. src/syscall-sh.h | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
  9. src/syscall.h | 2 +
  10. 4 files changed, 84 insertions(+), 2 deletions(-)
  11. --- a/harness/main.c
  12. +++ b/harness/main.c
  13. @@ -14,7 +14,7 @@
  14. #if __LP64__ == 0
  15. #if defined(__i386__) || defined(__powerpc__) || defined(__mips__)
  16. #define KERNEL_RW_POINTER ((void *)0xc0010000)
  17. -#elif defined(__arm__) || defined(__m68k__) || defined(__s390__)
  18. +#elif defined(__arm__) || defined(__m68k__) || defined(__s390__) || defined(__sh__)
  19. #define KERNEL_RW_POINTER ((void *)0x00010000)
  20. #elif defined(__hppa__)
  21. #define KERNEL_RW_POINTER ((void *)0x10100000)
  22. --- a/src/libaio.h
  23. +++ b/src/libaio.h
  24. @@ -51,7 +51,8 @@ typedef enum io_iocb_cmd {
  25. /* little endian, 32 bits */
  26. #if defined(__i386__) || (defined(__arm__) && !defined(__ARMEB__)) || \
  27. - defined(__sh__) || defined(__bfin__) || defined(__MIPSEL__) || \
  28. + (defined(__sh__) && defined(__LITTLE_ENDIAN__)) || \
  29. + defined(__bfin__) || defined(__MIPSEL__) || \
  30. defined(__cris__)
  31. #define PADDED(x, y) x; unsigned y
  32. #define PADDEDptr(x, y) x; unsigned y
  33. @@ -76,6 +77,7 @@ typedef enum io_iocb_cmd {
  34. /* big endian, 32 bits */
  35. #elif defined(__PPC__) || defined(__s390__) || \
  36. (defined(__arm__) && defined(__ARMEB__)) || \
  37. + (defined(__sh__) && defined (__BIG_ENDIAN__)) || \
  38. defined(__sparc__) || defined(__MIPSEB__) || defined(__m68k__) || \
  39. defined(__hppa__) || defined(__frv__) || defined(__avr32__)
  40. #define PADDED(x, y) unsigned y; x
  41. --- /dev/null
  42. +++ b/src/syscall-sh.h
  43. @@ -0,0 +1,78 @@
  44. +/* Copy from ./arch/sh/include/asm/unistd_32.h */
  45. +#define __NR_io_setup 245
  46. +#define __NR_io_destroy 246
  47. +#define __NR_io_getevents 247
  48. +#define __NR_io_submit 248
  49. +#define __NR_io_cancel 249
  50. +
  51. +#define io_syscall1(type,fname,sname,type1,arg1) \
  52. +type fname(type1 arg1) \
  53. +{ \
  54. +register long __sc0 __asm__ ("r3") = __NR_##sname; \
  55. +register long __sc4 __asm__ ("r4") = (long) arg1; \
  56. +__asm__ __volatile__ ("trapa #0x11" \
  57. + : "=z" (__sc0) \
  58. + : "0" (__sc0), "r" (__sc4) \
  59. + : "memory"); \
  60. + return (type) __sc0;\
  61. +}
  62. +
  63. +#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \
  64. +type fname(type1 arg1,type2 arg2) \
  65. +{ \
  66. +register long __sc0 __asm__ ("r3") = __NR_##sname; \
  67. +register long __sc4 __asm__ ("r4") = (long) arg1; \
  68. +register long __sc5 __asm__ ("r5") = (long) arg2; \
  69. + __asm__ __volatile__ ("trapa #0x12" \
  70. + : "=z" (__sc0) \
  71. + : "0" (__sc0), "r" (__sc4), "r" (__sc5) \
  72. + : "memory"); \
  73. + return (type) __sc0;\
  74. +}
  75. +
  76. +#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \
  77. +type fname(type1 arg1,type2 arg2,type3 arg3) \
  78. +{ \
  79. +register long __sc0 __asm__ ("r3") = __NR_##sname; \
  80. +register long __sc4 __asm__ ("r4") = (long) arg1; \
  81. +register long __sc5 __asm__ ("r5") = (long) arg2; \
  82. +register long __sc6 __asm__ ("r6") = (long) arg3; \
  83. + __asm__ __volatile__ ("trapa #0x13" \
  84. + : "=z" (__sc0) \
  85. + : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6) \
  86. + : "memory"); \
  87. + return (type) __sc0;\
  88. +}
  89. +
  90. +#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
  91. +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
  92. +{ \
  93. +register long __sc0 __asm__ ("r3") = __NR_##sname; \
  94. +register long __sc4 __asm__ ("r4") = (long) arg1; \
  95. +register long __sc5 __asm__ ("r5") = (long) arg2; \
  96. +register long __sc6 __asm__ ("r6") = (long) arg3; \
  97. +register long __sc7 __asm__ ("r7") = (long) arg4; \
  98. +__asm__ __volatile__ ("trapa #0x14" \
  99. + : "=z" (__sc0) \
  100. + : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), \
  101. + "r" (__sc7) \
  102. + : "memory" ); \
  103. + return (type) __sc0;\
  104. +}
  105. +
  106. +#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
  107. +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
  108. +{ \
  109. +register long __sc3 __asm__ ("r3") = __NR_##sname; \
  110. +register long __sc4 __asm__ ("r4") = (long) arg1; \
  111. +register long __sc5 __asm__ ("r5") = (long) arg2; \
  112. +register long __sc6 __asm__ ("r6") = (long) arg3; \
  113. +register long __sc7 __asm__ ("r7") = (long) arg4; \
  114. +register long __sc0 __asm__ ("r0") = (long) arg5; \
  115. +__asm__ __volatile__ ("trapa #0x15" \
  116. + : "=z" (__sc0) \
  117. + : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \
  118. + "r" (__sc3) \
  119. + : "memory" ); \
  120. + return (type) __sc0;\
  121. +}
  122. --- a/src/syscall.h
  123. +++ b/src/syscall.h
  124. @@ -34,6 +34,8 @@
  125. #include "syscall-parisc.h"
  126. #elif defined(__mips__)
  127. #include "syscall-mips.h"
  128. +#elif defined(__sh__)
  129. +#include "syscall-sh.h"
  130. #else
  131. #warning "using generic syscall method"
  132. #include "syscall-generic.h"