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.

1098 lines
38 KiB

  1. ---
  2. harness/main.c | 10 ++
  3. src/libaio.h | 30 ++++++
  4. src/syscall-m68k.h | 78 +++++++++++++++++
  5. src/syscall-mips.h | 223 +++++++++++++++++++++++++++++++++++++++++++++++++++
  6. src/syscall-parisc.h | 146 +++++++++++++++++++++++++++++++++
  7. src/syscall-sparc.h | 130 +++++++++++++++++++++++++++++
  8. src/syscall.h | 8 +
  9. 7 files changed, 625 insertions(+)
  10. Index: libaio-0.3.109/src/syscall-m68k.h
  11. ===================================================================
  12. --- /dev/null 1970-01-01 00:00:00.000000000 +0000
  13. +++ libaio-0.3.109/src/syscall-m68k.h 2014-06-11 10:40:07.921826651 +0200
  14. @@ -0,0 +1,78 @@
  15. +#define __NR_io_setup 241
  16. +#define __NR_io_destroy 242
  17. +#define __NR_io_getevents 243
  18. +#define __NR_io_submit 244
  19. +#define __NR_io_cancel 245
  20. +
  21. +#define io_syscall1(type,fname,sname,atype,a) \
  22. +type fname(atype a) \
  23. +{ \
  24. +register long __res __asm__ ("%d0") = __NR_##sname; \
  25. +register long __a __asm__ ("%d1") = (long)(a); \
  26. +__asm__ __volatile__ ("trap #0" \
  27. + : "+d" (__res) \
  28. + : "d" (__a) ); \
  29. +return (type) __res; \
  30. +}
  31. +
  32. +#define io_syscall2(type,fname,sname,atype,a,btype,b) \
  33. +type fname(atype a,btype b) \
  34. +{ \
  35. +register long __res __asm__ ("%d0") = __NR_##sname; \
  36. +register long __a __asm__ ("%d1") = (long)(a); \
  37. +register long __b __asm__ ("%d2") = (long)(b); \
  38. +__asm__ __volatile__ ("trap #0" \
  39. + : "+d" (__res) \
  40. + : "d" (__a), "d" (__b) \
  41. + ); \
  42. +return (type) __res; \
  43. +}
  44. +
  45. +#define io_syscall3(type,fname,sname,atype,a,btype,b,ctype,c) \
  46. +type fname(atype a,btype b,ctype c) \
  47. +{ \
  48. +register long __res __asm__ ("%d0") = __NR_##sname; \
  49. +register long __a __asm__ ("%d1") = (long)(a); \
  50. +register long __b __asm__ ("%d2") = (long)(b); \
  51. +register long __c __asm__ ("%d3") = (long)(c); \
  52. +__asm__ __volatile__ ("trap #0" \
  53. + : "+d" (__res) \
  54. + : "d" (__a), "d" (__b), \
  55. + "d" (__c) \
  56. + ); \
  57. +return (type) __res; \
  58. +}
  59. +
  60. +#define io_syscall4(type,fname,sname,atype,a,btype,b,ctype,c,dtype,d) \
  61. +type fname (atype a, btype b, ctype c, dtype d) \
  62. +{ \
  63. +register long __res __asm__ ("%d0") = __NR_##sname; \
  64. +register long __a __asm__ ("%d1") = (long)(a); \
  65. +register long __b __asm__ ("%d2") = (long)(b); \
  66. +register long __c __asm__ ("%d3") = (long)(c); \
  67. +register long __d __asm__ ("%d4") = (long)(d); \
  68. +__asm__ __volatile__ ("trap #0" \
  69. + : "+d" (__res) \
  70. + : "d" (__a), "d" (__b), \
  71. + "d" (__c), "d" (__d) \
  72. + ); \
  73. +return (type) __res; \
  74. +}
  75. +
  76. +#define io_syscall5(type,fname,sname,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
  77. +type fname (atype a,btype b,ctype c,dtype d,etype e) \
  78. +{ \
  79. +register long __res __asm__ ("%d0") = __NR_##sname; \
  80. +register long __a __asm__ ("%d1") = (long)(a); \
  81. +register long __b __asm__ ("%d2") = (long)(b); \
  82. +register long __c __asm__ ("%d3") = (long)(c); \
  83. +register long __d __asm__ ("%d4") = (long)(d); \
  84. +register long __e __asm__ ("%d5") = (long)(e); \
  85. +__asm__ __volatile__ ("trap #0" \
  86. + : "+d" (__res) \
  87. + : "d" (__a), "d" (__b), \
  88. + "d" (__c), "d" (__d), "d" (__e) \
  89. + ); \
  90. +return (type) __res; \
  91. +}
  92. +
  93. Index: libaio-0.3.109/src/syscall-sparc.h
  94. ===================================================================
  95. --- /dev/null 1970-01-01 00:00:00.000000000 +0000
  96. +++ libaio-0.3.109/src/syscall-sparc.h 2014-06-11 10:40:07.921826651 +0200
  97. @@ -0,0 +1,130 @@
  98. +/* $Id: unistd.h,v 1.74 2002/02/08 03:57:18 davem Exp $ */
  99. +
  100. +/*
  101. + * System calls under the Sparc.
  102. + *
  103. + * Don't be scared by the ugly clobbers, it is the only way I can
  104. + * think of right now to force the arguments into fixed registers
  105. + * before the trap into the system call with gcc 'asm' statements.
  106. + *
  107. + * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  108. + *
  109. + * SunOS compatibility based upon preliminary work which is:
  110. + *
  111. + * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu)
  112. + */
  113. +
  114. +
  115. +#define __NR_io_setup 268
  116. +#define __NR_io_destroy 269
  117. +#define __NR_io_submit 270
  118. +#define __NR_io_cancel 271
  119. +#define __NR_io_getevents 272
  120. +
  121. +
  122. +#define io_syscall1(type,fname,sname,type1,arg1) \
  123. +type fname(type1 arg1) \
  124. +{ \
  125. +long __res; \
  126. +register long __g1 __asm__ ("g1") = __NR_##sname; \
  127. +register long __o0 __asm__ ("o0") = (long)(arg1); \
  128. +__asm__ __volatile__ ("t 0x10\n\t" \
  129. + "bcc 1f\n\t" \
  130. + "mov %%o0, %0\n\t" \
  131. + "sub %%g0, %%o0, %0\n\t" \
  132. + "1:\n\t" \
  133. + : "=r" (__res), "=&r" (__o0) \
  134. + : "1" (__o0), "r" (__g1) \
  135. + : "cc"); \
  136. +if (__res < -255 || __res >= 0) \
  137. + return (type) __res; \
  138. +return -1; \
  139. +}
  140. +
  141. +#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \
  142. +type fname(type1 arg1,type2 arg2) \
  143. +{ \
  144. +long __res; \
  145. +register long __g1 __asm__ ("g1") = __NR_##sname; \
  146. +register long __o0 __asm__ ("o0") = (long)(arg1); \
  147. +register long __o1 __asm__ ("o1") = (long)(arg2); \
  148. +__asm__ __volatile__ ("t 0x10\n\t" \
  149. + "bcc 1f\n\t" \
  150. + "mov %%o0, %0\n\t" \
  151. + "sub %%g0, %%o0, %0\n\t" \
  152. + "1:\n\t" \
  153. + : "=r" (__res), "=&r" (__o0) \
  154. + : "1" (__o0), "r" (__o1), "r" (__g1) \
  155. + : "cc"); \
  156. +if (__res < -255 || __res >= 0) \
  157. + return (type) __res; \
  158. +return -1; \
  159. +}
  160. +
  161. +#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \
  162. +type fname(type1 arg1,type2 arg2,type3 arg3) \
  163. +{ \
  164. +long __res; \
  165. +register long __g1 __asm__ ("g1") = __NR_##sname; \
  166. +register long __o0 __asm__ ("o0") = (long)(arg1); \
  167. +register long __o1 __asm__ ("o1") = (long)(arg2); \
  168. +register long __o2 __asm__ ("o2") = (long)(arg3); \
  169. +__asm__ __volatile__ ("t 0x10\n\t" \
  170. + "bcc 1f\n\t" \
  171. + "mov %%o0, %0\n\t" \
  172. + "sub %%g0, %%o0, %0\n\t" \
  173. + "1:\n\t" \
  174. + : "=r" (__res), "=&r" (__o0) \
  175. + : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) \
  176. + : "cc"); \
  177. +if (__res < -255 || __res>=0) \
  178. + return (type) __res; \
  179. +return -1; \
  180. +}
  181. +
  182. +#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
  183. +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
  184. +{ \
  185. +long __res; \
  186. +register long __g1 __asm__ ("g1") = __NR_##sname; \
  187. +register long __o0 __asm__ ("o0") = (long)(arg1); \
  188. +register long __o1 __asm__ ("o1") = (long)(arg2); \
  189. +register long __o2 __asm__ ("o2") = (long)(arg3); \
  190. +register long __o3 __asm__ ("o3") = (long)(arg4); \
  191. +__asm__ __volatile__ ("t 0x10\n\t" \
  192. + "bcc 1f\n\t" \
  193. + "mov %%o0, %0\n\t" \
  194. + "sub %%g0, %%o0, %0\n\t" \
  195. + "1:\n\t" \
  196. + : "=r" (__res), "=&r" (__o0) \
  197. + : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__g1) \
  198. + : "cc"); \
  199. +if (__res < -255 || __res>=0) \
  200. + return (type) __res; \
  201. +return -1; \
  202. +}
  203. +
  204. +#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
  205. + type5,arg5) \
  206. +type fname(type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
  207. +{ \
  208. +long __res; \
  209. +register long __g1 __asm__ ("g1") = __NR_##sname; \
  210. +register long __o0 __asm__ ("o0") = (long)(arg1); \
  211. +register long __o1 __asm__ ("o1") = (long)(arg2); \
  212. +register long __o2 __asm__ ("o2") = (long)(arg3); \
  213. +register long __o3 __asm__ ("o3") = (long)(arg4); \
  214. +register long __o4 __asm__ ("o4") = (long)(arg5); \
  215. +__asm__ __volatile__ ("t 0x10\n\t" \
  216. + "bcc 1f\n\t" \
  217. + "mov %%o0, %0\n\t" \
  218. + "sub %%g0, %%o0, %0\n\t" \
  219. + "1:\n\t" \
  220. + : "=r" (__res), "=&r" (__o0) \
  221. + : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__g1) \
  222. + : "cc"); \
  223. +if (__res < -255 || __res>=0) \
  224. + return (type) __res; \
  225. +return -1; \
  226. +}
  227. +
  228. Index: libaio-0.3.109/src/syscall.h
  229. ===================================================================
  230. --- libaio-0.3.109.orig/src/syscall.h 2014-06-11 10:40:07.929826651 +0200
  231. +++ libaio-0.3.109/src/syscall.h 2014-06-11 10:40:07.925826651 +0200
  232. @@ -24,6 +24,20 @@
  233. #include "syscall-alpha.h"
  234. #elif defined(__arm__)
  235. #include "syscall-arm.h"
  236. +#elif defined(__m68k__)
  237. +#include "syscall-m68k.h"
  238. +#elif defined(__sparc__) && defined(__arch64__)
  239. +#include "syscall-sparc64.h"
  240. +#elif defined(__sparc__)
  241. +#include "syscall-sparc.h"
  242. +#elif defined(__hppa__)
  243. +#include "syscall-parisc.h"
  244. +#elif defined(__mips__)
  245. +#include "syscall-mips.h"
  246. +#elif defined(__sh__)
  247. +#include "syscall-sh.h"
  248. +#elif defined(__aarch64__)
  249. +#include "syscall-arm64.h"
  250. #else
  251. #error "add syscall-arch.h"
  252. #endif
  253. Index: libaio-0.3.109/src/syscall-mips.h
  254. ===================================================================
  255. --- /dev/null 1970-01-01 00:00:00.000000000 +0000
  256. +++ libaio-0.3.109/src/syscall-mips.h 2014-06-11 10:40:07.921826651 +0200
  257. @@ -0,0 +1,223 @@
  258. +/*
  259. + * This file is subject to the terms and conditions of the GNU General Public
  260. + * License. See the file "COPYING" in the main directory of this archive
  261. + * for more details.
  262. + *
  263. + * Copyright (C) 1995, 96, 97, 98, 99, 2000 by Ralf Baechle
  264. + * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
  265. + *
  266. + * Changed system calls macros _syscall5 - _syscall7 to push args 5 to 7 onto
  267. + * the stack. Robin Farine for ACN S.A, Copyright (C) 1996 by ACN S.A
  268. + */
  269. +
  270. +#ifndef _MIPS_SIM_ABI32
  271. +#define _MIPS_SIM_ABI32 1
  272. +#define _MIPS_SIM_NABI32 2
  273. +#define _MIPS_SIM_ABI64 3
  274. +#endif
  275. +
  276. +#if _MIPS_SIM == _MIPS_SIM_ABI32
  277. +
  278. +/*
  279. + * Linux o32 style syscalls are in the range from 4000 to 4999.
  280. + */
  281. +#define __NR_Linux 4000
  282. +#define __NR_io_setup (__NR_Linux + 241)
  283. +#define __NR_io_destroy (__NR_Linux + 242)
  284. +#define __NR_io_getevents (__NR_Linux + 243)
  285. +#define __NR_io_submit (__NR_Linux + 244)
  286. +#define __NR_io_cancel (__NR_Linux + 245)
  287. +
  288. +#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
  289. +
  290. +#if _MIPS_SIM == _MIPS_SIM_ABI64
  291. +
  292. +/*
  293. + * Linux 64-bit syscalls are in the range from 5000 to 5999.
  294. + */
  295. +#define __NR_Linux 5000
  296. +#define __NR_io_setup (__NR_Linux + 200)
  297. +#define __NR_io_destroy (__NR_Linux + 201)
  298. +#define __NR_io_getevents (__NR_Linux + 202)
  299. +#define __NR_io_submit (__NR_Linux + 203)
  300. +#define __NR_io_cancel (__NR_Linux + 204)
  301. +#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
  302. +
  303. +#if _MIPS_SIM == _MIPS_SIM_NABI32
  304. +
  305. +/*
  306. + * Linux N32 syscalls are in the range from 6000 to 6999.
  307. + */
  308. +#define __NR_Linux 6000
  309. +#define __NR_io_setup (__NR_Linux + 200)
  310. +#define __NR_io_destroy (__NR_Linux + 201)
  311. +#define __NR_io_getevents (__NR_Linux + 202)
  312. +#define __NR_io_submit (__NR_Linux + 203)
  313. +#define __NR_io_cancel (__NR_Linux + 204)
  314. +#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
  315. +
  316. +#define io_syscall1(type,fname,sname,atype,a) \
  317. +type fname(atype a) \
  318. +{ \
  319. + register unsigned long __a0 asm("$4") = (unsigned long) a; \
  320. + register unsigned long __a3 asm("$7"); \
  321. + unsigned long __v0; \
  322. + \
  323. + __asm__ volatile ( \
  324. + ".set\tnoreorder\n\t" \
  325. + "li\t$2, %3\t\t\t# " #fname "\n\t" \
  326. + "syscall\n\t" \
  327. + "move\t%0, $2\n\t" \
  328. + ".set\treorder" \
  329. + : "=&r" (__v0), "=r" (__a3) \
  330. + : "r" (__a0), "i" (__NR_##sname) \
  331. + : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
  332. + "memory"); \
  333. + \
  334. + if (__a3 == 0) \
  335. + return (type) __v0; \
  336. + return (type) -1; \
  337. +}
  338. +
  339. +#define io_syscall2(type,fname,sname,atype,a,btype,b) \
  340. +type fname(atype a, btype b) \
  341. +{ \
  342. + register unsigned long __a0 asm("$4") = (unsigned long) a; \
  343. + register unsigned long __a1 asm("$5") = (unsigned long) b; \
  344. + register unsigned long __a3 asm("$7"); \
  345. + unsigned long __v0; \
  346. + \
  347. + __asm__ volatile ( \
  348. + ".set\tnoreorder\n\t" \
  349. + "li\t$2, %4\t\t\t# " #fname "\n\t" \
  350. + "syscall\n\t" \
  351. + "move\t%0, $2\n\t" \
  352. + ".set\treorder" \
  353. + : "=&r" (__v0), "=r" (__a3) \
  354. + : "r" (__a0), "r" (__a1), "i" (__NR_##sname) \
  355. + : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
  356. + "memory"); \
  357. + \
  358. + if (__a3 == 0) \
  359. + return (type) __v0; \
  360. + return (type) -1; \
  361. +}
  362. +
  363. +#define io_syscall3(type,fname,sname,atype,a,btype,b,ctype,c) \
  364. +type fname(atype a, btype b, ctype c) \
  365. +{ \
  366. + register unsigned long __a0 asm("$4") = (unsigned long) a; \
  367. + register unsigned long __a1 asm("$5") = (unsigned long) b; \
  368. + register unsigned long __a2 asm("$6") = (unsigned long) c; \
  369. + register unsigned long __a3 asm("$7"); \
  370. + unsigned long __v0; \
  371. + \
  372. + __asm__ volatile ( \
  373. + ".set\tnoreorder\n\t" \
  374. + "li\t$2, %5\t\t\t# " #fname "\n\t" \
  375. + "syscall\n\t" \
  376. + "move\t%0, $2\n\t" \
  377. + ".set\treorder" \
  378. + : "=&r" (__v0), "=r" (__a3) \
  379. + : "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##sname) \
  380. + : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
  381. + "memory"); \
  382. + \
  383. + if (__a3 == 0) \
  384. + return (type) __v0; \
  385. + return (type) -1; \
  386. +}
  387. +
  388. +#define io_syscall4(type,fname,sname,atype,a,btype,b,ctype,c,dtype,d) \
  389. +type fname(atype a, btype b, ctype c, dtype d) \
  390. +{ \
  391. + register unsigned long __a0 asm("$4") = (unsigned long) a; \
  392. + register unsigned long __a1 asm("$5") = (unsigned long) b; \
  393. + register unsigned long __a2 asm("$6") = (unsigned long) c; \
  394. + register unsigned long __a3 asm("$7") = (unsigned long) d; \
  395. + unsigned long __v0; \
  396. + \
  397. + __asm__ volatile ( \
  398. + ".set\tnoreorder\n\t" \
  399. + "li\t$2, %5\t\t\t# " #fname "\n\t" \
  400. + "syscall\n\t" \
  401. + "move\t%0, $2\n\t" \
  402. + ".set\treorder" \
  403. + : "=&r" (__v0), "+r" (__a3) \
  404. + : "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##sname) \
  405. + : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
  406. + "memory"); \
  407. + \
  408. + if (__a3 == 0) \
  409. + return (type) __v0; \
  410. + return (type) -1; \
  411. +}
  412. +
  413. +#if (_MIPS_SIM == _MIPS_SIM_ABI32)
  414. +
  415. +/*
  416. + * Using those means your brain needs more than an oil change ;-)
  417. + */
  418. +
  419. +#define io_syscall5(type,fname,sname,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
  420. +type fname(atype a, btype b, ctype c, dtype d, etype e) \
  421. +{ \
  422. + register unsigned long __a0 asm("$4") = (unsigned long) a; \
  423. + register unsigned long __a1 asm("$5") = (unsigned long) b; \
  424. + register unsigned long __a2 asm("$6") = (unsigned long) c; \
  425. + register unsigned long __a3 asm("$7") = (unsigned long) d; \
  426. + unsigned long __v0; \
  427. + \
  428. + __asm__ volatile ( \
  429. + ".set\tnoreorder\n\t" \
  430. + "lw\t$2, %6\n\t" \
  431. + "subu\t$29, 32\n\t" \
  432. + "sw\t$2, 16($29)\n\t" \
  433. + "li\t$2, %5\t\t\t# " #fname "\n\t" \
  434. + "syscall\n\t" \
  435. + "move\t%0, $2\n\t" \
  436. + "addiu\t$29, 32\n\t" \
  437. + ".set\treorder" \
  438. + : "=&r" (__v0), "+r" (__a3) \
  439. + : "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##sname), \
  440. + "m" ((unsigned long)e) \
  441. + : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
  442. + "memory"); \
  443. + \
  444. + if (__a3 == 0) \
  445. + return (type) __v0; \
  446. + return (type) -1; \
  447. +}
  448. +
  449. +#endif /* (_MIPS_SIM == _MIPS_SIM_ABI32) */
  450. +
  451. +#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
  452. +
  453. +#define io_syscall5(type,fname,sname,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
  454. +type fname (atype a,btype b,ctype c,dtype d,etype e) \
  455. +{ \
  456. + register unsigned long __a0 asm("$4") = (unsigned long) a; \
  457. + register unsigned long __a1 asm("$5") = (unsigned long) b; \
  458. + register unsigned long __a2 asm("$6") = (unsigned long) c; \
  459. + register unsigned long __a3 asm("$7") = (unsigned long) d; \
  460. + register unsigned long __a4 asm("$8") = (unsigned long) e; \
  461. + unsigned long __v0; \
  462. + \
  463. + __asm__ volatile ( \
  464. + ".set\tnoreorder\n\t" \
  465. + "li\t$2, %6\t\t\t# " #fname "\n\t" \
  466. + "syscall\n\t" \
  467. + "move\t%0, $2\n\t" \
  468. + ".set\treorder" \
  469. + : "=&r" (__v0), "+r" (__a3) \
  470. + : "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4), "i" (__NR_##sname) \
  471. + : "$2", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
  472. + "memory"); \
  473. + \
  474. + if (__a3 == 0) \
  475. + return (type) __v0; \
  476. + return (type) -1; \
  477. +}
  478. +
  479. +#endif /* (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64) */
  480. +
  481. Index: libaio-0.3.109/src/libaio.h
  482. ===================================================================
  483. --- libaio-0.3.109.orig/src/libaio.h 2014-06-11 10:40:07.929826651 +0200
  484. +++ libaio-0.3.109/src/libaio.h 2014-06-11 10:40:07.925826651 +0200
  485. @@ -57,7 +57,8 @@
  486. #define PADDED(x, y) x, y
  487. #define PADDEDptr(x, y) x
  488. #define PADDEDul(x, y) unsigned long x
  489. -#elif defined(__powerpc64__) /* big endian, 64 bits */
  490. +#elif defined(__powerpc64__) || \
  491. + (defined(__sparc__) && defined(__arch64__)) /* big endian, 64 bits */
  492. #define PADDED(x, y) unsigned y; x
  493. #define PADDEDptr(x,y) x
  494. #define PADDEDul(x, y) unsigned long x
  495. @@ -83,6 +84,56 @@
  496. #define PADDEDptr(x, y) x; unsigned y
  497. #define PADDEDul(x, y) unsigned long x; unsigned y
  498. # endif
  499. +#elif defined(__m68k__) /* big endian, 32 bits */
  500. +#define PADDED(x, y) unsigned y; x
  501. +#define PADDEDptr(x, y) unsigned y; x
  502. +#define PADDEDul(x, y) unsigned y; unsigned long x
  503. +#elif defined(__sparc__) /* big endian, 32 bits */
  504. +#define PADDED(x, y) unsigned y; x
  505. +#define PADDEDptr(x, y) unsigned y; x
  506. +#define PADDEDul(x, y) unsigned y; unsigned long x
  507. +#elif defined(__hppa__)
  508. +# if defined(__arch64__) /* big endian, 64 bits */
  509. +#define PADDED(x, y) unsigned y; x
  510. +#define PADDEDptr(x,y) x
  511. +#define PADDEDul(x, y) unsigned long x
  512. +# else /* big endian, 32 bits */
  513. +#define PADDED(x, y) unsigned y; x
  514. +#define PADDEDptr(x, y) unsigned y; x
  515. +#define PADDEDul(x, y) unsigned y; unsigned long x
  516. +#endif
  517. +#elif defined(__mips__)
  518. +# if defined (__MIPSEB__) /* big endian, 32 bits */
  519. +#define PADDED(x, y) unsigned y; x
  520. +#define PADDEDptr(x, y) unsigned y; x
  521. +#define PADDEDul(x, y) unsigned y; unsigned long x
  522. +# elif defined(__MIPSEL__) /* little endian, 32 bits */
  523. +#define PADDED(x, y) x; unsigned y
  524. +#define PADDEDptr(x, y) x; unsigned y
  525. +#define PADDEDul(x, y) unsigned long x; unsigned y
  526. +# else
  527. +# error "neither mipseb nor mipsel?"
  528. +# endif
  529. +#elif defined(__sh__) /* sh3/sh4*/
  530. +# if defined (__BIG_ENDIAN__) /* big endian, 32 bits */
  531. +#define PADDED(x, y) unsigned y; x
  532. +#define PADDEDptr(x, y) unsigned y; x
  533. +#define PADDEDul(x, y) unsigned y; unsigned long x
  534. +# elif defined(__LITTLE_ENDIAN__) /* little endian, 32 bits */
  535. +#define PADDED(x, y) x; unsigned y
  536. +#define PADDEDptr(x, y) x; unsigned y
  537. +#define PADDEDul(x, y) unsigned long x; unsigned y
  538. +# endif
  539. +#elif defined(__aarch64__)
  540. +# if defined (__AARCH64EB__) /* big endian, 64 bits */
  541. +#define PADDED(x, y) unsigned y; x
  542. +#define PADDEDptr(x,y) x
  543. +#define PADDEDul(x, y) unsigned long x
  544. +# elif defined(__AARCH64EL__) /* little endian, 64 bits */
  545. +#define PADDED(x, y) x, y
  546. +#define PADDEDptr(x, y) x
  547. +#define PADDEDul(x, y) unsigned long x
  548. +# endif
  549. #else
  550. #error endian?
  551. #endif
  552. Index: libaio-0.3.109/src/syscall-parisc.h
  553. ===================================================================
  554. --- /dev/null 1970-01-01 00:00:00.000000000 +0000
  555. +++ libaio-0.3.109/src/syscall-parisc.h 2014-06-11 10:40:07.921826651 +0200
  556. @@ -0,0 +1,146 @@
  557. +/*
  558. + * Linux system call numbers.
  559. + *
  560. + * Cary Coutant says that we should just use another syscall gateway
  561. + * page to avoid clashing with the HPUX space, and I think he's right:
  562. + * it will would keep a branch out of our syscall entry path, at the
  563. + * very least. If we decide to change it later, we can ``just'' tweak
  564. + * the LINUX_GATEWAY_ADDR define at the bottom and make __NR_Linux be
  565. + * 1024 or something. Oh, and recompile libc. =)
  566. + *
  567. + * 64-bit HPUX binaries get the syscall gateway address passed in a register
  568. + * from the kernel at startup, which seems a sane strategy.
  569. + */
  570. +
  571. +#define __NR_Linux 0
  572. +#define __NR_io_setup (__NR_Linux + 215)
  573. +#define __NR_io_destroy (__NR_Linux + 216)
  574. +#define __NR_io_getevents (__NR_Linux + 217)
  575. +#define __NR_io_submit (__NR_Linux + 218)
  576. +#define __NR_io_cancel (__NR_Linux + 219)
  577. +
  578. +#define SYS_ify(syscall_name) __NR_##syscall_name
  579. +
  580. +/* Assume all syscalls are done from PIC code just to be
  581. + * safe. The worst case scenario is that you lose a register
  582. + * and save/restore r19 across the syscall. */
  583. +#define PIC
  584. +
  585. +/* Definition taken from glibc 2.3.3
  586. + * sysdeps/unix/sysv/linux/hppa/sysdep.h
  587. + */
  588. +
  589. +#ifdef PIC
  590. +/* WARNING: CANNOT BE USED IN A NOP! */
  591. +# define K_STW_ASM_PIC " copy %%r19, %%r4\n"
  592. +# define K_LDW_ASM_PIC " copy %%r4, %%r19\n"
  593. +# define K_USING_GR4 "%r4",
  594. +#else
  595. +# define K_STW_ASM_PIC " \n"
  596. +# define K_LDW_ASM_PIC " \n"
  597. +# define K_USING_GR4
  598. +#endif
  599. +
  600. +/* GCC has to be warned that a syscall may clobber all the ABI
  601. + registers listed as "caller-saves", see page 8, Table 2
  602. + in section 2.2.6 of the PA-RISC RUN-TIME architecture
  603. + document. However! r28 is the result and will conflict with
  604. + the clobber list so it is left out. Also the input arguments
  605. + registers r20 -> r26 will conflict with the list so they
  606. + are treated specially. Although r19 is clobbered by the syscall
  607. + we cannot say this because it would violate ABI, thus we say
  608. + r4 is clobbered and use that register to save/restore r19
  609. + across the syscall. */
  610. +
  611. +#define K_CALL_CLOB_REGS "%r1", "%r2", K_USING_GR4 \
  612. + "%r20", "%r29", "%r31"
  613. +
  614. +#undef K_INLINE_SYSCALL
  615. +#define K_INLINE_SYSCALL(name, nr, args...) ({ \
  616. + long __sys_res; \
  617. + { \
  618. + register unsigned long __res __asm__("r28"); \
  619. + K_LOAD_ARGS_##nr(args) \
  620. + /* FIXME: HACK stw/ldw r19 around syscall */ \
  621. + __asm__ volatile( \
  622. + K_STW_ASM_PIC \
  623. + " ble 0x100(%%sr2, %%r0)\n" \
  624. + " ldi %1, %%r20\n" \
  625. + K_LDW_ASM_PIC \
  626. + : "=r" (__res) \
  627. + : "i" (SYS_ify(name)) K_ASM_ARGS_##nr \
  628. + : "memory", K_CALL_CLOB_REGS K_CLOB_ARGS_##nr \
  629. + ); \
  630. + __sys_res = (long)__res; \
  631. + } \
  632. + __sys_res; \
  633. +})
  634. +
  635. +#define K_LOAD_ARGS_0()
  636. +#define K_LOAD_ARGS_1(r26) \
  637. + register unsigned long __r26 __asm__("r26") = (unsigned long)(r26); \
  638. + K_LOAD_ARGS_0()
  639. +#define K_LOAD_ARGS_2(r26,r25) \
  640. + register unsigned long __r25 __asm__("r25") = (unsigned long)(r25); \
  641. + K_LOAD_ARGS_1(r26)
  642. +#define K_LOAD_ARGS_3(r26,r25,r24) \
  643. + register unsigned long __r24 __asm__("r24") = (unsigned long)(r24); \
  644. + K_LOAD_ARGS_2(r26,r25)
  645. +#define K_LOAD_ARGS_4(r26,r25,r24,r23) \
  646. + register unsigned long __r23 __asm__("r23") = (unsigned long)(r23); \
  647. + K_LOAD_ARGS_3(r26,r25,r24)
  648. +#define K_LOAD_ARGS_5(r26,r25,r24,r23,r22) \
  649. + register unsigned long __r22 __asm__("r22") = (unsigned long)(r22); \
  650. + K_LOAD_ARGS_4(r26,r25,r24,r23)
  651. +#define K_LOAD_ARGS_6(r26,r25,r24,r23,r22,r21) \
  652. + register unsigned long __r21 __asm__("r21") = (unsigned long)(r21); \
  653. + K_LOAD_ARGS_5(r26,r25,r24,r23,r22)
  654. +
  655. +/* Even with zero args we use r20 for the syscall number */
  656. +#define K_ASM_ARGS_0
  657. +#define K_ASM_ARGS_1 K_ASM_ARGS_0, "r" (__r26)
  658. +#define K_ASM_ARGS_2 K_ASM_ARGS_1, "r" (__r25)
  659. +#define K_ASM_ARGS_3 K_ASM_ARGS_2, "r" (__r24)
  660. +#define K_ASM_ARGS_4 K_ASM_ARGS_3, "r" (__r23)
  661. +#define K_ASM_ARGS_5 K_ASM_ARGS_4, "r" (__r22)
  662. +#define K_ASM_ARGS_6 K_ASM_ARGS_5, "r" (__r21)
  663. +
  664. +/* The registers not listed as inputs but clobbered */
  665. +#define K_CLOB_ARGS_6
  666. +#define K_CLOB_ARGS_5 K_CLOB_ARGS_6, "%r21"
  667. +#define K_CLOB_ARGS_4 K_CLOB_ARGS_5, "%r22"
  668. +#define K_CLOB_ARGS_3 K_CLOB_ARGS_4, "%r23"
  669. +#define K_CLOB_ARGS_2 K_CLOB_ARGS_3, "%r24"
  670. +#define K_CLOB_ARGS_1 K_CLOB_ARGS_2, "%r25"
  671. +#define K_CLOB_ARGS_0 K_CLOB_ARGS_1, "%r26"
  672. +
  673. +#define io_syscall1(type,fname,sname,type1,arg1) \
  674. +type fname(type1 arg1) \
  675. +{ \
  676. + return K_INLINE_SYSCALL(sname, 1, arg1); \
  677. +}
  678. +
  679. +#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \
  680. +type fname(type1 arg1, type2 arg2) \
  681. +{ \
  682. + return K_INLINE_SYSCALL(sname, 2, arg1, arg2); \
  683. +}
  684. +
  685. +#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \
  686. +type fname(type1 arg1, type2 arg2, type3 arg3) \
  687. +{ \
  688. + return K_INLINE_SYSCALL(sname, 3, arg1, arg2, arg3); \
  689. +}
  690. +
  691. +#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
  692. +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
  693. +{ \
  694. + return K_INLINE_SYSCALL(sname, 4, arg1, arg2, arg3, arg4); \
  695. +}
  696. +
  697. +#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
  698. +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
  699. +{ \
  700. + return K_INLINE_SYSCALL(sname, 5, arg1, arg2, arg3, arg4, arg5); \
  701. +}
  702. +
  703. Index: libaio-0.3.109/harness/main.c
  704. ===================================================================
  705. --- libaio-0.3.109.orig/harness/main.c 2014-06-11 10:40:07.929826651 +0200
  706. +++ libaio-0.3.109/harness/main.c 2014-06-11 10:40:07.925826651 +0200
  707. @@ -12,7 +12,17 @@
  708. #include <libaio.h>
  709. #if __LP64__ == 0
  710. +#if defined(__i386__) || defined(__powerpc__) || defined(__mips__)
  711. #define KERNEL_RW_POINTER ((void *)0xc0010000)
  712. +#elif defined(__arm__) || defined(__m68k__) || defined(__s390__) || defined(__sh__) || defined(__x86_64__)
  713. +#define KERNEL_RW_POINTER ((void *)0x00010000)
  714. +#elif defined(__hppa__)
  715. +#define KERNEL_RW_POINTER ((void *)0x10100000)
  716. +#elif defined(__sparc__)
  717. +#define KERNEL_RW_POINTER ((void *)0xf0010000)
  718. +#else
  719. +#error Unknown kernel memory address.
  720. +#endif
  721. #else
  722. //#warning Not really sure where kernel memory is. Guessing.
  723. #define KERNEL_RW_POINTER ((void *)0xffffffff81000000)
  724. Index: libaio-0.3.109/src/syscall-sh.h
  725. ===================================================================
  726. --- /dev/null 1970-01-01 00:00:00.000000000 +0000
  727. +++ libaio-0.3.109/src/syscall-sh.h 2014-06-11 10:40:07.921826651 +0200
  728. @@ -0,0 +1,78 @@
  729. +/* Copy from ./arch/sh/include/asm/unistd_32.h */
  730. +#define __NR_io_setup 245
  731. +#define __NR_io_destroy 246
  732. +#define __NR_io_getevents 247
  733. +#define __NR_io_submit 248
  734. +#define __NR_io_cancel 249
  735. +
  736. +#define io_syscall1(type,fname,sname,type1,arg1) \
  737. +type fname(type1 arg1) \
  738. +{ \
  739. +register long __sc0 __asm__ ("r3") = __NR_##sname; \
  740. +register long __sc4 __asm__ ("r4") = (long) arg1; \
  741. +__asm__ __volatile__ ("trapa #0x11" \
  742. + : "=z" (__sc0) \
  743. + : "0" (__sc0), "r" (__sc4) \
  744. + : "memory"); \
  745. + return (type) __sc0;\
  746. +}
  747. +
  748. +#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \
  749. +type fname(type1 arg1,type2 arg2) \
  750. +{ \
  751. +register long __sc0 __asm__ ("r3") = __NR_##sname; \
  752. +register long __sc4 __asm__ ("r4") = (long) arg1; \
  753. +register long __sc5 __asm__ ("r5") = (long) arg2; \
  754. + __asm__ __volatile__ ("trapa #0x12" \
  755. + : "=z" (__sc0) \
  756. + : "0" (__sc0), "r" (__sc4), "r" (__sc5) \
  757. + : "memory"); \
  758. + return (type) __sc0;\
  759. +}
  760. +
  761. +#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \
  762. +type fname(type1 arg1,type2 arg2,type3 arg3) \
  763. +{ \
  764. +register long __sc0 __asm__ ("r3") = __NR_##sname; \
  765. +register long __sc4 __asm__ ("r4") = (long) arg1; \
  766. +register long __sc5 __asm__ ("r5") = (long) arg2; \
  767. +register long __sc6 __asm__ ("r6") = (long) arg3; \
  768. + __asm__ __volatile__ ("trapa #0x13" \
  769. + : "=z" (__sc0) \
  770. + : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6) \
  771. + : "memory"); \
  772. + return (type) __sc0;\
  773. +}
  774. +
  775. +#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
  776. +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
  777. +{ \
  778. +register long __sc0 __asm__ ("r3") = __NR_##sname; \
  779. +register long __sc4 __asm__ ("r4") = (long) arg1; \
  780. +register long __sc5 __asm__ ("r5") = (long) arg2; \
  781. +register long __sc6 __asm__ ("r6") = (long) arg3; \
  782. +register long __sc7 __asm__ ("r7") = (long) arg4; \
  783. +__asm__ __volatile__ ("trapa #0x14" \
  784. + : "=z" (__sc0) \
  785. + : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), \
  786. + "r" (__sc7) \
  787. + : "memory" ); \
  788. + return (type) __sc0;\
  789. +}
  790. +
  791. +#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
  792. +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
  793. +{ \
  794. +register long __sc3 __asm__ ("r3") = __NR_##sname; \
  795. +register long __sc4 __asm__ ("r4") = (long) arg1; \
  796. +register long __sc5 __asm__ ("r5") = (long) arg2; \
  797. +register long __sc6 __asm__ ("r6") = (long) arg3; \
  798. +register long __sc7 __asm__ ("r7") = (long) arg4; \
  799. +register long __sc0 __asm__ ("r0") = (long) arg5; \
  800. +__asm__ __volatile__ ("trapa #0x15" \
  801. + : "=z" (__sc0) \
  802. + : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \
  803. + "r" (__sc3) \
  804. + : "memory" ); \
  805. + return (type) __sc0;\
  806. +}
  807. Index: libaio-0.3.109/src/syscall-sparc64.h
  808. ===================================================================
  809. --- /dev/null 1970-01-01 00:00:00.000000000 +0000
  810. +++ libaio-0.3.109/src/syscall-sparc64.h 2014-06-11 10:40:07.925826651 +0200
  811. @@ -0,0 +1,98 @@
  812. +#define __NR_io_setup 268
  813. +#define __NR_io_destroy 269
  814. +#define __NR_io_submit 270
  815. +#define __NR_io_cancel 271
  816. +#define __NR_io_getevents 272
  817. +
  818. +#define io_syscall1(type,fname,sname,type1,arg1) \
  819. +type fname(type1 arg1) \
  820. +{ \
  821. + unsigned long __res; \
  822. + register unsigned long __g1 __asm__("g1") = __NR_##sname; \
  823. + register unsigned long __o0 __asm__("o0") = (unsigned long) arg1; \
  824. + __asm__ __volatile__("t 0x6d\n\t" \
  825. + "sub %%g0, %%o0, %0\n\t" \
  826. + "movcc %%xcc, %%o0, %0\n" \
  827. + "1:" \
  828. + : "=r" (__res), "=&r" (__o0) \
  829. + : "1" (__o0), "r" (__g1) \
  830. + : "cc"); \
  831. + return (type) __res; \
  832. +}
  833. +
  834. +#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \
  835. +type fname(type1 arg1, type2 arg2) \
  836. +{ \
  837. + unsigned long __res; \
  838. + register unsigned long __g1 __asm__("g1") = __NR_##sname; \
  839. + register unsigned long __o0 __asm__("o0") = (unsigned long) arg1; \
  840. + register unsigned long __o1 __asm__("o1") = (unsigned long) arg2; \
  841. + __asm__ __volatile__("t 0x6d\n\t" \
  842. + "sub %%g0, %%o0, %0\n\t" \
  843. + "movcc %%xcc, %%o0, %0\n" \
  844. + "1:" \
  845. + : "=r" (__res), "=&r" (__o0) \
  846. + : "1" (__o0), "r" (__o1), "r" (__g1) \
  847. + : "cc"); \
  848. + return (type) __res; \
  849. +}
  850. +
  851. +#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \
  852. +type fname(type1 arg1, type2 arg2, type3 arg3) \
  853. +{ \
  854. + unsigned long __res; \
  855. + register unsigned long __g1 __asm__("g1") = __NR_##sname; \
  856. + register unsigned long __o0 __asm__("o0") = (unsigned long) arg1; \
  857. + register unsigned long __o1 __asm__("o1") = (unsigned long) arg2; \
  858. + register unsigned long __o2 __asm__("o2") = (unsigned long) arg3; \
  859. + __asm__ __volatile__("t 0x6d\n\t" \
  860. + "sub %%g0, %%o0, %0\n\t" \
  861. + "movcc %%xcc, %%o0, %0\n" \
  862. + "1:" \
  863. + : "=r" (__res), "=&r" (__o0) \
  864. + : "1" (__o0), "r" (__o1), "r" (__o2), \
  865. + "r" (__g1) \
  866. + : "cc"); \
  867. + return (type) __res; \
  868. +}
  869. +
  870. +#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
  871. +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
  872. +{ \
  873. + unsigned long __res; \
  874. + register unsigned long __g1 __asm__("g1") = __NR_##sname; \
  875. + register unsigned long __o0 __asm__("o0") = (unsigned long) arg1; \
  876. + register unsigned long __o1 __asm__("o1") = (unsigned long) arg2; \
  877. + register unsigned long __o2 __asm__("o2") = (unsigned long) arg3; \
  878. + register unsigned long __o3 __asm__("o3") = (unsigned long) arg4; \
  879. + __asm__ __volatile__("t 0x6d\n\t" \
  880. + "sub %%g0, %%o0, %0\n\t" \
  881. + "movcc %%xcc, %%o0, %0\n" \
  882. + "1:" \
  883. + : "=r" (__res), "=&r" (__o0) \
  884. + : "1" (__o0), "r" (__o1), "r" (__o2), \
  885. + "r" (__o3), "r" (__g1) \
  886. + : "cc"); \
  887. + return (type) __res; \
  888. +}
  889. +
  890. +#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
  891. +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
  892. +{ \
  893. + unsigned long __res; \
  894. + register unsigned long __g1 __asm__("g1") = __NR_##sname; \
  895. + register unsigned long __o0 __asm__("o0") = (unsigned long) arg1; \
  896. + register unsigned long __o1 __asm__("o1") = (unsigned long) arg2; \
  897. + register unsigned long __o2 __asm__("o2") = (unsigned long) arg3; \
  898. + register unsigned long __o3 __asm__("o3") = (unsigned long) arg4; \
  899. + register unsigned long __o4 __asm__("o4") = (unsigned long) arg5; \
  900. + __asm__ __volatile__("t 0x6d\n\t" \
  901. + "sub %%g0, %%o0, %0\n\t" \
  902. + "movcc %%xcc, %%o0, %0\n" \
  903. + "1:" \
  904. + : "=r" (__res), "=&r" (__o0) \
  905. + : "1" (__o0), "r" (__o1), "r" (__o2), \
  906. + "r" (__o3), "r" (__o4), "r" (__g1) \
  907. + : "cc"); \
  908. + return (type) __res; \
  909. +}
  910. Index: libaio-0.3.109/src/syscall-x86_64.h
  911. ===================================================================
  912. --- libaio-0.3.109.orig/src/syscall-x86_64.h 2014-06-11 10:40:07.929826651 +0200
  913. +++ libaio-0.3.109/src/syscall-x86_64.h 2014-06-11 10:40:07.925826651 +0200
  914. @@ -1,8 +1,18 @@
  915. +#ifndef __NR_io_setup
  916. #define __NR_io_setup 206
  917. +#endif
  918. +#ifndef __NR_io_destroy
  919. #define __NR_io_destroy 207
  920. +#endif
  921. +#ifndef __NR_io_getevents
  922. #define __NR_io_getevents 208
  923. +#endif
  924. +#ifndef __NR_io_submit
  925. #define __NR_io_submit 209
  926. +#endif
  927. +#ifndef __NR_io_cancel
  928. #define __NR_io_cancel 210
  929. +#endif
  930. #define __syscall_clobber "r11","rcx","memory"
  931. #define __syscall "syscall"
  932. @@ -42,10 +52,11 @@
  933. type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
  934. { \
  935. long __res; \
  936. -__asm__ volatile ("movq %5,%%r10 ;" __syscall \
  937. +register long __a4 asm ("r10") = (long) arg4; \
  938. +__asm__ volatile (__syscall \
  939. : "=a" (__res) \
  940. : "0" (__NR_##sname),"D" ((long)(arg1)),"S" ((long)(arg2)), \
  941. - "d" ((long)(arg3)),"g" ((long)(arg4)) : __syscall_clobber,"r10" ); \
  942. + "d" ((long)(arg3)),"r" (__a4)); \
  943. return __res; \
  944. }
  945. @@ -54,10 +65,11 @@
  946. type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
  947. { \
  948. long __res; \
  949. -__asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; " __syscall \
  950. +register long __a4 asm ("r10") = (long) arg4; \
  951. +register long __a5 asm ("r8") = (long) arg5; \
  952. +__asm__ volatile (__syscall \
  953. : "=a" (__res) \
  954. : "0" (__NR_##sname),"D" ((long)(arg1)),"S" ((long)(arg2)), \
  955. - "d" ((long)(arg3)),"g" ((long)(arg4)),"g" ((long)(arg5)) : \
  956. - __syscall_clobber,"r8","r10" ); \
  957. + "d" ((long)(arg3)),"r" (__a4),"r" (__a5)); \
  958. return __res; \
  959. }
  960. Index: libaio-0.3.109/src/syscall-arm64.h
  961. ===================================================================
  962. --- /dev/null 1970-01-01 00:00:00.000000000 +0000
  963. +++ libaio-0.3.109/src/syscall-arm64.h 2014-06-11 10:40:07.925826651 +0200
  964. @@ -0,0 +1,101 @@
  965. +/*
  966. + * linux/include/asm-arm/unistd.h
  967. + *
  968. + * Copyright (C) 2001-2005 Russell King
  969. + *
  970. + * This program is free software; you can redistribute it and/or modify
  971. + * it under the terms of the GNU General Public License version 2 as
  972. + * published by the Free Software Foundation.
  973. + *
  974. + * Please forward _all_ changes to this file to rmk@arm.linux.org.uk,
  975. + * no matter what the change is. Thanks!
  976. + */
  977. +
  978. +#define __NR_io_setup 0
  979. +#define __NR_io_destroy 1
  980. +#define __NR_io_submit 2
  981. +#define __NR_io_cancel 3
  982. +#define __NR_io_getevents 4
  983. +
  984. +#define __sys2(x) #x
  985. +#define __sys1(x) __sys2(x)
  986. +
  987. +#define __SYS_REG(name) register long __sysreg __asm__("w8") = __NR_##name;
  988. +#define __SYS_REG_LIST(regs...) "r" (__sysreg) , ##regs
  989. +#define __syscall(name) "svc\t#0"
  990. +
  991. +#define io_syscall1(type,fname,sname,type1,arg1) \
  992. +type fname(type1 arg1) { \
  993. + __SYS_REG(sname) \
  994. + register long __x0 __asm__("x0") = (long)arg1; \
  995. + register long __res_x0 __asm__("x0"); \
  996. + __asm__ __volatile__ ( \
  997. + __syscall(sname) \
  998. + : "=r" (__res_x0) \
  999. + : __SYS_REG_LIST( "0" (__x0) ) \
  1000. + : "memory" ); \
  1001. + return (type) __res_x0; \
  1002. +}
  1003. +
  1004. +#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \
  1005. +type fname(type1 arg1,type2 arg2) { \
  1006. + __SYS_REG(sname) \
  1007. + register long __x0 __asm__("x0") = (long)arg1; \
  1008. + register long __x1 __asm__("x1") = (long)arg2; \
  1009. + register long __res_x0 __asm__("x0"); \
  1010. + __asm__ __volatile__ ( \
  1011. + __syscall(sname) \
  1012. + : "=r" (__res_x0) \
  1013. + : __SYS_REG_LIST( "0" (__x0), "r" (__x1) ) \
  1014. + : "memory" ); \
  1015. + return (type) __res_x0; \
  1016. +}
  1017. +
  1018. +#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \
  1019. +type fname(type1 arg1,type2 arg2,type3 arg3) { \
  1020. + __SYS_REG(sname) \
  1021. + register long __x0 __asm__("x0") = (long)arg1; \
  1022. + register long __x1 __asm__("x1") = (long)arg2; \
  1023. + register long __x2 __asm__("x2") = (long)arg3; \
  1024. + register long __res_x0 __asm__("x0"); \
  1025. + __asm__ __volatile__ ( \
  1026. + __syscall(sname) \
  1027. + : "=r" (__res_x0) \
  1028. + : __SYS_REG_LIST( "0" (__x0), "r" (__x1), "r" (__x2) ) \
  1029. + : "memory" ); \
  1030. + return (type) __res_x0; \
  1031. +}
  1032. +
  1033. +#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4)\
  1034. +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \
  1035. + __SYS_REG(sname) \
  1036. + register long __x0 __asm__("x0") = (long)arg1; \
  1037. + register long __x1 __asm__("x1") = (long)arg2; \
  1038. + register long __x2 __asm__("x2") = (long)arg3; \
  1039. + register long __x3 __asm__("x3") = (long)arg4; \
  1040. + register long __res_x0 __asm__("x0"); \
  1041. + __asm__ __volatile__ ( \
  1042. + __syscall(sname) \
  1043. + : "=r" (__res_x0) \
  1044. + : __SYS_REG_LIST( "0" (__x0), "r" (__x1), "r" (__x2), "r" (__x3) ) \
  1045. + : "memory" ); \
  1046. + return (type) __res_x0; \
  1047. +}
  1048. +
  1049. +#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
  1050. +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) {\
  1051. + __SYS_REG(sname) \
  1052. + register long __x0 __asm__("x0") = (long)arg1; \
  1053. + register long __x1 __asm__("x1") = (long)arg2; \
  1054. + register long __x2 __asm__("x2") = (long)arg3; \
  1055. + register long __x3 __asm__("x3") = (long)arg4; \
  1056. + register long __x4 __asm__("x4") = (long)arg5; \
  1057. + register long __res_x0 __asm__("x0"); \
  1058. + __asm__ __volatile__ ( \
  1059. + __syscall(sname) \
  1060. + : "=r" (__res_x0) \
  1061. + : __SYS_REG_LIST( "0" (__x0), "r" (__x1), "r" (__x2), \
  1062. + "r" (__x3), "r" (__x4) ) \
  1063. + : "memory" ); \
  1064. + return (type) __res_x0; \
  1065. +}
  1066. Index: libaio-0.3.109/harness/cases/16.t
  1067. ===================================================================
  1068. --- libaio-0.3.109.orig/harness/cases/16.t 2014-06-11 10:40:07.929826651 +0200
  1069. +++ libaio-0.3.109/harness/cases/16.t 2014-06-11 10:40:07.925826651 +0200
  1070. @@ -18,6 +18,12 @@
  1071. #define SYS_eventfd 318
  1072. #elif defined(__alpha__)
  1073. #define SYS_eventfd 478
  1074. +#elif defined(__aarch64__)
  1075. +/* arm64 does not implement eventfd, only eventfd2 */
  1076. +#define USE_EVENTFD2
  1077. +#ifndef SYS_eventfd2
  1078. +#define SYS_eventfd2 19
  1079. +#endif /* __aarch64__ */
  1080. #else
  1081. #error define SYS_eventfd for your arch!
  1082. #endif
  1083. @@ -39,7 +45,11 @@
  1084. struct timespec notime = { .tv_sec = 0, .tv_nsec = 0 };
  1085. buf = malloc(SIZE); assert(buf);
  1086. +#ifndef USE_EVENTFD2
  1087. efd = syscall(SYS_eventfd, 0);
  1088. +#else
  1089. + efd = syscall(SYS_eventfd2, 0, 0);
  1090. +#endif
  1091. if (efd < 0) {
  1092. if (errno == ENOSYS) {
  1093. printf("No eventfd support. [SKIPPING]\n");