main.c (b8012648b38274aa996f1477c422a79e2d44110b) | main.c (be04f210f954bed8663943a94ece50c2ca410231) |
---|---|
1/* 2 * qemu bsd user main 3 * 4 * Copyright (c) 2003-2008 Fabrice Bellard 5 * Copyright (c) 2013-14 Stacey Son 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by --- 38 unchanged lines hidden (view full) --- 47#include "trace/control.h" 48#include "crypto/init.h" 49#include "qemu/guest-random.h" 50 51#include "host-os.h" 52#include "target_arch_cpu.h" 53 54int singlestep; | 1/* 2 * qemu bsd user main 3 * 4 * Copyright (c) 2003-2008 Fabrice Bellard 5 * Copyright (c) 2013-14 Stacey Son 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by --- 38 unchanged lines hidden (view full) --- 47#include "trace/control.h" 48#include "crypto/init.h" 49#include "qemu/guest-random.h" 50 51#include "host-os.h" 52#include "target_arch_cpu.h" 53 54int singlestep; |
55unsigned long mmap_min_addr; | |
56uintptr_t guest_base; 57bool have_guest_base; | 55uintptr_t guest_base; 56bool have_guest_base; |
57/* 58 * When running 32-on-64 we should make sure we can fit all of the possible 59 * guest address space into a contiguous chunk of virtual host memory. 60 * 61 * This way we will never overlap with our own libraries or binaries or stack 62 * or anything else that QEMU maps. 63 * 64 * Many cpus reserve the high bit (or more than one for some 64-bit cpus) 65 * of the address for the kernel. Some cpus rely on this and user space 66 * uses the high bit(s) for pointer tagging and the like. For them, we 67 * must preserve the expected address space. 68 */ 69#ifndef MAX_RESERVED_VA 70# if HOST_LONG_BITS > TARGET_VIRT_ADDR_SPACE_BITS 71# if TARGET_VIRT_ADDR_SPACE_BITS == 32 && \ 72 (TARGET_LONG_BITS == 32 || defined(TARGET_ABI32)) 73/* 74 * There are a number of places where we assign reserved_va to a variable 75 * of type abi_ulong and expect it to fit. Avoid the last page. 76 */ 77# define MAX_RESERVED_VA (0xfffffffful & TARGET_PAGE_MASK) 78# else 79# define MAX_RESERVED_VA (1ul << TARGET_VIRT_ADDR_SPACE_BITS) 80# endif 81# else 82# define MAX_RESERVED_VA 0 83# endif 84#endif 85 86/* 87 * That said, reserving *too* much vm space via mmap can run into problems 88 * with rlimits, oom due to page table creation, etc. We will still try it, 89 * if directed by the command-line option, but not by default. 90 */ 91#if HOST_LONG_BITS == 64 && TARGET_VIRT_ADDR_SPACE_BITS <= 32 92unsigned long reserved_va = MAX_RESERVED_VA; 93#else |
|
58unsigned long reserved_va; | 94unsigned long reserved_va; |
95#endif |
|
59 60static const char *interp_prefix = CONFIG_QEMU_INTERP_PREFIX; 61const char *qemu_uname_release; 62enum BSDType bsd_type; 63char qemu_proc_pathname[PATH_MAX]; /* full path to exeutable */ 64 65unsigned long target_maxtsiz = TARGET_MAXTSIZ; /* max text size */ 66unsigned long target_dfldsiz = TARGET_DFLDSIZ; /* initial data size limit */ --- 367 unchanged lines hidden (view full) --- 434 435 if (getenv("QEMU_STRACE")) { 436 do_strace = 1; 437 } 438 439 target_environ = envlist_to_environ(envlist, NULL); 440 envlist_free(envlist); 441 | 96 97static const char *interp_prefix = CONFIG_QEMU_INTERP_PREFIX; 98const char *qemu_uname_release; 99enum BSDType bsd_type; 100char qemu_proc_pathname[PATH_MAX]; /* full path to exeutable */ 101 102unsigned long target_maxtsiz = TARGET_MAXTSIZ; /* max text size */ 103unsigned long target_dfldsiz = TARGET_DFLDSIZ; /* initial data size limit */ --- 367 unchanged lines hidden (view full) --- 471 472 if (getenv("QEMU_STRACE")) { 473 do_strace = 1; 474 } 475 476 target_environ = envlist_to_environ(envlist, NULL); 477 envlist_free(envlist); 478 |
479 if (reserved_va) { 480 mmap_next_start = reserved_va; 481 } 482 |
|
442 { 443 Error *err = NULL; 444 if (seed_optarg != NULL) { 445 qemu_guest_random_seed_main(seed_optarg, &err); 446 } else { 447 qcrypto_init(&err); 448 } 449 if (err) { --- 68 unchanged lines hidden --- | 483 { 484 Error *err = NULL; 485 if (seed_optarg != NULL) { 486 qemu_guest_random_seed_main(seed_optarg, &err); 487 } else { 488 qcrypto_init(&err); 489 } 490 if (err) { --- 68 unchanged lines hidden --- |