|
David Woodhouse |
fb30f3 |
--- qemu-0.8.1/linux-user/syscall.c~ 2006-05-03 21:32:58.000000000 +0100
|
|
David Woodhouse |
fb30f3 |
+++ qemu-0.8.1/linux-user/syscall.c 2006-06-07 22:11:48.000000000 +0100
|
|
David Woodhouse |
fb30f3 |
@@ -79,127 +79,59 @@
|
|
David Woodhouse |
fb30f3 |
#define VFAT_IOCTL_READDIR_SHORT _IOR('r', 2, struct dirent [2])
|
|
David Woodhouse |
fb30f3 |
|
|
David Woodhouse |
fb30f3 |
|
|
David Woodhouse |
fb30f3 |
-#if defined(__powerpc__)
|
|
David Woodhouse |
fb30f3 |
-#undef __syscall_nr
|
|
David Woodhouse |
fb30f3 |
-#undef __sc_loadargs_0
|
|
David Woodhouse |
fb30f3 |
-#undef __sc_loadargs_1
|
|
David Woodhouse |
fb30f3 |
-#undef __sc_loadargs_2
|
|
David Woodhouse |
fb30f3 |
-#undef __sc_loadargs_3
|
|
David Woodhouse |
fb30f3 |
-#undef __sc_loadargs_4
|
|
David Woodhouse |
fb30f3 |
-#undef __sc_loadargs_5
|
|
David Woodhouse |
fb30f3 |
-#undef __sc_asm_input_0
|
|
David Woodhouse |
fb30f3 |
-#undef __sc_asm_input_1
|
|
David Woodhouse |
fb30f3 |
-#undef __sc_asm_input_2
|
|
David Woodhouse |
fb30f3 |
-#undef __sc_asm_input_3
|
|
David Woodhouse |
fb30f3 |
-#undef __sc_asm_input_4
|
|
David Woodhouse |
fb30f3 |
-#undef __sc_asm_input_5
|
|
David Woodhouse |
fb30f3 |
#undef _syscall0
|
|
David Woodhouse |
fb30f3 |
#undef _syscall1
|
|
David Woodhouse |
fb30f3 |
#undef _syscall2
|
|
David Woodhouse |
fb30f3 |
#undef _syscall3
|
|
David Woodhouse |
fb30f3 |
#undef _syscall4
|
|
David Woodhouse |
fb30f3 |
#undef _syscall5
|
|
David Woodhouse |
fb30f3 |
+#undef _syscall6
|
|
David Woodhouse |
fb30f3 |
|
|
David Woodhouse |
fb30f3 |
-/* need to redefine syscalls as Linux kernel defines are incorrect for
|
|
David Woodhouse |
fb30f3 |
- the clobber list */
|
|
David Woodhouse |
fb30f3 |
-/* On powerpc a system call basically clobbers the same registers like a
|
|
David Woodhouse |
fb30f3 |
- * function call, with the exception of LR (which is needed for the
|
|
David Woodhouse |
fb30f3 |
- * "sc; bnslr" sequence) and CR (where only CR0.SO is clobbered to signal
|
|
David Woodhouse |
fb30f3 |
- * an error return status).
|
|
David Woodhouse |
fb30f3 |
- */
|
|
David Woodhouse |
fb30f3 |
-
|
|
David Woodhouse |
fb30f3 |
-#define __syscall_nr(nr, type, name, args...) \
|
|
David Woodhouse |
fb30f3 |
- unsigned long __sc_ret, __sc_err; \
|
|
David Woodhouse |
fb30f3 |
- { \
|
|
David Woodhouse |
fb30f3 |
- register unsigned long __sc_0 __asm__ ("r0"); \
|
|
David Woodhouse |
fb30f3 |
- register unsigned long __sc_3 __asm__ ("r3"); \
|
|
David Woodhouse |
fb30f3 |
- register unsigned long __sc_4 __asm__ ("r4"); \
|
|
David Woodhouse |
fb30f3 |
- register unsigned long __sc_5 __asm__ ("r5"); \
|
|
David Woodhouse |
fb30f3 |
- register unsigned long __sc_6 __asm__ ("r6"); \
|
|
David Woodhouse |
fb30f3 |
- register unsigned long __sc_7 __asm__ ("r7"); \
|
|
David Woodhouse |
fb30f3 |
- \
|
|
David Woodhouse |
fb30f3 |
- __sc_loadargs_##nr(name, args); \
|
|
David Woodhouse |
fb30f3 |
- __asm__ __volatile__ \
|
|
David Woodhouse |
fb30f3 |
- ("sc \n\t" \
|
|
David Woodhouse |
fb30f3 |
- "mfcr %0 " \
|
|
David Woodhouse |
fb30f3 |
- : "=&r" (__sc_0), \
|
|
David Woodhouse |
fb30f3 |
- "=&r" (__sc_3), "=&r" (__sc_4), \
|
|
David Woodhouse |
fb30f3 |
- "=&r" (__sc_5), "=&r" (__sc_6), \
|
|
David Woodhouse |
fb30f3 |
- "=&r" (__sc_7) \
|
|
David Woodhouse |
fb30f3 |
- : __sc_asm_input_##nr \
|
|
David Woodhouse |
fb30f3 |
- : "cr0", "ctr", "memory", \
|
|
David Woodhouse |
fb30f3 |
- "r8", "r9", "r10","r11", "r12"); \
|
|
David Woodhouse |
fb30f3 |
- __sc_ret = __sc_3; \
|
|
David Woodhouse |
fb30f3 |
- __sc_err = __sc_0; \
|
|
David Woodhouse |
fb30f3 |
- } \
|
|
David Woodhouse |
fb30f3 |
- if (__sc_err & 0x10000000) \
|
|
David Woodhouse |
fb30f3 |
- { \
|
|
David Woodhouse |
fb30f3 |
- errno = __sc_ret; \
|
|
David Woodhouse |
fb30f3 |
- __sc_ret = -1; \
|
|
David Woodhouse |
fb30f3 |
- } \
|
|
David Woodhouse |
fb30f3 |
- return (type) __sc_ret
|
|
David Woodhouse |
fb30f3 |
-
|
|
David Woodhouse |
fb30f3 |
-#define __sc_loadargs_0(name, dummy...) \
|
|
David Woodhouse |
fb30f3 |
- __sc_0 = __NR_##name
|
|
David Woodhouse |
fb30f3 |
-#define __sc_loadargs_1(name, arg1) \
|
|
David Woodhouse |
fb30f3 |
- __sc_loadargs_0(name); \
|
|
David Woodhouse |
fb30f3 |
- __sc_3 = (unsigned long) (arg1)
|
|
David Woodhouse |
fb30f3 |
-#define __sc_loadargs_2(name, arg1, arg2) \
|
|
David Woodhouse |
fb30f3 |
- __sc_loadargs_1(name, arg1); \
|
|
David Woodhouse |
fb30f3 |
- __sc_4 = (unsigned long) (arg2)
|
|
David Woodhouse |
fb30f3 |
-#define __sc_loadargs_3(name, arg1, arg2, arg3) \
|
|
David Woodhouse |
fb30f3 |
- __sc_loadargs_2(name, arg1, arg2); \
|
|
David Woodhouse |
fb30f3 |
- __sc_5 = (unsigned long) (arg3)
|
|
David Woodhouse |
fb30f3 |
-#define __sc_loadargs_4(name, arg1, arg2, arg3, arg4) \
|
|
David Woodhouse |
fb30f3 |
- __sc_loadargs_3(name, arg1, arg2, arg3); \
|
|
David Woodhouse |
fb30f3 |
- __sc_6 = (unsigned long) (arg4)
|
|
David Woodhouse |
fb30f3 |
-#define __sc_loadargs_5(name, arg1, arg2, arg3, arg4, arg5) \
|
|
David Woodhouse |
fb30f3 |
- __sc_loadargs_4(name, arg1, arg2, arg3, arg4); \
|
|
David Woodhouse |
fb30f3 |
- __sc_7 = (unsigned long) (arg5)
|
|
David Woodhouse |
fb30f3 |
-
|
|
David Woodhouse |
fb30f3 |
-#define __sc_asm_input_0 "0" (__sc_0)
|
|
David Woodhouse |
fb30f3 |
-#define __sc_asm_input_1 __sc_asm_input_0, "1" (__sc_3)
|
|
David Woodhouse |
fb30f3 |
-#define __sc_asm_input_2 __sc_asm_input_1, "2" (__sc_4)
|
|
David Woodhouse |
fb30f3 |
-#define __sc_asm_input_3 __sc_asm_input_2, "3" (__sc_5)
|
|
David Woodhouse |
fb30f3 |
-#define __sc_asm_input_4 __sc_asm_input_3, "4" (__sc_6)
|
|
David Woodhouse |
fb30f3 |
-#define __sc_asm_input_5 __sc_asm_input_4, "5" (__sc_7)
|
|
David Woodhouse |
fb30f3 |
-
|
|
David Woodhouse |
fb30f3 |
-#define _syscall0(type,name) \
|
|
David Woodhouse |
fb30f3 |
-type name(void) \
|
|
David Woodhouse |
fb30f3 |
-{ \
|
|
David Woodhouse |
fb30f3 |
- __syscall_nr(0, type, name); \
|
|
David Woodhouse |
fb30f3 |
-}
|
|
David Woodhouse |
fb30f3 |
-
|
|
David Woodhouse |
fb30f3 |
-#define _syscall1(type,name,type1,arg1) \
|
|
David Woodhouse |
fb30f3 |
-type name(type1 arg1) \
|
|
David Woodhouse |
fb30f3 |
-{ \
|
|
David Woodhouse |
fb30f3 |
- __syscall_nr(1, type, name, arg1); \
|
|
David Woodhouse |
fb30f3 |
-}
|
|
David Woodhouse |
fb30f3 |
-
|
|
David Woodhouse |
fb30f3 |
-#define _syscall2(type,name,type1,arg1,type2,arg2) \
|
|
David Woodhouse |
fb30f3 |
-type name(type1 arg1, type2 arg2) \
|
|
David Woodhouse |
fb30f3 |
-{ \
|
|
David Woodhouse |
fb30f3 |
- __syscall_nr(2, type, name, arg1, arg2); \
|
|
David Woodhouse |
fb30f3 |
-}
|
|
David Woodhouse |
fb30f3 |
-
|
|
David Woodhouse |
fb30f3 |
-#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
|
|
David Woodhouse |
fb30f3 |
-type name(type1 arg1, type2 arg2, type3 arg3) \
|
|
David Woodhouse |
fb30f3 |
-{ \
|
|
David Woodhouse |
fb30f3 |
- __syscall_nr(3, type, name, arg1, arg2, arg3); \
|
|
David Woodhouse |
fb30f3 |
-}
|
|
David Woodhouse |
fb30f3 |
-
|
|
David Woodhouse |
fb30f3 |
-#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
|
|
David Woodhouse |
fb30f3 |
-type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
|
|
David Woodhouse |
fb30f3 |
-{ \
|
|
David Woodhouse |
fb30f3 |
- __syscall_nr(4, type, name, arg1, arg2, arg3, arg4); \
|
|
David Woodhouse |
fb30f3 |
-}
|
|
David Woodhouse |
fb30f3 |
-
|
|
David Woodhouse |
fb30f3 |
-#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
|
|
David Woodhouse |
fb30f3 |
-type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
|
|
David Woodhouse |
fb30f3 |
-{ \
|
|
David Woodhouse |
fb30f3 |
- __syscall_nr(5, type, name, arg1, arg2, arg3, arg4, arg5); \
|
|
David Woodhouse |
fb30f3 |
+#define _syscall0(type,name) \
|
|
David Woodhouse |
fb30f3 |
+type name (void) \
|
|
David Woodhouse |
fb30f3 |
+{ \
|
|
David Woodhouse |
fb30f3 |
+ return syscall(__NR_##name); \
|
|
David Woodhouse |
fb30f3 |
}
|
|
David Woodhouse |
fb30f3 |
-#endif
|
|
David Woodhouse |
fb30f3 |
+
|
|
David Woodhouse |
fb30f3 |
+#define _syscall1(type,name,type1,arg1) \
|
|
David Woodhouse |
fb30f3 |
+type name (type1 arg1) \
|
|
David Woodhouse |
fb30f3 |
+{ \
|
|
David Woodhouse |
fb30f3 |
+ return syscall(__NR_##name, arg1); \
|
|
David Woodhouse |
fb30f3 |
+}
|
|
David Woodhouse |
fb30f3 |
+
|
|
David Woodhouse |
fb30f3 |
+#define _syscall2(type,name,type1,arg1,type2,arg2) \
|
|
David Woodhouse |
fb30f3 |
+type name (type1 arg1,type2 arg2) \
|
|
David Woodhouse |
fb30f3 |
+{ \
|
|
David Woodhouse |
fb30f3 |
+ return syscall(__NR_##name, arg1, arg2); \
|
|
David Woodhouse |
fb30f3 |
+}
|
|
David Woodhouse |
fb30f3 |
+
|
|
David Woodhouse |
fb30f3 |
+#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
|
|
David Woodhouse |
fb30f3 |
+type name (type1 arg1,type2 arg2,type3 arg3) \
|
|
David Woodhouse |
fb30f3 |
+{ \
|
|
David Woodhouse |
fb30f3 |
+ return syscall(__NR_##name, arg1, arg2, arg3); \
|
|
David Woodhouse |
fb30f3 |
+}
|
|
David Woodhouse |
fb30f3 |
+
|
|
David Woodhouse |
fb30f3 |
+#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
|
|
David Woodhouse |
fb30f3 |
+type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4) \
|
|
David Woodhouse |
fb30f3 |
+{ \
|
|
David Woodhouse |
fb30f3 |
+ return syscall(__NR_##name, arg1, arg2, arg3, arg4); \
|
|
David Woodhouse |
fb30f3 |
+}
|
|
David Woodhouse |
fb30f3 |
+
|
|
David Woodhouse |
fb30f3 |
+#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
|
|
David Woodhouse |
fb30f3 |
+ type5,arg5) \
|
|
David Woodhouse |
fb30f3 |
+type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
|
|
David Woodhouse |
fb30f3 |
+{ \
|
|
David Woodhouse |
fb30f3 |
+ return syscall(__NR_##name, arg1, arg2, arg3, arg4, arg5); \
|
|
David Woodhouse |
fb30f3 |
+}
|
|
David Woodhouse |
fb30f3 |
+
|
|
David Woodhouse |
fb30f3 |
+
|
|
David Woodhouse |
fb30f3 |
+#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
|
|
David Woodhouse |
fb30f3 |
+ type5,arg5,type6,arg6) \
|
|
David Woodhouse |
fb30f3 |
+type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
|
|
David Woodhouse |
fb30f3 |
+{ \
|
|
David Woodhouse |
fb30f3 |
+ return syscall(__NR_##name, arg1, arg2, arg3, arg4, arg5, arg6); \
|
|
David Woodhouse |
fb30f3 |
+}
|
|
David Woodhouse |
fb30f3 |
+
|
|
David Woodhouse |
fb30f3 |
|
|
David Woodhouse |
fb30f3 |
#define __NR_sys_uname __NR_uname
|
|
David Woodhouse |
fb30f3 |
#define __NR_sys_getcwd1 __NR_getcwd
|