Revision 703e0e89 linux-user/main.c
b/linux-user/main.c | ||
---|---|---|
24 | 24 |
#include <unistd.h> |
25 | 25 |
#include <sys/mman.h> |
26 | 26 |
#include <sys/syscall.h> |
27 |
#include <sys/resource.h> |
|
27 | 28 |
|
28 | 29 |
#include "qemu.h" |
29 | 30 |
#include "qemu-common.h" |
... | ... | |
51 | 52 |
/* XXX: on x86 MAP_GROWSDOWN only works if ESP <= address + 32, so |
52 | 53 |
we allocate a bigger stack. Need a better solution, for example |
53 | 54 |
by remapping the process stack directly at the right place */ |
54 |
unsigned long x86_stack_size = 512 * 1024;
|
|
55 |
unsigned long guest_stack_size = 8 * 1024 * 1024UL;
|
|
55 | 56 |
|
56 | 57 |
void gemu_log(const char *fmt, ...) |
57 | 58 |
{ |
... | ... | |
2560 | 2561 |
, |
2561 | 2562 |
TARGET_ARCH, |
2562 | 2563 |
interp_prefix, |
2563 |
x86_stack_size,
|
|
2564 |
guest_stack_size,
|
|
2564 | 2565 |
DEBUG_LOGFILE); |
2565 | 2566 |
exit(1); |
2566 | 2567 |
} |
... | ... | |
2639 | 2640 |
(void) envlist_setenv(envlist, *wrk); |
2640 | 2641 |
} |
2641 | 2642 |
|
2643 |
/* Read the stack limit from the kernel. If it's "unlimited", |
|
2644 |
then we can do little else besides use the default. */ |
|
2645 |
{ |
|
2646 |
struct rlimit lim; |
|
2647 |
if (getrlimit(RLIMIT_STACK, &lim) == 0 |
|
2648 |
&& lim.rlim_cur != RLIM_INFINITY) { |
|
2649 |
guest_stack_size = lim.rlim_cur; |
|
2650 |
} |
|
2651 |
} |
|
2652 |
|
|
2642 | 2653 |
cpu_model = NULL; |
2643 | 2654 |
#if defined(cpudef_setup) |
2644 | 2655 |
cpudef_setup(); /* parse cpu definitions in target config file (TBD) */ |
... | ... | |
2687 | 2698 |
if (optind >= argc) |
2688 | 2699 |
break; |
2689 | 2700 |
r = argv[optind++]; |
2690 |
x86_stack_size = strtol(r, (char **)&r, 0);
|
|
2691 |
if (x86_stack_size <= 0)
|
|
2701 |
guest_stack_size = strtoul(r, (char **)&r, 0);
|
|
2702 |
if (guest_stack_size == 0)
|
|
2692 | 2703 |
usage(); |
2693 | 2704 |
if (*r == 'M') |
2694 |
x86_stack_size *= 1024 * 1024;
|
|
2705 |
guest_stack_size *= 1024 * 1024;
|
|
2695 | 2706 |
else if (*r == 'k' || *r == 'K') |
2696 |
x86_stack_size *= 1024;
|
|
2707 |
guest_stack_size *= 1024;
|
|
2697 | 2708 |
} else if (!strcmp(r, "L")) { |
2698 | 2709 |
interp_prefix = argv[optind++]; |
2699 | 2710 |
} else if (!strcmp(r, "p")) { |
Also available in: Unified diff