summaryrefslogtreecommitdiffstats
path: root/linux-user/main.c
diff options
context:
space:
mode:
authorPeter Maydell2018-07-16 11:06:23 +0200
committerPeter Maydell2018-07-16 11:06:23 +0200
commitb808d2001d41352948f84affa62be66910537107 (patch)
tree7274178813b52a34965a9349f161975b4d2d4af0 /linux-user/main.c
parentdocs: Grammar and spelling fixes (diff)
parentZero out the host's `msg_control` buffer (diff)
downloadqemu-b808d2001d41352948f84affa62be66910537107.tar.gz
qemu-b808d2001d41352948f84affa62be66910537107.tar.xz
qemu-b808d2001d41352948f84affa62be66910537107.zip
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-3.0-pull-request' into staging
Some fixes for linux-user: - workaround for CMSG_NXTHDR bug - two patches for ppc64/ppc64le host: fix fcntl() with *LK64 commands (seen when dpkg wants to lock the DB) fix reserved_va alignment (ppc64 needs a 64kB alignment) - convert a forgotten fcntl() to safe_fcntl() # gpg: Signature made Sun 15 Jul 2018 20:51:19 BST # gpg: using RSA key F30C38BD3F2FBE3C # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" # gpg: aka "Laurent Vivier <laurent@vivier.eu>" # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/linux-user-for-3.0-pull-request: Zero out the host's `msg_control` buffer linux-user: fix mmap_find_vma_reserved() linux-user: convert remaining fcntl() to safe_fcntl() linux-user: ppc64: use the correct values for F_*LK64s Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'linux-user/main.c')
-rw-r--r--linux-user/main.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/linux-user/main.c b/linux-user/main.c
index 52b5a618fe..ea00dd9057 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -78,14 +78,7 @@ int have_guest_base;
# endif
#endif
-/* That said, reserving *too* much vm space via mmap can run into problems
- with rlimits, oom due to page table creation, etc. We will still try it,
- if directed by the command-line option, but not by default. */
-#if HOST_LONG_BITS == 64 && TARGET_VIRT_ADDR_SPACE_BITS <= 32
-unsigned long reserved_va = MAX_RESERVED_VA;
-#else
unsigned long reserved_va;
-#endif
static void usage(int exitcode);
@@ -672,6 +665,18 @@ int main(int argc, char **argv, char **envp)
/* init tcg before creating CPUs and to get qemu_host_page_size */
tcg_exec_init(0);
+ /* Reserving *too* much vm space via mmap can run into problems
+ with rlimits, oom due to page table creation, etc. We will still try it,
+ if directed by the command-line option, but not by default. */
+ if (HOST_LONG_BITS == 64 &&
+ TARGET_VIRT_ADDR_SPACE_BITS <= 32 &&
+ reserved_va == 0) {
+ /* reserved_va must be aligned with the host page size
+ * as it is used with mmap()
+ */
+ reserved_va = MAX_RESERVED_VA & qemu_host_page_mask;
+ }
+
cpu = cpu_create(cpu_type);
env = cpu->env_ptr;
cpu_reset(cpu);