Skip to contentSkip to conversation

PATCH: darwin-user syscalls

Qemu-devel Ilya Shar 1 participant 1 message Mar 2, 2007

lore
Share & tools
lore

Ilya Shar

author
#0 lore raw

Handling extra signals in syscall.c/syscalls.h. Patch is attached.

Thanks,
Ilya

____________________________________________________________________________________
Don't get soaked. Take a quick peak at the forecast with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather

darwin-user/syscall.c +29 -2
diff -ur orig_files/darwin-user/syscall.c modified_files/darwin-user/syscall.c
@@ -53,6 +53,8 @@
 #include <mach/ndr.h>
 #include <mach/mig_errors.h>
 
+#include <sys/xattr.h>
+
 #include "qemu.h"
 
 //#define DEBUG_SYSCALL
@@ -451,21 +453,46 @@
     case -31:
         DPRINTF("mach_msg_trap(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n",
                 arg1, arg2, arg3, arg4, arg5, arg6, arg7);
-
         ret = target_mach_msg_trap((mach_msg_header_t *)arg1, arg2, arg3, arg4, arg5, arg6, arg7);
-
         break;
+#if (defined(TARGET_I386) && defined(__i386__)) || (defined(TARGET_PPC) && defined(__ppc__))
+    case -33:
+        DPRINTF("semaphore_signal_trap(0x%x)\n", arg1);
+        ret = semaphore_signal_trap(arg1);
+        break;
+    case -34:
+        DPRINTF("semaphore_signal_all_trap(0x%x)\n", arg1);
+        ret = semaphore_signal_all_trap(arg1);
+        break;
+    case -35: 
+        DPRINTF("semaphore_signal_thread_trap(0x%x)\n", arg1, arg2); 
+        ret = semaphore_signal_thread_trap(arg1,arg2); 
+        break; 
+#endif // may need to swap bytes if target arch is different from host 
     case -36:
         DPRINTF("semaphore_wait_trap(0x%x)\n", arg1);
         extern int semaphore_wait_trap(int); // XXX: is there any header for that?
         ret = semaphore_wait_trap(arg1);
         break;
+#if (defined(TARGET_I386) && defined(__i386__)) || (defined(TARGET_PPC) && defined(__ppc__))
+    case -37:
+        DPRINTF("semaphore_wait_signal_trap(0x%x, 0x%x)\n", arg1, arg2);
+        ret = semaphore_wait_signal_trap(arg1,arg2); 
+        break;
+#endif // may need to swap bytes if target arch is different from host 
     case -43:
         DPRINTF("map_fd(0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n",
                 arg1, arg2, arg3, arg4, arg5);
         ret = map_fd(arg1, arg2, (void*)arg3, arg4, arg5);
         tswap32s((uint32_t*)arg3);
         break;
+#if (defined(TARGET_I386) && defined(__i386__)) || (defined(TARGET_PPC) && defined(__ppc__))
+    case -61:
+        DPRINTF("syscall_thread_switch(0x%x, 0x%x, 0x%x)\n",
+                arg1, arg2, arg3);
+        ret = syscall_thread_switch(arg1, arg2, arg3);  // just a hint to the scheduler; can drop? 
+        break; 
+#endif // may need to swap bytes if target arch is different from host 
     case -89:
         DPRINTF("mach_timebase_info(0x%x)\n", arg1);
         struct mach_timebase_info info;
darwin-user/syscalls.h +2 -2
diff -ur orig_files/darwin-user/syscalls.h modified_files/darwin-user/syscalls.h
@@ -42,7 +42,7 @@
  ENTRY("getppid",                  SYS_getppid,                        getppid,                           0, CALL_DIRECT, VOID)   /* 39  */
  ENTRY("",                         40,                                 no_syscall,                        0, CALL_INDIRECT, VOID) /* 40  old lstat */
  ENTRY("dup",                      SYS_dup,                            dup,                               1, CALL_DIRECT, INT)   /* 41  */
- ENTRY("pipe",                     SYS_pipe,                           unimpl_unix_syscall,               0, CALL_INDIRECT, PTR)   /* 42  */
+ ENTRY("pipe",                     SYS_pipe,                           pipe,               0, CALL_INDIRECT, PTR)   /* 42  */
  ENTRY("getegid",                  SYS_getegid,                        getegid,                           0, CALL_NOERRNO, VOID)  /* 43  */
  ENTRY("profil",                   SYS_profil,                         profil,                            4, CALL_DIRECT, PTR, SIZE, INT, INT)   /* 44  */
  ENTRY("ktrace",                   SYS_ktrace,                         no_syscall,                        4, CALL_INDIRECT, VOID) /* 45  */
@@ -247,7 +247,7 @@
  ENTRY("fsetxattr",                SYS_fsetxattr,                      no_syscall,                        6, CALL_INDIRECT, VOID)   /* 237  */
  ENTRY("removexattr",              SYS_removexattr,                    no_syscall,                        3, CALL_INDIRECT, VOID)   /* 238  */
  ENTRY("fremovexattr",             SYS_fremovexattr,                   no_syscall,                        3, CALL_INDIRECT, VOID)   /* 239  */
- ENTRY("listxattr",                SYS_listxattr,                      no_syscall,                        4, CALL_INDIRECT, VOID)   /* 240  */
+ ENTRY("listxattr",                SYS_listxattr,                      listxattr,                         4, CALL_INDIRECT, VOID)   /* 240  */
  ENTRY("flistxattr",               SYS_flistxattr,                     no_syscall,                        4, CALL_INDIRECT, VOID)   /* 241  */
  ENTRY("fsctl",                    SYS_fsctl,                          fsctl,                             4, CALL_DIRECT, PTR, UINT, PTR, UINT)   /* 242  */
  ENTRY("initgroups",               SYS_initgroups,                     unimpl_unix_syscall,               3, CALL_INDIRECT, UINT, PTR, INT)   /* 243  */