new .bochsrc memory option

This commit is contained in:
Stanislav Shwartsman 2009-10-17 17:38:58 +00:00
parent 0a86c3c06f
commit 37b19190b3
5 changed files with 68 additions and 16 deletions

View File

@ -145,17 +145,23 @@ romimage: file=$BXSHARE/BIOS-bochs-latest
cpu: count=1, ips=50000000, reset_on_triple_fault=1, cpuid_limit_winnt=0, msrs="msrs.def"
#=======================================================================
# MEGS
# Set the number of Megabytes of physical memory you want to emulate.
# The default is 32MB, most OS's won't need more than that.
# The maximum amount of memory supported is 2048Mb.
# MEMORY
# Set the amount of physical memory you want to emulate.
#
# GUEST:
# Set amount of guest physical memory to emulate. The default is 32MB,
# the maximum amount limited only by physical address space limitations.
#
# HOST:
# Set amount of host memory you want to allocate for guest RAM emulation.
# It is possible to allocate less memory than you want to emulate in guest
# system. This will fake guest to see the non-existing memory. Once guest
# system touches new memory block it will be dynamically taken from the
# memory pool. You will be warned (by FATAL PANIC) in case guest already
# used all allocated host memory and wants more.
#
#=======================================================================
#megs: 256
#megs: 128
#megs: 64
megs: 32
#megs: 16
#megs: 8
memory: guest=512, host=256
#=======================================================================
# OPTROMIMAGE[1-4]:
@ -867,3 +873,17 @@ i440fxsupport: enabled=1
# romimage: file=:bios:BIOS-bochs-latest, address=0xf0000
# floppya: 1_44=[fd:], status=inserted
#=======================================================================
#=======================================================================
# MEGS
# Set the number of Megabytes of physical memory you want to emulate.
# The default is 32MB, most OS's won't need more than that.
# The maximum amount of memory supported is 2048Mb.
# The 'MEGS' option is deprecated. Use 'MEMORY' option instead.
#=======================================================================
#megs: 256
#megs: 128
#megs: 64
megs: 32
#megs: 16
#megs: 8

View File

@ -4,7 +4,11 @@ Changes for next bugfix+ release (coming soon):
- VMX: Implemented TPR shadow VMEXIT
- Bugfixes for CPU emulation correctness (mostly for VMX support).
- Updates for Bochs internal debugger.
- Memory
- Bugfixes for > 32-bit physical address space.
- Allow to emulate more physical memory than host actually could or would
like to allocate. For more details look for new .bochsrc 'memory' option.
- Cleanup configure options
- All paging related options now will be automatically determined according

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: config.cc,v 1.185 2009-10-12 20:53:00 sshwarts Exp $
// $Id: config.cc,v 1.186 2009-10-17 17:38:58 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -397,6 +397,15 @@ void bx_init_options()
ramsize->set_ask_format("Enter memory size (MB): [%d] ");
ramsize->set_options(ramsize->USE_SPIN_CONTROL);
bx_param_num_c *host_ramsize = new bx_param_num_c(ram,
"host_size",
"Host allocated memory size (megabytes)",
"Amount of host allocated memory in megabytes",
1, 4096,
BX_DEFAULT_MEM_MEGS);
host_ramsize->set_ask_format("Enter memory size (MB): [%d] ");
host_ramsize->set_options(ramsize->USE_SPIN_CONTROL);
path = new bx_param_filename_c(rom,
"path",
"ROM BIOS image",
@ -2532,6 +2541,20 @@ static int parse_line_formatted(const char *context, int num_params, char *param
PARSE_ERR(("%s: megs directive: wrong # args.", context));
}
SIM->get_param_num(BXPN_MEM_SIZE)->set(atol(params[1]));
SIM->get_param_num(BXPN_HOST_MEM_SIZE)->set(atol(params[1]));
} else if (!strcmp(params[0], "memory")) {
if (num_params < 3) {
PARSE_ERR(("%s: memory directive malformed.", context));
}
for (i=1; i<num_params; i++) {
if (!strncmp(params[i], "host=", 5)) {
SIM->get_param_num(BXPN_HOST_MEM_SIZE)->set(atol(&params[i][5]));
} else if (!strncmp(params[i], "guest=", 6)) {
SIM->get_param_num(BXPN_MEM_SIZE)->set(atol(&params[i][6]));
} else {
PARSE_ERR(("%s: memory directive malformed.", context));
}
}
} else if (!strcmp(params[0], "romimage")) {
if ((num_params < 2) || (num_params > 3)) {
PARSE_ERR(("%s: romimage directive: wrong # args.", context));
@ -3558,7 +3581,8 @@ int bx_write_configuration(const char *rc, int overwrite)
fprintf(fp, ", options=\"%s\"\n", strptr);
else
fprintf(fp, "\n");
fprintf(fp, "megs: %d\n", SIM->get_param_num(BXPN_MEM_SIZE)->get());
fprintf(fp, "memory: host=%d, guest=%d\n", SIM->get_param_num(BXPN_HOST_MEM_SIZE)->get(),
SIM->get_param_num(BXPN_MEM_SIZE)->get());
strptr = SIM->get_param_string(BXPN_ROM_PATH)->getptr();
if (strlen(strptr) > 0) {
fprintf(fp, "romimage: file=\"%s\"", strptr);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: siminterface.h,v 1.243 2009-10-16 18:29:45 sshwarts Exp $
// $Id: siminterface.h,v 1.244 2009-10-17 17:38:58 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009 The Bochs Project
@ -155,6 +155,7 @@ typedef enum {
#define BXPN_VENDOR_STRING "cpu.vendor_string"
#define BXPN_BRAND_STRING "cpu.brand_string"
#define BXPN_MEM_SIZE "memory.standard.ram.size"
#define BXPN_HOST_MEM_SIZE "memory.standard.ram.host_size"
#define BXPN_ROM_PATH "memory.standard.rom.path"
#define BXPN_ROM_ADDRESS "memory.standard.rom.addr"
#define BXPN_VGA_ROM_PATH "memory.standard.vgarom.path"

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: main.cc,v 1.406 2009-10-16 17:10:36 sshwarts Exp $
// $Id: main.cc,v 1.407 2009-10-17 17:38:58 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -1053,9 +1053,12 @@ void bx_init_hardware()
// set up memory and CPU objects
bx_param_num_c *bxp_memsize = SIM->get_param_num(BXPN_MEM_SIZE);
Bit32u memSize = bxp_memsize->get() * 1024*1024;
Bit64u memSize = bxp_memsize->get() * 1024*1024;
BX_MEM(0)->init_memory(memSize, memSize);
bx_param_num_c *bxp_host_memsize = SIM->get_param_num(BXPN_HOST_MEM_SIZE);
Bit64u hostMemSize = bxp_host_memsize->get() * 1024*1024;
BX_MEM(0)->init_memory(memSize, hostMemSize);
// First load the BIOS and VGABIOS
BX_MEM(0)->load_ROM(SIM->get_param_string(BXPN_ROM_PATH)->getptr(),