Added optramimage directive for .bochsrc files, with same syntax as
optromimage. You can load up to 4 arbitrary binary images into RAM. I didn't do any checking on the addresses, so it's up to you to make sure they don't collide with anything else. Should only be used for placing files into standard RAM.
This commit is contained in:
parent
9bdad86d77
commit
641650e7e1
@ -108,6 +108,11 @@ megs: 32
|
||||
#optromimage3: file=optionalrom.bin, address=0xd2000
|
||||
#optromimage4: file=optionalrom.bin, address=0xd3000
|
||||
|
||||
#optramimage1: file=/path/file1.img, address=0x0010000
|
||||
#optramimage2: file=/path/file2.img, address=0x0020000
|
||||
#optramimage3: file=/path/file3.img, address=0x0030000
|
||||
#optramimage4: file=/path/file4.img, address=0x0040000
|
||||
|
||||
#=======================================================================
|
||||
# VGAROMIMAGE
|
||||
# You now need to load a VGA ROM BIOS into C0000.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: bochs.h,v 1.160 2005-10-13 16:22:21 sshwarts Exp $
|
||||
// $Id: bochs.h,v 1.161 2005-10-28 00:12:26 kevinlawton Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -630,6 +630,7 @@ typedef struct BOCHSAPI {
|
||||
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_OPTROM_IMAGES]; // Optional ram images
|
||||
bx_mem_options memory;
|
||||
bx_parport_options par[BX_N_PARALLEL_PORTS]; // parallel ports
|
||||
bx_sb16_options sb16;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: config.cc,v 1.50 2005-10-22 08:07:53 vruppert Exp $
|
||||
// $Id: config.cc,v 1.51 2005-10-28 00:12:26 kevinlawton Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -880,6 +880,36 @@ void bx_init_options ()
|
||||
#endif
|
||||
}
|
||||
|
||||
for (i=0; i<4; i++) {
|
||||
sprintf (name, "memory.optram.%d.path", i+1);
|
||||
sprintf (descr, "Pathname of optional ROM image #%d to load", i+1);
|
||||
bx_options.optram[i].Opath = new bx_param_filename_c ((bx_id)(BXP_OPTRAM1_PATH+i),
|
||||
strdup(name),
|
||||
strdup(descr),
|
||||
"", BX_PATHNAME_LEN);
|
||||
sprintf (label, "Name of optional ROM image #%d", i+1);
|
||||
strcat(label, " : %s");
|
||||
bx_options.optram[i].Opath->set_format (strdup(label));
|
||||
sprintf (name, "memory.optram.%d.address", i+1);
|
||||
sprintf (descr, "The address at which the optional ROM image #%d should be loaded", i+1);
|
||||
bx_options.optram[i].Oaddress = new bx_param_num_c ((bx_id)(BXP_OPTRAM1_ADDRESS+i),
|
||||
strdup(name),
|
||||
strdup(descr),
|
||||
0, BX_MAX_BIT32U,
|
||||
0);
|
||||
bx_options.optram[i].Oaddress->set_base (16);
|
||||
#if BX_WITH_WX
|
||||
sprintf (label, "Optional ROM image #%d", i+1);
|
||||
bx_options.optram[i].Opath->set_label (strdup(label));
|
||||
bx_options.optram[i].Oaddress->set_label ("Address");
|
||||
bx_options.optram[i].Oaddress->set_format ("0x%05x");
|
||||
#else
|
||||
sprintf (label, "Optional ROM #%d address:", i+1);
|
||||
strcat(label, " 0x%05x");
|
||||
bx_options.optram[i].Oaddress->set_format (strdup(label));
|
||||
#endif
|
||||
}
|
||||
|
||||
bx_param_c *memory_init_list[] = {
|
||||
bx_options.memory.Osize,
|
||||
bx_options.rom.Opath,
|
||||
@ -893,6 +923,14 @@ void bx_init_options ()
|
||||
bx_options.optrom[2].Oaddress,
|
||||
bx_options.optrom[3].Opath,
|
||||
bx_options.optrom[3].Oaddress,
|
||||
bx_options.optram[0].Opath,
|
||||
bx_options.optram[0].Oaddress,
|
||||
bx_options.optram[1].Opath,
|
||||
bx_options.optram[1].Oaddress,
|
||||
bx_options.optram[2].Opath,
|
||||
bx_options.optram[2].Oaddress,
|
||||
bx_options.optram[3].Opath,
|
||||
bx_options.optram[3].Oaddress,
|
||||
NULL
|
||||
};
|
||||
menu = new bx_list_c (BXP_MENU_MEMORY, "Bochs Memory Options", "memmenu", memory_init_list);
|
||||
@ -1734,6 +1772,14 @@ void bx_reset_options ()
|
||||
bx_options.optrom[2].Oaddress->reset();
|
||||
bx_options.optrom[3].Opath->reset();
|
||||
bx_options.optrom[3].Oaddress->reset();
|
||||
bx_options.optram[0].Opath->reset();
|
||||
bx_options.optram[0].Oaddress->reset();
|
||||
bx_options.optram[1].Opath->reset();
|
||||
bx_options.optram[1].Oaddress->reset();
|
||||
bx_options.optram[2].Opath->reset();
|
||||
bx_options.optram[2].Oaddress->reset();
|
||||
bx_options.optram[3].Opath->reset();
|
||||
bx_options.optram[3].Oaddress->reset();
|
||||
|
||||
// standard ports
|
||||
for (i=0; i<BX_N_SERIAL_PORTS; i++) {
|
||||
@ -2638,6 +2684,26 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
PARSE_ERR(("%s: optromimage%d directive malformed.", context, num));
|
||||
}
|
||||
}
|
||||
} else if (!strncmp(params[0], "optramimage", 11)) {
|
||||
int num = atoi(¶ms[0][11]);
|
||||
if ((num < 1) || (num > 4)) {
|
||||
PARSE_ERR(("%s: ramimage%d: not supported", context, num));
|
||||
}
|
||||
if (num_params != 3) {
|
||||
PARSE_ERR(("%s: ramimage%d directive: wrong # args.", context, num));
|
||||
}
|
||||
for (i=1; i<num_params; i++) {
|
||||
if (!strncmp(params[i], "file=", 5)) {
|
||||
bx_options.optram[num-1].Opath->set (¶ms[i][5]);
|
||||
} else if (!strncmp(params[i], "address=", 8)) {
|
||||
if ((params[i][8] == '0') && (params[2][9] == 'x'))
|
||||
bx_options.optram[num-1].Oaddress->set (strtoul (¶ms[i][8], NULL, 16));
|
||||
else
|
||||
bx_options.optram[num-1].Oaddress->set (strtoul (¶ms[i][8], NULL, 10));
|
||||
} else {
|
||||
PARSE_ERR(("%s: optram%d directive malformed.", context, num));
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(params[0], "vga_update_interval")) {
|
||||
if (num_params != 2) {
|
||||
PARSE_ERR(("%s: vga_update_interval directive: wrong # args.", context));
|
||||
@ -3574,6 +3640,11 @@ bx_write_configuration (char *rc, int overwrite)
|
||||
fprintf (fp, "optromimage%d: file=\"%s\", address=0x%05x\n", i+1, bx_options.optrom[i].Opath->getptr(),
|
||||
(unsigned int)bx_options.optrom[i].Oaddress->get ());
|
||||
}
|
||||
for (i=0; i<4; i++) {
|
||||
if (strlen (bx_options.optram[i].Opath->getptr ()) > 0)
|
||||
fprintf (fp, "optramimage%d: file=\"%s\", address=0x%05x\n", i+1, bx_options.optram[i].Opath->getptr(),
|
||||
(unsigned int)bx_options.optram[i].Oaddress->get ());
|
||||
}
|
||||
// parallel ports
|
||||
for (i=0; i<BX_N_PARALLEL_PORTS; i++) {
|
||||
bx_write_parport_options (fp, &bx_options.par[i], i+1);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: siminterface.h,v 1.144 2005-10-15 10:43:55 vruppert Exp $
|
||||
// $Id: siminterface.h,v 1.145 2005-10-28 00:12:27 kevinlawton Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Intro to siminterface by Bryce Denney:
|
||||
@ -141,6 +141,14 @@ typedef enum {
|
||||
BXP_OPTROM3_ADDRESS,
|
||||
BXP_OPTROM4_ADDRESS,
|
||||
BXP_OPTROM_LIST,
|
||||
BXP_OPTRAM1_PATH,
|
||||
BXP_OPTRAM2_PATH,
|
||||
BXP_OPTRAM3_PATH,
|
||||
BXP_OPTRAM4_PATH,
|
||||
BXP_OPTRAM1_ADDRESS,
|
||||
BXP_OPTRAM2_ADDRESS,
|
||||
BXP_OPTRAM3_ADDRESS,
|
||||
BXP_OPTRAM4_ADDRESS,
|
||||
BXP_KBD_SERIAL_DELAY,
|
||||
BXP_KBD_PASTE_DELAY,
|
||||
BXP_KBD_TYPE,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: main.cc,v 1.296 2005-10-17 14:48:43 sshwarts Exp $
|
||||
// $Id: main.cc,v 1.297 2005-10-28 00:12:26 kevinlawton Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -868,6 +868,16 @@ int bx_init_hardware()
|
||||
if (strcmp(bx_options.optrom[3].Opath->getptr (),"") !=0 )
|
||||
BX_MEM(0)->load_ROM(bx_options.optrom[3].Opath->getptr (), bx_options.optrom[3].Oaddress->get (), 2);
|
||||
|
||||
// Then load the optional RAM images
|
||||
if (strcmp(bx_options.optram[0].Opath->getptr (),"") !=0 )
|
||||
BX_MEM(0)->load_RAM(bx_options.optram[0].Opath->getptr (), bx_options.optram[0].Oaddress->get (), 2);
|
||||
if (strcmp(bx_options.optram[1].Opath->getptr (),"") !=0 )
|
||||
BX_MEM(0)->load_RAM(bx_options.optram[1].Opath->getptr (), bx_options.optram[1].Oaddress->get (), 2);
|
||||
if (strcmp(bx_options.optram[2].Opath->getptr (),"") !=0 )
|
||||
BX_MEM(0)->load_RAM(bx_options.optram[2].Opath->getptr (), bx_options.optram[2].Oaddress->get (), 2);
|
||||
if (strcmp(bx_options.optram[3].Opath->getptr (),"") !=0 )
|
||||
BX_MEM(0)->load_RAM(bx_options.optram[3].Opath->getptr (), bx_options.optram[3].Oaddress->get (), 2);
|
||||
|
||||
BX_CPU(0)->init (BX_MEM(0));
|
||||
BX_CPU(0)->set_cpu_id(0);
|
||||
#if BX_SUPPORT_APIC
|
||||
@ -895,6 +905,16 @@ int bx_init_hardware()
|
||||
if (strcmp(bx_options.optrom[3].Opath->getptr (),"") !=0 )
|
||||
bx_mem_array[0]->load_ROM(bx_options.optrom[3].Opath->getptr (), bx_options.optrom[3].Oaddress->get (), 2);
|
||||
|
||||
// Then load the optional RAM images
|
||||
if (strcmp(bx_options.optram[0].Opath->getptr (),"") !=0 )
|
||||
BX_MEM(0)->load_RAM(bx_options.optram[0].Opath->getptr (), bx_options.optram[0].Oaddress->get (), 2);
|
||||
if (strcmp(bx_options.optram[1].Opath->getptr (),"") !=0 )
|
||||
BX_MEM(0)->load_RAM(bx_options.optram[1].Opath->getptr (), bx_options.optram[1].Oaddress->get (), 2);
|
||||
if (strcmp(bx_options.optram[2].Opath->getptr (),"") !=0 )
|
||||
BX_MEM(0)->load_RAM(bx_options.optram[2].Opath->getptr (), bx_options.optram[2].Oaddress->get (), 2);
|
||||
if (strcmp(bx_options.optram[3].Opath->getptr (),"") !=0 )
|
||||
BX_MEM(0)->load_RAM(bx_options.optram[3].Opath->getptr (), bx_options.optram[3].Oaddress->get (), 2);
|
||||
|
||||
for (int i=0; i<BX_SMP_PROCESSORS; i++) {
|
||||
BX_CPU(i) = new BX_CPU_C;
|
||||
BX_CPU(i)->init (bx_mem_array[0]);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: memory.h,v 1.25 2005-10-12 17:11:44 vruppert Exp $
|
||||
// $Id: memory.h,v 1.26 2005-10-28 00:12:27 kevinlawton Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -87,6 +87,7 @@ public:
|
||||
BX_MEM_SMF void writePhysicalPage(BX_CPU_C *cpu, Bit32u addr,
|
||||
unsigned len, void *data) BX_CPP_AttrRegparmN(3);
|
||||
BX_MEM_SMF void load_ROM(const char *path, Bit32u romaddress, Bit8u type);
|
||||
BX_MEM_SMF void load_RAM(const char *path, Bit32u romaddress, Bit8u type);
|
||||
BX_MEM_SMF Bit32u get_memory_in_k(void);
|
||||
BX_MEM_SMF bx_bool dbg_fetch_mem(Bit32u addr, unsigned len, Bit8u *buf);
|
||||
BX_MEM_SMF bx_bool dbg_set_mem(Bit32u addr, unsigned len, Bit8u *buf);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: misc_mem.cc,v 1.64 2005-10-25 19:12:54 vruppert Exp $
|
||||
// $Id: misc_mem.cc,v 1.65 2005-10-28 00:12:27 kevinlawton Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -95,7 +95,7 @@ void BX_MEM_C::init_memory(int memsize)
|
||||
{
|
||||
int idx;
|
||||
|
||||
BX_DEBUG(("Init $Id: misc_mem.cc,v 1.64 2005-10-25 19:12:54 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: misc_mem.cc,v 1.65 2005-10-28 00:12:27 kevinlawton Exp $"));
|
||||
// you can pass 0 if memory has been allocated already through
|
||||
// the constructor, or the desired size of memory if it hasn't
|
||||
// BX_INFO(("%.2fMB", (float)(BX_MEM_THIS megabytes) ));
|
||||
@ -261,6 +261,50 @@ void BX_MEM_C::load_ROM(const char *path, Bit32u romaddress, Bit8u type)
|
||||
(unsigned) stat_buf.st_size,
|
||||
path));
|
||||
}
|
||||
|
||||
void BX_MEM_C::load_RAM(const char *path, Bit32u ramaddress, Bit8u type)
|
||||
{
|
||||
struct stat stat_buf;
|
||||
int fd, ret, i, start_idx, end_idx;
|
||||
unsigned long size, max_size, offset;
|
||||
|
||||
if (*path == '\0') {
|
||||
BX_PANIC(( "RAM: Optional RAM image undefined"));
|
||||
return;
|
||||
}
|
||||
// read in RAM BIOS image file
|
||||
fd = open(path, O_RDONLY
|
||||
#ifdef O_BINARY
|
||||
| O_BINARY
|
||||
#endif
|
||||
);
|
||||
if (fd < 0) {
|
||||
BX_PANIC(( "RAM: couldn't open RAM image file '%s'.", path));
|
||||
return;
|
||||
}
|
||||
ret = fstat(fd, &stat_buf);
|
||||
if (ret) {
|
||||
BX_PANIC(( "RAM: couldn't stat RAM image file '%s'.", path));
|
||||
return;
|
||||
}
|
||||
|
||||
size = (unsigned long)stat_buf.st_size;
|
||||
|
||||
offset = ramaddress;
|
||||
while (size > 0) {
|
||||
ret = read(fd, (bx_ptr_t) &BX_MEM_THIS vector[offset], size);
|
||||
if (ret <= 0) {
|
||||
BX_PANIC(( "RAM: read failed on BIOS image: '%s'",path));
|
||||
}
|
||||
size -= ret;
|
||||
offset += ret;
|
||||
}
|
||||
close(fd);
|
||||
BX_INFO(("ram at 0x%05x/%u ('%s')",
|
||||
(unsigned) ramaddress,
|
||||
(unsigned) stat_buf.st_size,
|
||||
path));
|
||||
}
|
||||
#endif // #if BX_PROVIDE_CPU_MEMORY
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user