aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-07-27 15:55:56 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-07-27 15:55:56 +0100
commitcb320a07e6cb6e251f9aeb4bf57f99cc320eb8ea (patch)
tree37a9d1b99e1bc8140d4d47fdd608fe442a239d8f /linux-user
parent4215d3413272ad6d1c6c9d0234450b602e46a74c (diff)
parent4a70232b1d26b0d73e1bce60b2c3bdb7e4279d16 (diff)
downloadqemu-cb320a07e6cb6e251f9aeb4bf57f99cc320eb8ea.zip
qemu-cb320a07e6cb6e251f9aeb4bf57f99cc320eb8ea.tar.gz
qemu-cb320a07e6cb6e251f9aeb4bf57f99cc320eb8ea.tar.bz2
Merge remote-tracking branch 'remotes/stsquad/tags/pull-fixes-for-rc2-270720-1' into staging
Various fixes for rc2: - get shippable working again - semihosting bug fixes - tweak tb-size handling for low memory machines - i386 compound literal float fix - linux-user MAP_FIXED->MAP_NOREPLACE on fallback - docker binfmt_misc fixes - linux-user nanosleep fix - tests/vm drain console fixes # gpg: Signature made Mon 27 Jul 2020 09:45:31 BST # gpg: using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44 # gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full] # Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44 * remotes/stsquad/tags/pull-fixes-for-rc2-270720-1: tests/vm: add shutdown timeout in basevm.py python/qemu: Change ConsoleSocket to optionally drain socket. python/qemu: Cleanup changes to ConsoleSocket linux-user, ppc: fix clock_nanosleep() for linux-user-ppc linux-user: fix clock_nanosleep() tests/docker: add support for DEB_KEYRING tests/docker: fix binfmt_misc image building tests/docker: fix update command due to python3 str/bytes distinction linux-user: don't use MAP_FIXED in pgd_find_hole_fallback target/i386: floatx80: avoid compound literals in static initializers accel/tcg: better handle memory constrained systems util/oslib-win32: add qemu_get_host_physmem implementation util: add qemu_get_host_physmem utility function semihosting: don't send the trailing '\0' semihosting: defer connect_chardevs a little more to use serialx shippable: add one more qemu to registry url Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/elfload.c10
-rw-r--r--linux-user/syscall.c15
2 files changed, 13 insertions, 12 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 7e7f642..fe9dfe7 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2134,12 +2134,15 @@ static uintptr_t pgd_find_hole_fallback(uintptr_t guest_size, uintptr_t brk,
/* we have run out of space */
return -1;
} else {
- int flags = MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE | MAP_FIXED;
+ int flags = MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE |
+ MAP_FIXED_NOREPLACE;
void * mmap_start = mmap((void *) align_start, guest_size,
PROT_NONE, flags, -1, 0);
if (mmap_start != MAP_FAILED) {
munmap((void *) align_start, guest_size);
- return (uintptr_t) mmap_start + offset;
+ if (MAP_FIXED_NOREPLACE || mmap_start == (void *) align_start) {
+ return (uintptr_t) mmap_start + offset;
+ }
}
base += qemu_host_page_size;
}
@@ -2307,9 +2310,8 @@ static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr,
/* Widen the "image" to the entire reserved address space. */
pgb_static(image_name, 0, reserved_va, align);
-#ifdef MAP_FIXED_NOREPLACE
+ /* osdep.h defines this as 0 if it's missing */
flags |= MAP_FIXED_NOREPLACE;
-#endif
/* Reserve the memory on the host. */
assert(guest_base != 0);
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1211e75..f5c4f6b 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -11831,16 +11831,15 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
target_to_host_timespec(&ts, arg3);
ret = get_errno(safe_clock_nanosleep(arg1, arg2,
&ts, arg4 ? &ts : NULL));
- if (arg4)
+ /*
+ * if the call is interrupted by a signal handler, it fails
+ * with error -TARGET_EINTR and if arg4 is not NULL and arg2 is not
+ * TIMER_ABSTIME, it returns the remaining unslept time in arg4.
+ */
+ if (ret == -TARGET_EINTR && arg4 && arg2 != TIMER_ABSTIME) {
host_to_target_timespec(arg4, &ts);
-
-#if defined(TARGET_PPC)
- /* clock_nanosleep is odd in that it returns positive errno values.
- * On PPC, CR0 bit 3 should be set in such a situation. */
- if (ret && ret != -TARGET_ERESTARTSYS) {
- ((CPUPPCState *)cpu_env)->crf[0] |= 1;
}
-#endif
+
return ret;
}
#endif