d94a87a2b1e5195c6823b323eba12597de0489e9
[openwrt/svn-archive/archive.git] / libs / libaio / patches / 002-avr32_support.patch
1 diff -Nur libaio-0.3.106/src/libaio.h libaio-0.3.106-avr32/src/libaio.h
2 --- libaio-0.3.106/src/libaio.h 2007-11-27 11:07:20.000000000 +0100
3 +++ libaio-0.3.106-avr32/src/libaio.h 2007-06-21 15:26:26.000000000 +0200
4 @@ -106,6 +106,10 @@
5 # else
6 # error "neither mipseb nor mipsel?"
7 # endif
8 +#elif defined(__avr32__) /* big endian, 32 bits */
9 +#define PADDED(x, y) unsigned y; x
10 +#define PADDEDptr(x, y) unsigned y; x
11 +#define PADDEDul(x, y) unsigned y; unsigned long x;
12 #else
13 #error endian?
14 #endif
15 diff -Nur libaio-0.3.106/src/syscall-avr32.h libaio-0.3.106-avr32/src/syscall-avr32.h
16 --- libaio-0.3.106/src/syscall-avr32.h 1970-01-01 01:00:00.000000000 +0100
17 +++ libaio-0.3.106-avr32/src/syscall-avr32.h 2007-06-21 15:26:26.000000000 +0200
18 @@ -0,0 +1,91 @@
19 +/*
20 + * Copyright (C) 2007 Atmel Corporation
21 + *
22 + * This program is free software; you can redistribute it and/or modify
23 + * it under the terms of the GNU General Public License version 2 as
24 + * published by the Free Software Foundation.
25 + */
26 +
27 +#define __NR_io_setup 197
28 +#define __NR_io_destroy 198
29 +#define __NR_io_getevents 199
30 +#define __NR_io_submit 200
31 +#define __NR_io_cancel 201
32 +
33 +#define io_syscall1(type,fname,sname,type1,arg1) \
34 +type fname(type1 arg1) \
35 +{ \
36 + register long __r12 __asm__("r12") = (long)arg1; \
37 + register long __res_r12 __asm__("r12"); \
38 + register long __scno __asm__("r8") = __NR_##sname; \
39 + __asm__ __volatile__("scall" \
40 + : "=r"(__res_r12) \
41 + : "0"(__r12), "r"(__scno) \
42 + : "memory"); \
43 + return (type) __res_r12; \
44 +}
45 +
46 +#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \
47 +type fname(type1 arg1, type2 arg2) \
48 +{ \
49 + register long __r12 __asm__("r12") = (long)arg1; \
50 + register long __r11 __asm__("r11") = (long)arg2; \
51 + register long __res_r12 __asm__("r12"); \
52 + register long __scno __asm__("r8") = __NR_##sname; \
53 + __asm__ __volatile__("scall" \
54 + : "=r"(__res_r12) \
55 + : "0"(__r12), "r"(__r11), "r"(__scno) \
56 + : "memory"); \
57 + return (type) __res_r12; \
58 +}
59 +
60 +#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \
61 +type fname(type1 arg1, type2 arg2, type3 arg3) \
62 +{ \
63 + register long __r12 __asm__("r12") = (long)arg1; \
64 + register long __r11 __asm__("r11") = (long)arg2; \
65 + register long __r10 __asm__("r10") = (long)arg3; \
66 + register long __res_r12 __asm__("r12"); \
67 + register long __scno __asm__("r8") = __NR_##sname; \
68 + __asm__ __volatile__("scall" \
69 + : "=r"(__res_r12) \
70 + : "0"(__r12), "r"(__r11), "r"(__r10), \
71 + "r"(__scno) \
72 + : "memory"); \
73 + return (type) __res_r12; \
74 +}
75 +
76 +#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
77 +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
78 +{ \
79 + register long __r12 __asm__("r12") = (long)arg1; \
80 + register long __r11 __asm__("r11") = (long)arg2; \
81 + register long __r10 __asm__("r10") = (long)arg3; \
82 + register long __r9 __asm__("r9") = (long)arg4; \
83 + register long __res_r12 __asm__("r12"); \
84 + register long __scno __asm__("r8") = __NR_##sname; \
85 + __asm__ __volatile__("scall" \
86 + : "=r"(__res_r12) \
87 + : "0"(__r12), "r"(__r11), "r"(__r10), \
88 + "r"(__r9), "r"(__scno) \
89 + : "memory"); \
90 + return (type) __res_r12; \
91 +}
92 +
93 +#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
94 +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
95 +{ \
96 + register long __r12 __asm__("r12") = (long)arg1; \
97 + register long __r11 __asm__("r11") = (long)arg2; \
98 + register long __r10 __asm__("r10") = (long)arg3; \
99 + register long __r9 __asm__("r9") = (long)arg4; \
100 + register long __r5 __asm__("r5") = (long)arg5; \
101 + register long __res_r12 __asm__("r12"); \
102 + register long __scno __asm__("r8") = __NR_##sname; \
103 + __asm__ __volatile__("scall" \
104 + : "=r"(__res_r12) \
105 + : "0"(__r12), "r"(__r11), "r"(__r10), \
106 + "r"(__r9), "r"(__r5), "r"(__scno) \
107 + : "memory"); \
108 + return (type) __res_r12; \
109 +}
110 diff -Nur libaio-0.3.106/src/syscall.h libaio-0.3.106-avr32/src/syscall.h
111 --- libaio-0.3.106/src/syscall.h 2007-11-27 11:07:20.000000000 +0100
112 +++ libaio-0.3.106-avr32/src/syscall.h 2007-06-21 15:26:26.000000000 +0200
113 @@ -32,6 +32,8 @@
114 #include "syscall-parisc.h"
115 #elif defined(__mips__)
116 #include "syscall-mips.h"
117 +#elif defined(__avr32__)
118 +#include "syscall-avr32.h"
119 #else
120 #error "add syscall-arch.h"
121 #endif