mirror of https://github.com/bochs-emu/Bochs
- memory parameter handling rewrite completed
- added BXPN_* symbols for parameter names (taken from old save/restore branch)
This commit is contained in:
parent
6b2ab6aa92
commit
a14b2a9720
|
@ -1,5 +1,5 @@
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: bochs.h,v 1.172 2006-02-16 21:44:16 vruppert Exp $
|
// $Id: bochs.h,v 1.173 2006-02-17 22:27:38 vruppert Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||||
|
@ -471,15 +471,6 @@ typedef struct {
|
||||||
bx_param_num_c *Oirq;
|
bx_param_num_c *Oirq;
|
||||||
} bx_ata_options;
|
} bx_ata_options;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
bx_param_string_c *Opath;
|
|
||||||
bx_param_num_c *Oaddress;
|
|
||||||
} bx_rom_options;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
bx_param_string_c *Opath;
|
|
||||||
} bx_vgarom_options;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
bx_param_num_c *Onprocessors;
|
bx_param_num_c *Onprocessors;
|
||||||
bx_param_num_c *Oncores;
|
bx_param_num_c *Oncores;
|
||||||
|
@ -488,10 +479,6 @@ typedef struct {
|
||||||
bx_param_bool_c *Oreset_on_triple_fault;
|
bx_param_bool_c *Oreset_on_triple_fault;
|
||||||
} bx_cpu_options;
|
} bx_cpu_options;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
bx_param_num_c *Osize;
|
|
||||||
} bx_mem_options;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
bx_param_bool_c *Oenabled;
|
bx_param_bool_c *Oenabled;
|
||||||
bx_param_string_c *Ooutfile;
|
bx_param_string_c *Ooutfile;
|
||||||
|
@ -584,12 +571,7 @@ typedef struct BOCHSAPI {
|
||||||
bx_usb_options usb[BX_N_USB_HUBS];
|
bx_usb_options usb[BX_N_USB_HUBS];
|
||||||
bx_pcislot_options pcislot[BX_N_PCI_SLOTS];
|
bx_pcislot_options pcislot[BX_N_PCI_SLOTS];
|
||||||
bx_pnic_options pnic;
|
bx_pnic_options pnic;
|
||||||
bx_rom_options rom;
|
|
||||||
bx_vgarom_options vgarom;
|
|
||||||
bx_rom_options optrom[BX_N_OPTROM_IMAGES]; // Optional rom images
|
|
||||||
bx_rom_options optram[BX_N_OPTRAM_IMAGES]; // Optional ram images
|
|
||||||
bx_cpu_options cpu;
|
bx_cpu_options cpu;
|
||||||
bx_mem_options memory;
|
|
||||||
bx_parport_options par[BX_N_PARALLEL_PORTS]; // parallel ports
|
bx_parport_options par[BX_N_PARALLEL_PORTS]; // parallel ports
|
||||||
bx_sb16_options sb16;
|
bx_sb16_options sb16;
|
||||||
bx_param_enum_c *Obootdrive[3];
|
bx_param_enum_c *Obootdrive[3];
|
||||||
|
|
176
bochs/config.cc
176
bochs/config.cc
|
@ -1,5 +1,5 @@
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: config.cc,v 1.74 2006-02-16 21:44:16 vruppert Exp $
|
// $Id: config.cc,v 1.75 2006-02-17 22:27:38 vruppert Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||||
|
@ -813,77 +813,80 @@ void bx_init_options ()
|
||||||
bx_list_c *optram = new bx_list_c (memory, "optram", "");
|
bx_list_c *optram = new bx_list_c (memory, "optram", "");
|
||||||
|
|
||||||
// memory options (ram & rom)
|
// memory options (ram & rom)
|
||||||
bx_options.memory.Osize = new bx_param_num_c (ram,
|
bx_param_num_c *ramsize = new bx_param_num_c(ram,
|
||||||
"size",
|
"size",
|
||||||
"Amount of RAM in megabytes",
|
"Amount of RAM in megabytes",
|
||||||
1, 2048,
|
1, 2048,
|
||||||
BX_DEFAULT_MEM_MEGS);
|
BX_DEFAULT_MEM_MEGS);
|
||||||
bx_options.memory.Osize->set_format ("Memory size in megabytes: %d");
|
ramsize->set_format("Memory size in megabytes: %d");
|
||||||
bx_options.memory.Osize->set_ask_format ("Enter memory size (MB): [%d] ");
|
ramsize->set_ask_format("Enter memory size (MB): [%d] ");
|
||||||
#if BX_WITH_WX
|
#if BX_WITH_WX
|
||||||
bx_options.memory.Osize->set_label ("Memory size (megabytes)");
|
ramsize->set_label("Memory size (megabytes)");
|
||||||
bx_options.memory.Osize->set_options (bx_param_num_c::USE_SPIN_CONTROL);
|
ramsize->set_options(bx_param_num_c::USE_SPIN_CONTROL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bx_options.rom.Opath = new bx_param_filename_c (rom,
|
bx_param_filename_c *rompath = new bx_param_filename_c(rom,
|
||||||
"path",
|
"path",
|
||||||
"Pathname of ROM image to load",
|
"Pathname of ROM image to load",
|
||||||
"", BX_PATHNAME_LEN);
|
"", BX_PATHNAME_LEN);
|
||||||
bx_options.rom.Opath->set_format ("Name of ROM BIOS image: %s");
|
rompath->set_format ("Name of ROM BIOS image: %s");
|
||||||
sprintf(name, "%s/BIOS-bochs-latest", get_builtin_variable("BXSHARE"));
|
sprintf(name, "%s/BIOS-bochs-latest", get_builtin_variable("BXSHARE"));
|
||||||
bx_options.rom.Opath->set_initial_val (name);
|
rompath->set_initial_val(name);
|
||||||
bx_options.rom.Oaddress = new bx_param_num_c (rom,
|
bx_param_num_c *romaddr = new bx_param_num_c(rom,
|
||||||
"addr",
|
"addr",
|
||||||
"The address at which the ROM image should be loaded",
|
"The address at which the ROM image should be loaded",
|
||||||
0, BX_MAX_BIT32U,
|
0, BX_MAX_BIT32U,
|
||||||
0);
|
0);
|
||||||
bx_options.rom.Oaddress->set_base (16);
|
romaddr->set_base(16);
|
||||||
#if BX_WITH_WX
|
#if BX_WITH_WX
|
||||||
bx_options.rom.Opath->set_label ("ROM BIOS image");
|
rompath->set_label("ROM BIOS image");
|
||||||
bx_options.rom.Oaddress->set_label ("ROM BIOS address");
|
romaddr->set_label("ROM BIOS address");
|
||||||
bx_options.rom.Oaddress->set_format ("0x%05x");
|
romaddr->set_format("0x%05x");
|
||||||
#else
|
#else
|
||||||
bx_options.rom.Oaddress->set_format ("ROM BIOS address: 0x%05x");
|
romaddr->set_format("ROM BIOS address: 0x%05x");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bx_options.vgarom.Opath = new bx_param_filename_c (vgarom,
|
bx_param_filename_c *vgarompath = new bx_param_filename_c(vgarom,
|
||||||
"path",
|
"path",
|
||||||
"Pathname of VGA ROM image to load",
|
"Pathname of VGA ROM image to load",
|
||||||
"", BX_PATHNAME_LEN);
|
"", BX_PATHNAME_LEN);
|
||||||
bx_options.vgarom.Opath->set_format ("Name of VGA BIOS image: %s");
|
vgarompath->set_format("Name of VGA BIOS image: %s");
|
||||||
#if BX_WITH_WX
|
#if BX_WITH_WX
|
||||||
bx_options.vgarom.Opath->set_label ("VGA BIOS image");
|
vgarompath->set_label("VGA BIOS image");
|
||||||
#endif
|
#endif
|
||||||
sprintf(name, "%s/VGABIOS-lgpl-latest", get_builtin_variable("BXSHARE"));
|
sprintf(name, "%s/VGABIOS-lgpl-latest", get_builtin_variable("BXSHARE"));
|
||||||
bx_options.vgarom.Opath->set_initial_val (name);
|
vgarompath->set_initial_val(name);
|
||||||
|
|
||||||
|
bx_param_filename_c *optpath;
|
||||||
|
bx_param_num_c *optaddr;
|
||||||
|
|
||||||
for (i=0; i<BX_N_OPTROM_IMAGES; i++) {
|
for (i=0; i<BX_N_OPTROM_IMAGES; i++) {
|
||||||
sprintf(name, "%d", i+1);
|
sprintf(name, "%d", i+1);
|
||||||
bx_list_c *optnum1 = new bx_list_c(optrom, strdup(name), "");
|
bx_list_c *optnum1 = new bx_list_c(optrom, strdup(name), "");
|
||||||
sprintf(descr, "Pathname of optional ROM image #%d to load", i+1);
|
sprintf(descr, "Pathname of optional ROM image #%d to load", i+1);
|
||||||
bx_options.optrom[i].Opath = new bx_param_filename_c (optnum1,
|
optpath = new bx_param_filename_c(optnum1,
|
||||||
"path",
|
"path",
|
||||||
strdup(descr),
|
strdup(descr),
|
||||||
"", BX_PATHNAME_LEN);
|
"", BX_PATHNAME_LEN);
|
||||||
sprintf (label, "Name of optional ROM image #%d", i+1);
|
sprintf (label, "Name of optional ROM image #%d", i+1);
|
||||||
strcat(label, " : %s");
|
strcat(label, " : %s");
|
||||||
bx_options.optrom[i].Opath->set_format (strdup(label));
|
optpath->set_format(strdup(label));
|
||||||
sprintf (descr, "The address at which the optional ROM image #%d should be loaded", i+1);
|
sprintf (descr, "The address at which the optional ROM image #%d should be loaded", i+1);
|
||||||
bx_options.optrom[i].Oaddress = new bx_param_num_c (optnum1,
|
optaddr = new bx_param_num_c(optnum1,
|
||||||
"addr",
|
"addr",
|
||||||
strdup(descr),
|
strdup(descr),
|
||||||
0, BX_MAX_BIT32U,
|
0, BX_MAX_BIT32U,
|
||||||
0);
|
0);
|
||||||
bx_options.optrom[i].Oaddress->set_base (16);
|
optaddr->set_base(16);
|
||||||
#if BX_WITH_WX
|
#if BX_WITH_WX
|
||||||
sprintf (label, "Optional ROM image #%d", i+1);
|
sprintf (label, "Optional ROM image #%d", i+1);
|
||||||
bx_options.optrom[i].Opath->set_label (strdup(label));
|
optpath->set_label(strdup(label));
|
||||||
bx_options.optrom[i].Oaddress->set_label ("Address");
|
optaddr->set_label("Address");
|
||||||
bx_options.optrom[i].Oaddress->set_format ("0x%05x");
|
optaddr->set_format("0x%05x");
|
||||||
#else
|
#else
|
||||||
sprintf (label, "Optional ROM #%d address:", i+1);
|
sprintf (label, "Optional ROM #%d address:", i+1);
|
||||||
strcat(label, " 0x%05x");
|
strcat(label, " 0x%05x");
|
||||||
bx_options.optrom[i].Oaddress->set_format (strdup(label));
|
optaddr->set_format(strdup(label));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -891,30 +894,30 @@ void bx_init_options ()
|
||||||
sprintf(name, "%d", i+1);
|
sprintf(name, "%d", i+1);
|
||||||
bx_list_c *optnum2 = new bx_list_c(optram, strdup(name), "");
|
bx_list_c *optnum2 = new bx_list_c(optram, strdup(name), "");
|
||||||
sprintf(descr, "Pathname of optional RAM image #%d to load", i+1);
|
sprintf(descr, "Pathname of optional RAM image #%d to load", i+1);
|
||||||
bx_options.optram[i].Opath = new bx_param_filename_c (optnum2,
|
optpath = new bx_param_filename_c(optnum2,
|
||||||
"path",
|
"path",
|
||||||
strdup(descr),
|
strdup(descr),
|
||||||
"", BX_PATHNAME_LEN);
|
"", BX_PATHNAME_LEN);
|
||||||
sprintf(label, "Name of optional RAM image #%d", i+1);
|
sprintf(label, "Name of optional RAM image #%d", i+1);
|
||||||
strcat(label, " : %s");
|
strcat(label, " : %s");
|
||||||
bx_options.optram[i].Opath->set_format (strdup(label));
|
optpath->set_format(strdup(label));
|
||||||
sprintf (name, "memory.optram.%d.address", i+1);
|
sprintf (name, "memory.optram.%d.address", i+1);
|
||||||
sprintf (descr, "The address at which the optional RAM image #%d should be loaded", i+1);
|
sprintf (descr, "The address at which the optional RAM image #%d should be loaded", i+1);
|
||||||
bx_options.optram[i].Oaddress = new bx_param_num_c (optnum2,
|
optaddr = new bx_param_num_c(optnum2,
|
||||||
"addr",
|
"addr",
|
||||||
strdup(descr),
|
strdup(descr),
|
||||||
0, BX_MAX_BIT32U,
|
0, BX_MAX_BIT32U,
|
||||||
0);
|
0);
|
||||||
bx_options.optram[i].Oaddress->set_base (16);
|
optaddr->set_base(16);
|
||||||
#if BX_WITH_WX
|
#if BX_WITH_WX
|
||||||
sprintf (label, "Optional RAM image #%d", i+1);
|
sprintf (label, "Optional RAM image #%d", i+1);
|
||||||
bx_options.optram[i].Opath->set_label (strdup(label));
|
optpath->set_label(strdup(label));
|
||||||
bx_options.optram[i].Oaddress->set_label ("Address");
|
optaddr->set_label("Address");
|
||||||
bx_options.optram[i].Oaddress->set_format ("0x%05x");
|
optaddr->set_format("0x%05x");
|
||||||
#else
|
#else
|
||||||
sprintf(label, "Optional RAM #%d address:", i+1);
|
sprintf(label, "Optional RAM #%d address:", i+1);
|
||||||
strcat(label, " 0x%05x");
|
strcat(label, " 0x%05x");
|
||||||
bx_options.optram[i].Oaddress->set_format (strdup(label));
|
optaddr->set_format(strdup(label));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
memory->get_options()->set(bx_list_c::USE_TAB_WINDOW);
|
memory->get_options()->set(bx_list_c::USE_TAB_WINDOW);
|
||||||
|
@ -924,26 +927,26 @@ void bx_init_options ()
|
||||||
optram->set_label("Optional RAM Images");
|
optram->set_label("Optional RAM Images");
|
||||||
|
|
||||||
bx_param_c *memory_init_list[] = {
|
bx_param_c *memory_init_list[] = {
|
||||||
bx_options.memory.Osize,
|
SIM->get_param(BXPN_MEM_SIZE),
|
||||||
bx_options.rom.Opath,
|
SIM->get_param(BXPN_ROM_PATH),
|
||||||
bx_options.rom.Oaddress,
|
SIM->get_param(BXPN_ROM_ADDRESS),
|
||||||
bx_options.vgarom.Opath,
|
SIM->get_param(BXPN_VGA_ROM_PATH),
|
||||||
bx_options.optrom[0].Opath,
|
SIM->get_param(BXPN_OPTROM1_PATH),
|
||||||
bx_options.optrom[0].Oaddress,
|
SIM->get_param(BXPN_OPTROM1_ADDRESS),
|
||||||
bx_options.optrom[1].Opath,
|
SIM->get_param(BXPN_OPTROM2_PATH),
|
||||||
bx_options.optrom[1].Oaddress,
|
SIM->get_param(BXPN_OPTROM2_ADDRESS),
|
||||||
bx_options.optrom[2].Opath,
|
SIM->get_param(BXPN_OPTROM3_PATH),
|
||||||
bx_options.optrom[2].Oaddress,
|
SIM->get_param(BXPN_OPTROM3_ADDRESS),
|
||||||
bx_options.optrom[3].Opath,
|
SIM->get_param(BXPN_OPTROM4_PATH),
|
||||||
bx_options.optrom[3].Oaddress,
|
SIM->get_param(BXPN_OPTROM4_ADDRESS),
|
||||||
bx_options.optram[0].Opath,
|
SIM->get_param(BXPN_OPTRAM1_PATH),
|
||||||
bx_options.optram[0].Oaddress,
|
SIM->get_param(BXPN_OPTRAM1_ADDRESS),
|
||||||
bx_options.optram[1].Opath,
|
SIM->get_param(BXPN_OPTRAM2_PATH),
|
||||||
bx_options.optram[1].Oaddress,
|
SIM->get_param(BXPN_OPTRAM2_ADDRESS),
|
||||||
bx_options.optram[2].Opath,
|
SIM->get_param(BXPN_OPTRAM3_PATH),
|
||||||
bx_options.optram[2].Oaddress,
|
SIM->get_param(BXPN_OPTRAM3_ADDRESS),
|
||||||
bx_options.optram[3].Opath,
|
SIM->get_param(BXPN_OPTRAM4_PATH),
|
||||||
bx_options.optram[3].Oaddress,
|
SIM->get_param(BXPN_OPTRAM4_ADDRESS),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
menu = new bx_list_c(BXP_MENU_MEMORY, "Bochs Memory Options", "memmenu", memory_init_list);
|
menu = new bx_list_c(BXP_MENU_MEMORY, "Bochs Memory Options", "memmenu", memory_init_list);
|
||||||
|
@ -2694,74 +2697,80 @@ static Bit32s parse_line_formatted(char *context, int num_params, char *params[]
|
||||||
if (num_params != 2) {
|
if (num_params != 2) {
|
||||||
PARSE_ERR(("%s: megs directive: wrong # args.", context));
|
PARSE_ERR(("%s: megs directive: wrong # args.", context));
|
||||||
}
|
}
|
||||||
SIM->get_param_num("memory.standard.ram.size")->set(atol(params[1]));
|
SIM->get_param_num(BXPN_MEM_SIZE)->set(atol(params[1]));
|
||||||
} else if (!strcmp(params[0], "romimage")) {
|
} else if (!strcmp(params[0], "romimage")) {
|
||||||
if ((num_params < 2) || (num_params > 3)) {
|
if ((num_params < 2) || (num_params > 3)) {
|
||||||
PARSE_ERR(("%s: romimage directive: wrong # args.", context));
|
PARSE_ERR(("%s: romimage directive: wrong # args.", context));
|
||||||
}
|
}
|
||||||
if (!strncmp(params[1], "file=", 5)) {
|
if (!strncmp(params[1], "file=", 5)) {
|
||||||
SIM->get_param_string("memory.standard.rom.path")->set(¶ms[1][5]);
|
SIM->get_param_string(BXPN_ROM_PATH)->set(¶ms[1][5]);
|
||||||
} else {
|
} else {
|
||||||
PARSE_ERR(("%s: romimage directive malformed.", context));
|
PARSE_ERR(("%s: romimage directive malformed.", context));
|
||||||
}
|
}
|
||||||
if (num_params == 3) {
|
if (num_params == 3) {
|
||||||
if (!strncmp(params[2], "address=", 8)) {
|
if (!strncmp(params[2], "address=", 8)) {
|
||||||
if ((params[2][8] == '0') && (params[2][9] == 'x'))
|
if ((params[2][8] == '0') && (params[2][9] == 'x'))
|
||||||
SIM->get_param_num("memory.standard.rom.addr")->set(strtoul (¶ms[2][8], NULL, 16));
|
SIM->get_param_num(BXPN_ROM_ADDRESS)->set(strtoul (¶ms[2][8], NULL, 16));
|
||||||
else
|
else
|
||||||
SIM->get_param_num("memory.standard.rom.addr")->set(strtoul (¶ms[2][8], NULL, 10));
|
SIM->get_param_num(BXPN_ROM_ADDRESS)->set(strtoul (¶ms[2][8], NULL, 10));
|
||||||
} else {
|
} else {
|
||||||
PARSE_ERR(("%s: romimage directive malformed.", context));
|
PARSE_ERR(("%s: romimage directive malformed.", context));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SIM->get_param_num("memory.standard.rom.addr")->set (0);
|
SIM->get_param_num(BXPN_ROM_ADDRESS)->set (0);
|
||||||
}
|
}
|
||||||
} else if (!strcmp(params[0], "vgaromimage")) {
|
} else if (!strcmp(params[0], "vgaromimage")) {
|
||||||
if (num_params != 2) {
|
if (num_params != 2) {
|
||||||
PARSE_ERR(("%s: vgaromimage directive: wrong # args.", context));
|
PARSE_ERR(("%s: vgaromimage directive: wrong # args.", context));
|
||||||
}
|
}
|
||||||
if (!strncmp(params[1], "file=", 5)) {
|
if (!strncmp(params[1], "file=", 5)) {
|
||||||
SIM->get_param_string("memory.standard.vgarom.path")->set(¶ms[1][5]);
|
SIM->get_param_string(BXPN_VGA_ROM_PATH)->set(¶ms[1][5]);
|
||||||
} else {
|
} else {
|
||||||
BX_INFO(("WARNING: syntax has changed, please use 'vgaromimage: file=...' now"));
|
BX_INFO(("WARNING: syntax has changed, please use 'vgaromimage: file=...' now"));
|
||||||
SIM->get_param_string("memory.standard.vgarom.path")->set (params[1]);
|
SIM->get_param_string(BXPN_VGA_ROM_PATH)->set (params[1]);
|
||||||
}
|
}
|
||||||
} else if (!strncmp(params[0], "optromimage", 11)) {
|
} else if (!strncmp(params[0], "optromimage", 11)) {
|
||||||
int num = atoi(¶ms[0][11]);
|
int num = atoi(¶ms[0][11]);
|
||||||
|
char tmppath[80], tmpaddr[80];
|
||||||
if ((num < 1) || (num > BX_N_OPTROM_IMAGES)) {
|
if ((num < 1) || (num > BX_N_OPTROM_IMAGES)) {
|
||||||
PARSE_ERR(("%s: optromimage%d: not supported", context, num));
|
PARSE_ERR(("%s: optromimage%d: not supported", context, num));
|
||||||
}
|
}
|
||||||
if (num_params != 3) {
|
if (num_params != 3) {
|
||||||
PARSE_ERR(("%s: optromimage%d directive: wrong # args.", context, num));
|
PARSE_ERR(("%s: optromimage%d directive: wrong # args.", context, num));
|
||||||
}
|
}
|
||||||
|
sprintf(tmppath, "memory.optrom.%d.path", num);
|
||||||
|
sprintf(tmpaddr, "memory.optrom.%d.addr", num);
|
||||||
for (i=1; i<num_params; i++) {
|
for (i=1; i<num_params; i++) {
|
||||||
if (!strncmp(params[i], "file=", 5)) {
|
if (!strncmp(params[i], "file=", 5)) {
|
||||||
bx_options.optrom[num-1].Opath->set (¶ms[i][5]);
|
SIM->get_param_string(tmppath)->set(¶ms[i][5]);
|
||||||
} else if (!strncmp(params[i], "address=", 8)) {
|
} else if (!strncmp(params[i], "address=", 8)) {
|
||||||
if ((params[i][8] == '0') && (params[2][9] == 'x'))
|
if ((params[i][8] == '0') && (params[2][9] == 'x'))
|
||||||
bx_options.optrom[num-1].Oaddress->set (strtoul (¶ms[i][8], NULL, 16));
|
SIM->get_param_num(tmpaddr)->set(strtoul (¶ms[i][8], NULL, 16));
|
||||||
else
|
else
|
||||||
bx_options.optrom[num-1].Oaddress->set (strtoul (¶ms[i][8], NULL, 10));
|
SIM->get_param_num(tmpaddr)->set(strtoul (¶ms[i][8], NULL, 10));
|
||||||
} else {
|
} else {
|
||||||
PARSE_ERR(("%s: optromimage%d directive malformed.", context, num));
|
PARSE_ERR(("%s: optromimage%d directive malformed.", context, num));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!strncmp(params[0], "optramimage", 11)) {
|
} else if (!strncmp(params[0], "optramimage", 11)) {
|
||||||
int num = atoi(¶ms[0][11]);
|
int num = atoi(¶ms[0][11]);
|
||||||
|
char tmppath[80], tmpaddr[80];
|
||||||
if ((num < 1) || (num > BX_N_OPTRAM_IMAGES)) {
|
if ((num < 1) || (num > BX_N_OPTRAM_IMAGES)) {
|
||||||
PARSE_ERR(("%s: ramimage%d: not supported", context, num));
|
PARSE_ERR(("%s: ramimage%d: not supported", context, num));
|
||||||
}
|
}
|
||||||
if (num_params != 3) {
|
if (num_params != 3) {
|
||||||
PARSE_ERR(("%s: ramimage%d directive: wrong # args.", context, num));
|
PARSE_ERR(("%s: ramimage%d directive: wrong # args.", context, num));
|
||||||
}
|
}
|
||||||
|
sprintf(tmppath, "memory.optram.%d.path", num);
|
||||||
|
sprintf(tmpaddr, "memory.optram.%d.addr", num);
|
||||||
for (i=1; i<num_params; i++) {
|
for (i=1; i<num_params; i++) {
|
||||||
if (!strncmp(params[i], "file=", 5)) {
|
if (!strncmp(params[i], "file=", 5)) {
|
||||||
bx_options.optram[num-1].Opath->set (¶ms[i][5]);
|
SIM->get_param_string(tmppath)->set(¶ms[i][5]);
|
||||||
} else if (!strncmp(params[i], "address=", 8)) {
|
} else if (!strncmp(params[i], "address=", 8)) {
|
||||||
if ((params[i][8] == '0') && (params[2][9] == 'x'))
|
if ((params[i][8] == '0') && (params[2][9] == 'x'))
|
||||||
bx_options.optram[num-1].Oaddress->set (strtoul (¶ms[i][8], NULL, 16));
|
SIM->get_param_num(tmpaddr)->set(strtoul (¶ms[i][8], NULL, 16));
|
||||||
else
|
else
|
||||||
bx_options.optram[num-1].Oaddress->set (strtoul (¶ms[i][8], NULL, 10));
|
SIM->get_param_num(tmpaddr)->set(strtoul (¶ms[i][8], NULL, 10));
|
||||||
} else {
|
} else {
|
||||||
PARSE_ERR(("%s: optram%d directive malformed.", context, num));
|
PARSE_ERR(("%s: optram%d directive malformed.", context, num));
|
||||||
}
|
}
|
||||||
|
@ -3619,6 +3628,7 @@ int bx_write_keyboard_options (FILE *fp, bx_keyboard_options *opt)
|
||||||
int bx_write_configuration (char *rc, int overwrite)
|
int bx_write_configuration (char *rc, int overwrite)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
char *strptr, tmppath[80], tmpaddr[80];
|
||||||
|
|
||||||
BX_INFO (("write configuration to %s\n", rc));
|
BX_INFO (("write configuration to %s\n", rc));
|
||||||
// check if it exists. If so, only proceed if overwrite is set.
|
// check if it exists. If so, only proceed if overwrite is set.
|
||||||
|
@ -3637,13 +3647,15 @@ int bx_write_configuration (char *rc, int overwrite)
|
||||||
fprintf (fp, ", options=\"%s\"\n", bx_options.Odisplaylib_options->getptr ());
|
fprintf (fp, ", options=\"%s\"\n", bx_options.Odisplaylib_options->getptr ());
|
||||||
else
|
else
|
||||||
fprintf (fp, "\n");
|
fprintf (fp, "\n");
|
||||||
fprintf (fp, "megs: %d\n", bx_options.memory.Osize->get ());
|
fprintf (fp, "megs: %d\n", SIM->get_param_num(BXPN_MEM_SIZE)->get());
|
||||||
if (strlen (bx_options.rom.Opath->getptr ()) > 0)
|
strptr = SIM->get_param_string(BXPN_ROM_PATH)->getptr();
|
||||||
fprintf (fp, "romimage: file=\"%s\", address=0x%05x\n", bx_options.rom.Opath->getptr(), (unsigned int)bx_options.rom.Oaddress->get ());
|
if (strlen(strptr) > 0)
|
||||||
|
fprintf (fp, "romimage: file=\"%s\", address=0x%05x\n", strptr, (unsigned int)SIM->get_param_num(BXPN_ROM_ADDRESS)->get());
|
||||||
else
|
else
|
||||||
fprintf (fp, "# no romimage\n");
|
fprintf (fp, "# no romimage\n");
|
||||||
if (strlen (bx_options.vgarom.Opath->getptr ()) > 0)
|
strptr = SIM->get_param_string(BXPN_VGA_ROM_PATH)->getptr();
|
||||||
fprintf (fp, "vgaromimage: file=\"%s\"\n", bx_options.vgarom.Opath->getptr ());
|
if (strlen(strptr) > 0)
|
||||||
|
fprintf (fp, "vgaromimage: file=\"%s\"\n", strptr);
|
||||||
else
|
else
|
||||||
fprintf (fp, "# no vgaromimage\n");
|
fprintf (fp, "# no vgaromimage\n");
|
||||||
fprintf (fp, "boot: %s", bx_options.Obootdrive[0]->get_choice(bx_options.Obootdrive[0]->get() - 1));
|
fprintf (fp, "boot: %s", bx_options.Obootdrive[0]->get_choice(bx_options.Obootdrive[0]->get() - 1));
|
||||||
|
@ -3663,14 +3675,20 @@ int bx_write_configuration (char *rc, int overwrite)
|
||||||
bx_write_atadevice_options (fp, channel, 1, &bx_options.atadevice[channel][1]);
|
bx_write_atadevice_options (fp, channel, 1, &bx_options.atadevice[channel][1]);
|
||||||
}
|
}
|
||||||
for (i=0; i<BX_N_OPTROM_IMAGES; i++) {
|
for (i=0; i<BX_N_OPTROM_IMAGES; i++) {
|
||||||
if (strlen (bx_options.optrom[i].Opath->getptr ()) > 0)
|
sprintf(tmppath, "memory.optrom.%d.path", i+1);
|
||||||
fprintf (fp, "optromimage%d: file=\"%s\", address=0x%05x\n", i+1, bx_options.optrom[i].Opath->getptr(),
|
sprintf(tmpaddr, "memory.optrom.%d.addr", i+1);
|
||||||
(unsigned int)bx_options.optrom[i].Oaddress->get ());
|
strptr = SIM->get_param_string(tmppath)->getptr();
|
||||||
|
if (strlen(strptr) > 0)
|
||||||
|
fprintf(fp, "optromimage%d: file=\"%s\", address=0x%05x\n", i+1, strptr,
|
||||||
|
(unsigned int)SIM->get_param_num(tmpaddr)->get());
|
||||||
}
|
}
|
||||||
for (i=0; i<BX_N_OPTRAM_IMAGES; i++) {
|
for (i=0; i<BX_N_OPTRAM_IMAGES; i++) {
|
||||||
if (strlen (bx_options.optram[i].Opath->getptr ()) > 0)
|
sprintf(tmppath, "memory.optram.%d.path", i+1);
|
||||||
fprintf (fp, "optramimage%d: file=\"%s\", address=0x%05x\n", i+1, bx_options.optram[i].Opath->getptr(),
|
sprintf(tmpaddr, "memory.optram.%d.addr", i+1);
|
||||||
(unsigned int)bx_options.optram[i].Oaddress->get ());
|
strptr = SIM->get_param_string(tmppath)->getptr();
|
||||||
|
if (strlen(strptr) > 0)
|
||||||
|
fprintf(fp, "optramimage%d: file=\"%s\", address=0x%05x\n", i+1, strptr,
|
||||||
|
(unsigned int)SIM->get_param_num(tmpaddr)->get());
|
||||||
}
|
}
|
||||||
// parallel ports
|
// parallel ports
|
||||||
for (i=0; i<BX_N_PARALLEL_PORTS; i++) {
|
for (i=0; i<BX_N_PARALLEL_PORTS; i++) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: siminterface.h,v 1.155 2006-02-16 21:44:17 vruppert Exp $
|
// $Id: siminterface.h,v 1.156 2006-02-17 22:27:38 vruppert Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Intro to siminterface by Bryce Denney:
|
// Intro to siminterface by Bryce Denney:
|
||||||
|
@ -81,7 +81,6 @@
|
||||||
// between the siminterface and the CI. Search for "event structures" below.
|
// between the siminterface and the CI. Search for "event structures" below.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
// BX_USE_TEXTCONFIG should be set to 1 when the text mode configuration interface
|
// BX_USE_TEXTCONFIG should be set to 1 when the text mode configuration interface
|
||||||
// is compiled in. This gives each type of parameter a text_print and text_ask
|
// is compiled in. This gives each type of parameter a text_print and text_ask
|
||||||
|
@ -117,6 +116,30 @@ typedef enum {
|
||||||
BXT_LIST
|
BXT_LIST
|
||||||
} bx_objtype;
|
} bx_objtype;
|
||||||
|
|
||||||
|
// define parameter path names. These names give the location in the
|
||||||
|
// parameter tree where each can be found. The names correspond to
|
||||||
|
// the old BXP_* enum values, which have been eliminated.
|
||||||
|
#define BXPN_MEM_SIZE "memory.standard.ram.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"
|
||||||
|
#define BXPN_OPTROM1_PATH "memory.optrom.1.path"
|
||||||
|
#define BXPN_OPTROM1_ADDRESS "memory.optrom.1.addr"
|
||||||
|
#define BXPN_OPTROM2_PATH "memory.optrom.2.path"
|
||||||
|
#define BXPN_OPTROM2_ADDRESS "memory.optrom.2.addr"
|
||||||
|
#define BXPN_OPTROM3_PATH "memory.optrom.3.path"
|
||||||
|
#define BXPN_OPTROM3_ADDRESS "memory.optrom.3.addr"
|
||||||
|
#define BXPN_OPTROM4_PATH "memory.optrom.4.path"
|
||||||
|
#define BXPN_OPTROM4_ADDRESS "memory.optrom.4.addr"
|
||||||
|
#define BXPN_OPTRAM1_PATH "memory.optram.1.path"
|
||||||
|
#define BXPN_OPTRAM1_ADDRESS "memory.optram.1.addr"
|
||||||
|
#define BXPN_OPTRAM2_PATH "memory.optram.2.path"
|
||||||
|
#define BXPN_OPTRAM2_ADDRESS "memory.optram.2.addr"
|
||||||
|
#define BXPN_OPTRAM3_PATH "memory.optram.3.path"
|
||||||
|
#define BXPN_OPTRAM3_ADDRESS "memory.optram.3.addr"
|
||||||
|
#define BXPN_OPTRAM4_PATH "memory.optram.4.path"
|
||||||
|
#define BXPN_OPTRAM4_ADDRESS "memory.optram.4.addr"
|
||||||
|
|
||||||
// list if parameter id values. The actual values are not important;
|
// list if parameter id values. The actual values are not important;
|
||||||
// it's only important that they all be different from each other.
|
// it's only important that they all be different from each other.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: main.cc,v 1.310 2006-02-16 21:44:16 vruppert Exp $
|
// $Id: main.cc,v 1.311 2006-02-17 22:27:38 vruppert Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||||
|
@ -891,12 +891,12 @@ int bx_init_hardware()
|
||||||
BX_SUPPORT_CLGD54XX?"cirrus":""));
|
BX_SUPPORT_CLGD54XX?"cirrus":""));
|
||||||
|
|
||||||
// Check if there is a romimage
|
// Check if there is a romimage
|
||||||
if (strcmp(bx_options.rom.Opath->getptr(),"") == 0) {
|
if (strcmp(SIM->get_param_string(BXPN_ROM_PATH)->getptr(),"") == 0) {
|
||||||
BX_ERROR(("No romimage to load. Is your bochsrc file loaded/valid ?"));
|
BX_ERROR(("No romimage to load. Is your bochsrc file loaded/valid ?"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up memory and CPU objects
|
// set up memory and CPU objects
|
||||||
bx_param_num_c *bxp_memsize = SIM->get_param_num("memory.standard.ram.size");
|
bx_param_num_c *bxp_memsize = SIM->get_param_num(BXPN_MEM_SIZE);
|
||||||
Bit32u memSize = bxp_memsize->get() * 1024*1024;
|
Bit32u memSize = bxp_memsize->get() * 1024*1024;
|
||||||
|
|
||||||
#if BX_SUPPORT_ICACHE
|
#if BX_SUPPORT_ICACHE
|
||||||
|
@ -906,28 +906,29 @@ int bx_init_hardware()
|
||||||
BX_MEM(0)->init_memory(memSize);
|
BX_MEM(0)->init_memory(memSize);
|
||||||
|
|
||||||
// First load the BIOS and VGABIOS
|
// First load the BIOS and VGABIOS
|
||||||
BX_MEM(0)->load_ROM(bx_options.rom.Opath->getptr(), bx_options.rom.Oaddress->get(), 0);
|
BX_MEM(0)->load_ROM(SIM->get_param_string(BXPN_ROM_PATH)->getptr(),
|
||||||
BX_MEM(0)->load_ROM(bx_options.vgarom.Opath->getptr(), 0xc0000, 1);
|
SIM->get_param_num(BXPN_ROM_ADDRESS)->get(), 0);
|
||||||
|
BX_MEM(0)->load_ROM(SIM->get_param_string(BXPN_VGA_ROM_PATH)->getptr(), 0xc0000, 1);
|
||||||
|
|
||||||
// Then load the optional ROM images
|
// Then load the optional ROM images
|
||||||
if (strcmp(bx_options.optrom[0].Opath->getptr(), "") !=0)
|
if (strcmp(SIM->get_param_string(BXPN_OPTROM1_PATH)->getptr(), "") !=0)
|
||||||
BX_MEM(0)->load_ROM(bx_options.optrom[0].Opath->getptr(), bx_options.optrom[0].Oaddress->get(), 2);
|
BX_MEM(0)->load_ROM(SIM->get_param_string(BXPN_OPTROM1_PATH)->getptr(), SIM->get_param_num(BXPN_OPTROM1_ADDRESS)->get(), 2);
|
||||||
if (strcmp(bx_options.optrom[1].Opath->getptr(), "") !=0 )
|
if (strcmp(SIM->get_param_string(BXPN_OPTROM2_PATH)->getptr(), "") !=0)
|
||||||
BX_MEM(0)->load_ROM(bx_options.optrom[1].Opath->getptr(), bx_options.optrom[1].Oaddress->get(), 2);
|
BX_MEM(0)->load_ROM(SIM->get_param_string(BXPN_OPTROM2_PATH)->getptr(), SIM->get_param_num(BXPN_OPTROM2_ADDRESS)->get(), 2);
|
||||||
if (strcmp(bx_options.optrom[2].Opath->getptr(), "") !=0)
|
if (strcmp(SIM->get_param_string(BXPN_OPTROM3_PATH)->getptr(), "") !=0)
|
||||||
BX_MEM(0)->load_ROM(bx_options.optrom[2].Opath->getptr(), bx_options.optrom[2].Oaddress->get(), 2);
|
BX_MEM(0)->load_ROM(SIM->get_param_string(BXPN_OPTROM3_PATH)->getptr(), SIM->get_param_num(BXPN_OPTROM3_ADDRESS)->get(), 2);
|
||||||
if (strcmp(bx_options.optrom[3].Opath->getptr(), "") !=0)
|
if (strcmp(SIM->get_param_string(BXPN_OPTROM4_PATH)->getptr(), "") !=0)
|
||||||
BX_MEM(0)->load_ROM(bx_options.optrom[3].Opath->getptr(), bx_options.optrom[3].Oaddress->get(), 2);
|
BX_MEM(0)->load_ROM(SIM->get_param_string(BXPN_OPTROM4_PATH)->getptr(), SIM->get_param_num(BXPN_OPTROM4_ADDRESS)->get(), 2);
|
||||||
|
|
||||||
// Then load the optional RAM images
|
// Then load the optional RAM images
|
||||||
if (strcmp(bx_options.optram[0].Opath->getptr(), "") !=0)
|
if (strcmp(SIM->get_param_string(BXPN_OPTRAM1_PATH)->getptr(), "") !=0)
|
||||||
BX_MEM(0)->load_RAM(bx_options.optram[0].Opath->getptr(), bx_options.optram[0].Oaddress->get(), 2);
|
BX_MEM(0)->load_RAM(SIM->get_param_string(BXPN_OPTRAM1_PATH)->getptr(), SIM->get_param_num(BXPN_OPTRAM1_ADDRESS)->get(), 2);
|
||||||
if (strcmp(bx_options.optram[1].Opath->getptr(), "") !=0)
|
if (strcmp(SIM->get_param_string(BXPN_OPTRAM2_PATH)->getptr(), "") !=0)
|
||||||
BX_MEM(0)->load_RAM(bx_options.optram[1].Opath->getptr(), bx_options.optram[1].Oaddress->get(), 2);
|
BX_MEM(0)->load_RAM(SIM->get_param_string(BXPN_OPTRAM2_PATH)->getptr(), SIM->get_param_num(BXPN_OPTRAM2_ADDRESS)->get(), 2);
|
||||||
if (strcmp(bx_options.optram[2].Opath->getptr(), "") !=0)
|
if (strcmp(SIM->get_param_string(BXPN_OPTRAM3_PATH)->getptr(), "") !=0)
|
||||||
BX_MEM(0)->load_RAM(bx_options.optram[2].Opath->getptr(), bx_options.optram[2].Oaddress->get(), 2);
|
BX_MEM(0)->load_RAM(SIM->get_param_string(BXPN_OPTRAM3_PATH)->getptr(), SIM->get_param_num(BXPN_OPTRAM3_ADDRESS)->get(), 2);
|
||||||
if (strcmp(bx_options.optram[3].Opath->getptr(), "") !=0)
|
if (strcmp(SIM->get_param_string(BXPN_OPTRAM4_PATH)->getptr(), "") !=0)
|
||||||
BX_MEM(0)->load_RAM(bx_options.optram[3].Opath->getptr(), bx_options.optram[3].Oaddress->get(), 2);
|
BX_MEM(0)->load_RAM(SIM->get_param_string(BXPN_OPTRAM4_PATH)->getptr(), SIM->get_param_num(BXPN_OPTRAM4_ADDRESS)->get(), 2);
|
||||||
|
|
||||||
#if BX_SUPPORT_SMP == 0
|
#if BX_SUPPORT_SMP == 0
|
||||||
BX_CPU(0)->initialize(BX_MEM(0));
|
BX_CPU(0)->initialize(BX_MEM(0));
|
||||||
|
|
Loading…
Reference in New Issue