Commit ee999a8899ba8c6326cda4e2e70bb52b284cf7bb
1 parent
b5906f95
Handling more darwin-user syscalls, by Ilya Shar.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2502 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
34 additions
and
4 deletions
darwin-user/syscall.c
@@ -53,6 +53,8 @@ | @@ -53,6 +53,8 @@ | ||
53 | #include <mach/ndr.h> | 53 | #include <mach/ndr.h> |
54 | #include <mach/mig_errors.h> | 54 | #include <mach/mig_errors.h> |
55 | 55 | ||
56 | +#include <sys/xattr.h> | ||
57 | + | ||
56 | #include "qemu.h" | 58 | #include "qemu.h" |
57 | 59 | ||
58 | //#define DEBUG_SYSCALL | 60 | //#define DEBUG_SYSCALL |
@@ -451,21 +453,49 @@ long do_mach_syscall(void *cpu_env, int num, uint32_t arg1, uint32_t arg2, uint3 | @@ -451,21 +453,49 @@ long do_mach_syscall(void *cpu_env, int num, uint32_t arg1, uint32_t arg2, uint3 | ||
451 | case -31: | 453 | case -31: |
452 | DPRINTF("mach_msg_trap(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n", | 454 | DPRINTF("mach_msg_trap(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n", |
453 | arg1, arg2, arg3, arg4, arg5, arg6, arg7); | 455 | arg1, arg2, arg3, arg4, arg5, arg6, arg7); |
454 | - | ||
455 | ret = target_mach_msg_trap((mach_msg_header_t *)arg1, arg2, arg3, arg4, arg5, arg6, arg7); | 456 | ret = target_mach_msg_trap((mach_msg_header_t *)arg1, arg2, arg3, arg4, arg5, arg6, arg7); |
456 | - | ||
457 | break; | 457 | break; |
458 | +/* may need more translation if target arch is different from host */ | ||
459 | +#if (defined(TARGET_I386) && defined(__i386__)) || (defined(TARGET_PPC) && defined(__ppc__)) | ||
460 | + case -33: | ||
461 | + DPRINTF("semaphore_signal_trap(0x%x)\n", arg1); | ||
462 | + ret = semaphore_signal_trap(arg1); | ||
463 | + break; | ||
464 | + case -34: | ||
465 | + DPRINTF("semaphore_signal_all_trap(0x%x)\n", arg1); | ||
466 | + ret = semaphore_signal_all_trap(arg1); | ||
467 | + break; | ||
468 | + case -35: | ||
469 | + DPRINTF("semaphore_signal_thread_trap(0x%x)\n", arg1, arg2); | ||
470 | + ret = semaphore_signal_thread_trap(arg1,arg2); | ||
471 | + break; | ||
472 | +#endif | ||
458 | case -36: | 473 | case -36: |
459 | DPRINTF("semaphore_wait_trap(0x%x)\n", arg1); | 474 | DPRINTF("semaphore_wait_trap(0x%x)\n", arg1); |
460 | extern int semaphore_wait_trap(int); // XXX: is there any header for that? | 475 | extern int semaphore_wait_trap(int); // XXX: is there any header for that? |
461 | ret = semaphore_wait_trap(arg1); | 476 | ret = semaphore_wait_trap(arg1); |
462 | break; | 477 | break; |
478 | +/* may need more translation if target arch is different from host */ | ||
479 | +#if (defined(TARGET_I386) && defined(__i386__)) || (defined(TARGET_PPC) && defined(__ppc__)) | ||
480 | + case -37: | ||
481 | + DPRINTF("semaphore_wait_signal_trap(0x%x, 0x%x)\n", arg1, arg2); | ||
482 | + ret = semaphore_wait_signal_trap(arg1,arg2); | ||
483 | + break; | ||
484 | +#endif | ||
463 | case -43: | 485 | case -43: |
464 | DPRINTF("map_fd(0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n", | 486 | DPRINTF("map_fd(0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n", |
465 | arg1, arg2, arg3, arg4, arg5); | 487 | arg1, arg2, arg3, arg4, arg5); |
466 | ret = map_fd(arg1, arg2, (void*)arg3, arg4, arg5); | 488 | ret = map_fd(arg1, arg2, (void*)arg3, arg4, arg5); |
467 | tswap32s((uint32_t*)arg3); | 489 | tswap32s((uint32_t*)arg3); |
468 | break; | 490 | break; |
491 | +/* may need more translation if target arch is different from host */ | ||
492 | +#if (defined(TARGET_I386) && defined(__i386__)) || (defined(TARGET_PPC) && defined(__ppc__)) | ||
493 | + case -61: | ||
494 | + DPRINTF("syscall_thread_switch(0x%x, 0x%x, 0x%x)\n", | ||
495 | + arg1, arg2, arg3); | ||
496 | + ret = syscall_thread_switch(arg1, arg2, arg3); // just a hint to the scheduler; can drop? | ||
497 | + break; | ||
498 | +#endif | ||
469 | case -89: | 499 | case -89: |
470 | DPRINTF("mach_timebase_info(0x%x)\n", arg1); | 500 | DPRINTF("mach_timebase_info(0x%x)\n", arg1); |
471 | struct mach_timebase_info info; | 501 | struct mach_timebase_info info; |
darwin-user/syscalls.h
@@ -42,7 +42,7 @@ | @@ -42,7 +42,7 @@ | ||
42 | ENTRY("getppid", SYS_getppid, getppid, 0, CALL_DIRECT, VOID) /* 39 */ | 42 | ENTRY("getppid", SYS_getppid, getppid, 0, CALL_DIRECT, VOID) /* 39 */ |
43 | ENTRY("", 40, no_syscall, 0, CALL_INDIRECT, VOID) /* 40 old lstat */ | 43 | ENTRY("", 40, no_syscall, 0, CALL_INDIRECT, VOID) /* 40 old lstat */ |
44 | ENTRY("dup", SYS_dup, dup, 1, CALL_DIRECT, INT) /* 41 */ | 44 | ENTRY("dup", SYS_dup, dup, 1, CALL_DIRECT, INT) /* 41 */ |
45 | - ENTRY("pipe", SYS_pipe, unimpl_unix_syscall, 0, CALL_INDIRECT, PTR) /* 42 */ | 45 | + ENTRY("pipe", SYS_pipe, pipe, 0, CALL_INDIRECT, PTR) /* 42 */ |
46 | ENTRY("getegid", SYS_getegid, getegid, 0, CALL_NOERRNO, VOID) /* 43 */ | 46 | ENTRY("getegid", SYS_getegid, getegid, 0, CALL_NOERRNO, VOID) /* 43 */ |
47 | ENTRY("profil", SYS_profil, profil, 4, CALL_DIRECT, PTR, SIZE, INT, INT) /* 44 */ | 47 | ENTRY("profil", SYS_profil, profil, 4, CALL_DIRECT, PTR, SIZE, INT, INT) /* 44 */ |
48 | ENTRY("ktrace", SYS_ktrace, no_syscall, 4, CALL_INDIRECT, VOID) /* 45 */ | 48 | ENTRY("ktrace", SYS_ktrace, no_syscall, 4, CALL_INDIRECT, VOID) /* 45 */ |
@@ -247,7 +247,7 @@ | @@ -247,7 +247,7 @@ | ||
247 | ENTRY("fsetxattr", SYS_fsetxattr, no_syscall, 6, CALL_INDIRECT, VOID) /* 237 */ | 247 | ENTRY("fsetxattr", SYS_fsetxattr, no_syscall, 6, CALL_INDIRECT, VOID) /* 237 */ |
248 | ENTRY("removexattr", SYS_removexattr, no_syscall, 3, CALL_INDIRECT, VOID) /* 238 */ | 248 | ENTRY("removexattr", SYS_removexattr, no_syscall, 3, CALL_INDIRECT, VOID) /* 238 */ |
249 | ENTRY("fremovexattr", SYS_fremovexattr, no_syscall, 3, CALL_INDIRECT, VOID) /* 239 */ | 249 | ENTRY("fremovexattr", SYS_fremovexattr, no_syscall, 3, CALL_INDIRECT, VOID) /* 239 */ |
250 | - ENTRY("listxattr", SYS_listxattr, no_syscall, 4, CALL_INDIRECT, VOID) /* 240 */ | 250 | + ENTRY("listxattr", SYS_listxattr, listxattr, 4, CALL_INDIRECT, VOID) /* 240 */ |
251 | ENTRY("flistxattr", SYS_flistxattr, no_syscall, 4, CALL_INDIRECT, VOID) /* 241 */ | 251 | ENTRY("flistxattr", SYS_flistxattr, no_syscall, 4, CALL_INDIRECT, VOID) /* 241 */ |
252 | ENTRY("fsctl", SYS_fsctl, fsctl, 4, CALL_DIRECT, PTR, UINT, PTR, UINT) /* 242 */ | 252 | ENTRY("fsctl", SYS_fsctl, fsctl, 4, CALL_DIRECT, PTR, UINT, PTR, UINT) /* 242 */ |
253 | ENTRY("initgroups", SYS_initgroups, unimpl_unix_syscall, 3, CALL_INDIRECT, UINT, PTR, INT) /* 243 */ | 253 | ENTRY("initgroups", SYS_initgroups, unimpl_unix_syscall, 3, CALL_INDIRECT, UINT, PTR, INT) /* 243 */ |