- rom address space check added to avoid overlapping rom images
- vgaromimage option now compatible with the other rom options. Old style syntax (without 'file=...") is still supported. - load order for the rom images fixed (system, vga, other) - rom images sizes not multiple 512 cause a BX_INFO for now. The original check will be enabled after updating the vgabios files - optromimage error messages fixed - some updates of the bochsrc sample
This commit is contained in:
parent
75006eed8a
commit
9a6a7ec2fd
@ -45,16 +45,20 @@
|
||||
#
|
||||
# NOTE: if you use the "wx" configuration interface, you must also use
|
||||
# the "wx" display library.
|
||||
#
|
||||
# Specific options:
|
||||
# Some display libraries now support specific option to control their
|
||||
# behaviour. See the examples below for currently supported options.
|
||||
#=======================================================================
|
||||
#display_library: amigaos
|
||||
#display_library: beos
|
||||
#display_library: carbon
|
||||
#display_library: macintosh
|
||||
#display_library: nogui
|
||||
#display_library: rfb
|
||||
#display_library: sdl
|
||||
#display_library: rfb, options="timeout=60" # time to wait for client
|
||||
#display_library: sdl, options="fullscreen" # startup in fullscreen mode
|
||||
#display_library: term
|
||||
#display_library: win32
|
||||
#display_library: win32, options="legacyF12" # use F12 to toggle mouse
|
||||
#display_library: wx
|
||||
#display_library: x
|
||||
|
||||
@ -105,9 +109,9 @@ megs: 32
|
||||
# VGAROMIMAGE
|
||||
# You now need to load a VGA ROM BIOS into C0000.
|
||||
#=======================================================================
|
||||
#vgaromimage: bios/VGABIOS-lgpl-latest
|
||||
#vgaromimage: bios/VGABIOS-elpin-2.40
|
||||
vgaromimage: $BXSHARE/VGABIOS-elpin-2.40
|
||||
#vgaromimage: file=bios/VGABIOS-lgpl-latest
|
||||
#vgaromimage: file=bios/VGABIOS-elpin-2.40
|
||||
vgaromimage: file=$BXSHARE/VGABIOS-elpin-2.40
|
||||
|
||||
#=======================================================================
|
||||
# FLOPPYA:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: config.cc,v 1.9 2004-08-01 19:17:18 vruppert Exp $
|
||||
// $Id: config.cc,v 1.10 2004-09-01 18:12:22 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -2797,7 +2797,7 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
PARSE_ERR(("%s: optromimage1 directive malformed.", context));
|
||||
}
|
||||
if (strncmp(params[2], "address=", 8)) {
|
||||
PARSE_ERR(("%s: optromimage2 directive malformed.", context));
|
||||
PARSE_ERR(("%s: optromimage1 directive malformed.", context));
|
||||
}
|
||||
bx_options.optrom[0].Opath->set (¶ms[1][5]);
|
||||
if ( (params[2][8] == '0') && (params[2][9] == 'x') )
|
||||
@ -2829,7 +2829,7 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
PARSE_ERR(("%s: optromimage3 directive malformed.", context));
|
||||
}
|
||||
if (strncmp(params[2], "address=", 8)) {
|
||||
PARSE_ERR(("%s: optromimage2 directive malformed.", context));
|
||||
PARSE_ERR(("%s: optromimage3 directive malformed.", context));
|
||||
}
|
||||
bx_options.optrom[2].Opath->set (¶ms[1][5]);
|
||||
if ( (params[2][8] == '0') && (params[2][9] == 'x') )
|
||||
@ -2845,7 +2845,7 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
PARSE_ERR(("%s: optromimage4 directive malformed.", context));
|
||||
}
|
||||
if (strncmp(params[2], "address=", 8)) {
|
||||
PARSE_ERR(("%s: optromimage2 directive malformed.", context));
|
||||
PARSE_ERR(("%s: optromimage4 directive malformed.", context));
|
||||
}
|
||||
bx_options.optrom[3].Opath->set (¶ms[1][5]);
|
||||
if ( (params[2][8] == '0') && (params[2][9] == 'x') )
|
||||
@ -2857,7 +2857,13 @@ parse_line_formatted(char *context, int num_params, char *params[])
|
||||
if (num_params != 2) {
|
||||
PARSE_ERR(("%s: vgaromimage directive: wrong # args.", context));
|
||||
}
|
||||
bx_options.vgarom.Opath->set (params[1]);
|
||||
if (!strncmp(params[1], "file=", 5)) {
|
||||
bx_options.vgarom.Opath->set (¶ms[1][5]);
|
||||
}
|
||||
else {
|
||||
BX_INFO(("WARNING: old-style syntax is deprecated, use 'vgaromimage: file=...' instead"));
|
||||
bx_options.vgarom.Opath->set (params[1]);
|
||||
}
|
||||
}
|
||||
else if (!strcmp(params[0], "vga_update_interval")) {
|
||||
if (num_params != 2) {
|
||||
@ -3664,7 +3670,7 @@ bx_write_configuration (char *rc, int overwrite)
|
||||
else
|
||||
fprintf (fp, "# no romimage\n");
|
||||
if (strlen (bx_options.vgarom.Opath->getptr ()) > 0)
|
||||
fprintf (fp, "vgaromimage: %s\n", bx_options.vgarom.Opath->getptr ());
|
||||
fprintf (fp, "vgaromimage: file=%s\n", bx_options.vgarom.Opath->getptr ());
|
||||
else
|
||||
fprintf (fp, "# no vgaromimage\n");
|
||||
int bootdrive = bx_options.Obootdrive->get ();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: main.cc,v 1.280 2004-08-06 15:49:52 vruppert Exp $
|
||||
// $Id: main.cc,v 1.281 2004-09-01 18:12:22 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -847,7 +847,11 @@ bx_init_hardware()
|
||||
#if BX_SMP_PROCESSORS==1
|
||||
BX_MEM(0)->init_memory(bx_options.memory.Osize->get () * 1024*1024);
|
||||
|
||||
// First load the optional ROM images
|
||||
// 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(bx_options.vgarom.Opath->getptr (), 0xc0000, 1);
|
||||
|
||||
// Then load the optional ROM images
|
||||
if (strcmp(bx_options.optrom[0].Opath->getptr (),"") !=0 )
|
||||
BX_MEM(0)->load_ROM(bx_options.optrom[0].Opath->getptr (), bx_options.optrom[0].Oaddress->get (), 2);
|
||||
if (strcmp(bx_options.optrom[1].Opath->getptr (),"") !=0 )
|
||||
@ -857,10 +861,6 @@ 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 BIOS and VGABIOS
|
||||
BX_MEM(0)->load_ROM(bx_options.rom.Opath->getptr (), bx_options.rom.Oaddress->get (), 0);
|
||||
BX_MEM(0)->load_ROM(bx_options.vgarom.Opath->getptr (), 0xc0000, 1);
|
||||
|
||||
BX_CPU(0)->init (BX_MEM(0));
|
||||
BX_CPU(0)->set_cpu_id(0);
|
||||
#if BX_SUPPORT_APIC
|
||||
@ -874,7 +874,11 @@ bx_init_hardware()
|
||||
bx_mem_array[0] = new BX_MEM_C ();
|
||||
bx_mem_array[0]->init_memory(bx_options.memory.Osize->get () * 1024*1024);
|
||||
|
||||
// First load the optional ROM images
|
||||
// First load the BIOS and VGABIOS
|
||||
bx_mem_array[0]->load_ROM(bx_options.rom.Opath->getptr (), bx_options.rom.Oaddress->get (), 0);
|
||||
bx_mem_array[0]->load_ROM(bx_options.vgarom.Opath->getptr (), 0xc0000, 1);
|
||||
|
||||
// Then load the optional ROM images
|
||||
if (strcmp(bx_options.optrom[0].Opath->getptr (),"") !=0 )
|
||||
bx_mem_array[0]->load_ROM(bx_options.optrom[0].Opath->getptr (), bx_options.optrom[0].Oaddress->get (), 2);
|
||||
if (strcmp(bx_options.optrom[1].Opath->getptr (),"") !=0 )
|
||||
@ -884,10 +888,6 @@ 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 BIOS and VGABIOS
|
||||
bx_mem_array[0]->load_ROM(bx_options.rom.Opath->getptr (), bx_options.rom.Oaddress->get (), 0);
|
||||
bx_mem_array[0]->load_ROM(bx_options.vgarom.Opath->getptr (), 0xc0000, 1);
|
||||
|
||||
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.20 2004-08-26 07:58:33 vruppert Exp $
|
||||
// $Id: memory.h,v 1.21 2004-09-01 18:12:23 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -58,6 +58,7 @@ class BOCHSAPI BX_MEM_C : public logfunctions {
|
||||
|
||||
private:
|
||||
struct memory_handler_struct **memory_handlers;
|
||||
bx_bool rom_present[65];
|
||||
|
||||
public:
|
||||
Bit8u *actual_vector;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: misc_mem.cc,v 1.48 2004-08-30 21:47:24 sshwarts Exp $
|
||||
// $Id: misc_mem.cc,v 1.49 2004-09-01 18:12:23 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -109,7 +109,9 @@ BX_MEM_C::~BX_MEM_C(void)
|
||||
void
|
||||
BX_MEM_C::init_memory(int memsize)
|
||||
{
|
||||
BX_DEBUG(("Init $Id: misc_mem.cc,v 1.48 2004-08-30 21:47:24 sshwarts Exp $"));
|
||||
int idx;
|
||||
|
||||
BX_DEBUG(("Init $Id: misc_mem.cc,v 1.49 2004-09-01 18:12:23 vruppert 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) ));
|
||||
@ -120,8 +122,10 @@ BX_MEM_C::init_memory(int memsize)
|
||||
BX_MEM_THIS len = memsize;
|
||||
BX_MEM_THIS megabytes = memsize / (1024*1024);
|
||||
BX_MEM_THIS memory_handlers = new struct memory_handler_struct *[1024 * 1024];
|
||||
for (int idx = 0; idx < 1024 * 1024; idx++)
|
||||
for (idx = 0; idx < 1024 * 1024; idx++)
|
||||
BX_MEM_THIS memory_handlers[idx] = NULL;
|
||||
for (idx = 0; idx < 65; idx++)
|
||||
BX_MEM_THIS rom_present[idx] = 0;
|
||||
BX_INFO(("%.2fMB", (float)(BX_MEM_THIS megabytes) ));
|
||||
}
|
||||
|
||||
@ -145,7 +149,7 @@ BX_MEM_C::init_memory(int memsize)
|
||||
BX_MEM_C::load_ROM(const char *path, Bit32u romaddress, Bit8u type)
|
||||
{
|
||||
struct stat stat_buf;
|
||||
int fd, ret;
|
||||
int fd, ret, i, start_idx, end_idx;
|
||||
unsigned long size, max_size, offset;
|
||||
|
||||
if (*path == '\0') {
|
||||
@ -187,7 +191,6 @@ BX_MEM_C::load_ROM(const char *path, Bit32u romaddress, Bit8u type)
|
||||
}
|
||||
|
||||
size = stat_buf.st_size;
|
||||
BX_INFO(("ROM image size is %ld ...", size));
|
||||
|
||||
if (type > 0) {
|
||||
max_size = 0x10000;
|
||||
@ -195,27 +198,49 @@ BX_MEM_C::load_ROM(const char *path, Bit32u romaddress, Bit8u type)
|
||||
max_size = 0x20000;
|
||||
}
|
||||
if (size > max_size) {
|
||||
close(fd);
|
||||
BX_PANIC(("ROM: ROM image too large"));
|
||||
return;
|
||||
}
|
||||
if (type == 0) {
|
||||
if ( (romaddress + size) != 0x100000 ) {
|
||||
close(fd);
|
||||
BX_PANIC(("ROM: System BIOS must end at 0xfffff"));
|
||||
return;
|
||||
}
|
||||
if (romaddress < 0xf0000 ) {
|
||||
BX_MEM_THIS rom_present[64] = 1;
|
||||
}
|
||||
} else {
|
||||
// if ((size % 512) != 0) {
|
||||
// BX_PANIC(("ROM: ROM image size must be multiple of 512"));
|
||||
// This check will be enabled after an update of the vgabios files
|
||||
if ((size % 512) != 0) {
|
||||
// close(fd);
|
||||
// BX_PANIC(("ROM: ROM image size must be multiple of 512 (size = %ld)", size));
|
||||
// return;
|
||||
// }
|
||||
BX_INFO(("ROM: ROM image size must be multiple of 512 (size = %ld)", size));
|
||||
}
|
||||
if ((romaddress % 2048) != 0) {
|
||||
close(fd);
|
||||
BX_PANIC(("ROM: ROM image must start at a 2k boundary"));
|
||||
return;
|
||||
}
|
||||
if ((romaddress < 0xc0000) || ((romaddress + size) > 0xf0000)) {
|
||||
if ((romaddress < 0xc0000) || (romaddress > 0xe0000)) {
|
||||
close(fd);
|
||||
BX_PANIC(("ROM: ROM address space out of range"));
|
||||
return;
|
||||
}
|
||||
start_idx = ((romaddress - 0xc0000) >> 11);
|
||||
end_idx = start_idx + (size >> 11) + (((size % 2048) > 0) ? 1 : 0);
|
||||
if (end_idx > 65) end_idx = 65;
|
||||
for (i = start_idx; i < end_idx; i++) {
|
||||
if (BX_MEM_THIS rom_present[i]) {
|
||||
close(fd);
|
||||
BX_PANIC(("ROM: address space already in use"));
|
||||
return;
|
||||
} else {
|
||||
BX_MEM_THIS rom_present[i] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
offset = 0;
|
||||
while (size > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user