diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2018-04-03 19:02:46 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2018-04-03 19:02:46 +0100 |
commit | 9abfc88af3ffd3b33c7fab4471da86462ee71d95 (patch) | |
tree | 09f695cb5cd090f59fb80a355074caa340ef7e5f /linux-user/syscall.c | |
parent | 13b65ec54dbf524cb62331281a98b432f78d4e3a (diff) | |
parent | 64a563dd8dd6ca2661d96a2e4b69f0a5465cab94 (diff) | |
download | qemu-9abfc88af3ffd3b33c7fab4471da86462ee71d95.zip qemu-9abfc88af3ffd3b33c7fab4471da86462ee71d95.tar.gz qemu-9abfc88af3ffd3b33c7fab4471da86462ee71d95.tar.bz2 |
Merge remote-tracking branch 'remotes/xtensa/tags/20180402-xtensa' into staging
xtensa-specific fixes for linux-user:
- fix flushing registers for signal processing in call8 and call12 frames;
- fix PC value for restarted syscalls;
- fix sysv IPC structures;
- fix fadvise64 syscall;
generic fixes for linux-user:
- fix QEMU assertion in multithreaded application by calling cpu_copy
under clone_lock;
- fix mq_getsetattr implementation;
- fix error propagation in clock_gettime;
- implement clock_settime.
# gpg: Signature made Mon 02 Apr 2018 18:07:08 BST
# gpg: using RSA key 51F9CC91F83FA044
# gpg: Good signature from "Max Filippov <filippov@cadence.com>"
# gpg: aka "Max Filippov <max.filippov@cogentembedded.com>"
# gpg: aka "Max Filippov <jcmvbkbc@gmail.com>"
# Primary key fingerprint: 2B67 854B 98E5 327D CDEB 17D8 51F9 CC91 F83F A044
* remotes/xtensa/tags/20180402-xtensa:
target/xtensa: linux-user: fix fadvise64 call
linux-user: implement clock_settime
linux-user: fix error propagation in clock_gettime
target/xtensa: linux-user: fix sysv IPC structures
linux-user: fix mq_getsetattr implementation
linux-user: call cpu_copy under clone_lock
target/xtensa: linux-user: rewind pc for restarted syscall
target/xtensa: fix flush_window_regs
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r-- | linux-user/syscall.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 889abbd..5ef5176 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6346,6 +6346,10 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp, ts = g_new0(TaskState, 1); init_task_state(ts); + + /* Grab a mutex so that thread setup appears atomic. */ + pthread_mutex_lock(&clone_lock); + /* we create a new CPU instance. */ new_env = cpu_copy(env); /* Init regs that differ from the parent. */ @@ -6364,9 +6368,6 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp, cpu_set_tls (new_env, newtls); } - /* Grab a mutex so that thread setup appears atomic. */ - pthread_mutex_lock(&clone_lock); - memset(&info, 0, sizeof(info)); pthread_mutex_init(&info.mutex, NULL); pthread_mutex_lock(&info.mutex); @@ -11508,7 +11509,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, #ifdef TARGET_NR_fadvise64_64 case TARGET_NR_fadvise64_64: -#if defined(TARGET_PPC) +#if defined(TARGET_PPC) || defined(TARGET_XTENSA) /* 6 args: fd, advice, offset (high, low), len (high, low) */ ret = arg2; arg2 = arg3; @@ -11877,13 +11878,25 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, goto unimplemented_nowarn; #endif +#ifdef TARGET_NR_clock_settime + case TARGET_NR_clock_settime: + { + struct timespec ts; + + ret = target_to_host_timespec(&ts, arg2); + if (!is_error(ret)) { + ret = get_errno(clock_settime(arg1, &ts)); + } + break; + } +#endif #ifdef TARGET_NR_clock_gettime case TARGET_NR_clock_gettime: { struct timespec ts; ret = get_errno(clock_gettime(arg1, &ts)); if (!is_error(ret)) { - host_to_target_timespec(arg2, &ts); + ret = host_to_target_timespec(arg2, &ts); } break; } @@ -12091,15 +12104,16 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, { struct mq_attr posix_mq_attr_in, posix_mq_attr_out; ret = 0; - if (arg3 != 0) { - ret = mq_getattr(arg1, &posix_mq_attr_out); - copy_to_user_mq_attr(arg3, &posix_mq_attr_out); - } if (arg2 != 0) { copy_from_user_mq_attr(&posix_mq_attr_in, arg2); - ret |= mq_setattr(arg1, &posix_mq_attr_in, &posix_mq_attr_out); + ret = get_errno(mq_setattr(arg1, &posix_mq_attr_in, + &posix_mq_attr_out)); + } else if (arg3 != 0) { + ret = get_errno(mq_getattr(arg1, &posix_mq_attr_out)); + } + if (ret == 0 && arg3 != 0) { + copy_to_user_mq_attr(arg3, &posix_mq_attr_out); } - } break; #endif |