debuggers.hg

view tools/libaio/src/syscall-ppc.h @ 22848:6341fe0f4e5a

Added tag 4.1.0-rc2 for changeset 9dca60d88c63
author Keir Fraser <keir@xen.org>
date Tue Jan 25 14:06:55 2011 +0000 (2011-01-25)
parents a510c94ceaa3
children
line source
1 #include <asm/unistd.h>
2 #include <errno.h>
4 #define __NR_io_setup 227
5 #define __NR_io_destroy 228
6 #define __NR_io_getevents 229
7 #define __NR_io_submit 230
8 #define __NR_io_cancel 231
10 /* On powerpc a system call basically clobbers the same registers like a
11 * function call, with the exception of LR (which is needed for the
12 * "sc; bnslr" sequence) and CR (where only CR0.SO is clobbered to signal
13 * an error return status).
14 */
15 #ifndef __syscall_nr
16 #define __syscall_nr(nr, type, name, args...) \
17 unsigned long __sc_ret, __sc_err; \
18 { \
19 register unsigned long __sc_0 __asm__ ("r0"); \
20 register unsigned long __sc_3 __asm__ ("r3"); \
21 register unsigned long __sc_4 __asm__ ("r4"); \
22 register unsigned long __sc_5 __asm__ ("r5"); \
23 register unsigned long __sc_6 __asm__ ("r6"); \
24 register unsigned long __sc_7 __asm__ ("r7"); \
25 register unsigned long __sc_8 __asm__ ("r8"); \
26 \
27 __sc_loadargs_##nr(name, args); \
28 __asm__ __volatile__ \
29 ("sc \n\t" \
30 "mfcr %0 " \
31 : "=&r" (__sc_0), \
32 "=&r" (__sc_3), "=&r" (__sc_4), \
33 "=&r" (__sc_5), "=&r" (__sc_6), \
34 "=&r" (__sc_7), "=&r" (__sc_8) \
35 : __sc_asm_input_##nr \
36 : "cr0", "ctr", "memory", \
37 "r9", "r10","r11", "r12"); \
38 __sc_ret = __sc_3; \
39 __sc_err = __sc_0; \
40 } \
41 if (__sc_err & 0x10000000) return -((int)__sc_ret); \
42 return (type) __sc_ret
43 #endif
45 #define __sc_loadargs_0(name, dummy...) \
46 __sc_0 = __NR_##name
47 #define __sc_loadargs_1(name, arg1) \
48 __sc_loadargs_0(name); \
49 __sc_3 = (unsigned long) (arg1)
50 #define __sc_loadargs_2(name, arg1, arg2) \
51 __sc_loadargs_1(name, arg1); \
52 __sc_4 = (unsigned long) (arg2)
53 #define __sc_loadargs_3(name, arg1, arg2, arg3) \
54 __sc_loadargs_2(name, arg1, arg2); \
55 __sc_5 = (unsigned long) (arg3)
56 #define __sc_loadargs_4(name, arg1, arg2, arg3, arg4) \
57 __sc_loadargs_3(name, arg1, arg2, arg3); \
58 __sc_6 = (unsigned long) (arg4)
59 #define __sc_loadargs_5(name, arg1, arg2, arg3, arg4, arg5) \
60 __sc_loadargs_4(name, arg1, arg2, arg3, arg4); \
61 __sc_7 = (unsigned long) (arg5)
63 #define __sc_asm_input_0 "0" (__sc_0)
64 #define __sc_asm_input_1 __sc_asm_input_0, "1" (__sc_3)
65 #define __sc_asm_input_2 __sc_asm_input_1, "2" (__sc_4)
66 #define __sc_asm_input_3 __sc_asm_input_2, "3" (__sc_5)
67 #define __sc_asm_input_4 __sc_asm_input_3, "4" (__sc_6)
68 #define __sc_asm_input_5 __sc_asm_input_4, "5" (__sc_7)
70 #define io_syscall1(type,fname,sname,type1,arg1) \
71 type fname(type1 arg1) \
72 { \
73 __syscall_nr(1, type, sname, arg1); \
74 }
76 #define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \
77 type fname(type1 arg1, type2 arg2) \
78 { \
79 __syscall_nr(2, type, sname, arg1, arg2); \
80 }
82 #define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \
83 type fname(type1 arg1, type2 arg2, type3 arg3) \
84 { \
85 __syscall_nr(3, type, sname, arg1, arg2, arg3); \
86 }
88 #define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
89 type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
90 { \
91 __syscall_nr(4, type, sname, arg1, arg2, arg3, arg4); \
92 }
94 #define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
95 type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
96 { \
97 __syscall_nr(5, type, sname, arg1, arg2, arg3, arg4, arg5); \
98 }