--- build-palmld-opie/tmp/work/armv5te-linux/qemu-native-0.7.0-r0/qemu-0.7.0/linux-user/syscall_old.c	2006-11-14 19:34:26.000000000 -0800
+++ build-palmld-opie/tmp/work/armv5te-linux/qemu-native-0.7.0-r0/qemu-0.7.0/linux-user/syscall.c	2006-11-14 20:49:40.000000000 -0800
@@ -98,6 +98,7 @@
 #undef _syscall3
 #undef _syscall4
 #undef _syscall5
+#endif
 
 /* need to redefine syscalls as Linux kernel defines are incorrect for
    the clobber list */
@@ -163,73 +164,61 @@
 #define __sc_asm_input_4 __sc_asm_input_3, "4" (__sc_6)
 #define __sc_asm_input_5 __sc_asm_input_4, "5" (__sc_7)
 
-#define _syscall0(type,name)						\
-type name(void)								\
-{									\
-	__syscall_nr(0, type, name);					\
+#ifdef __NR_gettid
+static int gettid (void)
+{
+  return syscall(__NR_gettid);
+}
+#else
+static int gettid(void) {
+    return -ENOSYS;
 }
+#endif
 
-#define _syscall1(type,name,type1,arg1)					\
-type name(type1 arg1)							\
-{									\
-	__syscall_nr(1, type, name, arg1);				\
+static int sys_uname (struct new_utsname *buf)
+{
+  return syscall(__NR_uname, buf);
 }
 
-#define _syscall2(type,name,type1,arg1,type2,arg2)			\
-type name(type1 arg1, type2 arg2)					\
-{									\
-	__syscall_nr(2, type, name, arg1, arg2);			\
+static int sys_getcwd1 (char *buf, size_t size)
+{
+  return syscall(__NR_getcwd, buf, size);
 }
 
-#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3)		\
-type name(type1 arg1, type2 arg2, type3 arg3)				\
-{									\
-	__syscall_nr(3, type, name, arg1, arg2, arg3);			\
+static int sys_getdents (uint fd, struct dirent *dirp, uint count)
+{
+  return syscall(__NR_getdents, fd, dirp, count);
 }
 
-#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
-type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4)		\
-{									\
-	__syscall_nr(4, type, name, arg1, arg2, arg3, arg4);		\
+static int sys_getdents64 (uint fd, struct dirent64 *dirp, uint count)
+{
+  return syscall(__NR_getdents64, fd, dirp, count);
 }
 
-#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
-type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5)	\
-{									\
-	__syscall_nr(5, type, name, arg1, arg2, arg3, arg4, arg5);	\
+static int _llseek(uint fd, ulong hi, ulong lo, loff_t * res, uint wh)
+{
+  return syscall(__NR_lseek, fd, hi, lo, res, wh);
 }
-#endif
 
-#define __NR_sys_uname __NR_uname
-#define __NR_sys_getcwd1 __NR_getcwd
-#define __NR_sys_statfs __NR_statfs
-#define __NR_sys_fstatfs __NR_fstatfs
-#define __NR_sys_getdents __NR_getdents
-#define __NR_sys_getdents64 __NR_getdents64
-#define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo
+static int sys_statfs (const char *path, struct kernel_statfs *buf)
+{
+  return syscall(__NR_statfs, path, buf);
+}
 
-#if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__)
-#define __NR__llseek __NR_lseek
-#endif
+static int sys_fstatfs (int fd, struct kernel_statfs *buf)
+{
+  return syscall(__NR_fstatfs, fd, buf);
+}
 
-#ifdef __NR_gettid
-_syscall0(int, gettid)
-#else
-static int gettid(void) {
-    return -ENOSYS;
+static int sys_rt_sigqueueinfo (int pid, int sig, siginfo_t *uinfo)
+{
+  return syscall(__NR_rt_sigqueueinfo, pid, sig, uinfo);
 }
-#endif
-_syscall1(int,sys_uname,struct new_utsname *,buf)
-_syscall2(int,sys_getcwd1,char *,buf,size_t,size)
-_syscall3(int, sys_getdents, uint, fd, struct dirent *, dirp, uint, count);
-_syscall3(int, sys_getdents64, uint, fd, struct dirent64 *, dirp, uint, count);
-_syscall5(int, _llseek,  uint,  fd, ulong, hi, ulong, lo,
-          loff_t *, res, uint, wh);
-_syscall2(int,sys_statfs,const char *,path,struct kernel_statfs *,buf)
-_syscall2(int,sys_fstatfs,int,fd,struct kernel_statfs *,buf)
-_syscall3(int,sys_rt_sigqueueinfo,int,pid,int,sig,siginfo_t *,uinfo)
 #ifdef __NR_exit_group
-_syscall1(int,exit_group,int,error_code)
+static int exit_group (int error_code)
+{
+  return syscall(__NR_exit_group, error_code);
+}
 #endif
 
 extern int personality(int);
