- calculate BIOS ROM start address from image size if no address parameter is

used or address is set to 0.
This commit is contained in:
Volker Ruppert 2005-12-27 16:59:27 +00:00
parent 00eabeb2de
commit 28853fe54c
5 changed files with 33 additions and 19 deletions

View File

@ -72,12 +72,13 @@
# location of the BIOS.
# The usage of external large BIOS images (up to 512k) at memory top is
# now supported, but we still recommend to use the BIOS distributed with
# Bochs.
# Bochs. Now the start address can be calculated from image size.
#=======================================================================
romimage: file=$BXSHARE/BIOS-bochs-latest, address=0xf0000
#romimage: file=bios/BIOS-bochs-2-processors, address=0xf0000
#romimage: file=bios/BIOS-bochs-4-processors, address=0xf0000
#romimage: file=mybios.bin, address=0xfff80000 # 512k at memory top
#romimage: file=mybios.bin # calculate start address from image size
#=======================================================================
# MEGS

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: config.cc,v 1.65 2005-12-02 17:27:18 vruppert Exp $
// $Id: config.cc,v 1.66 2005-12-27 16:59:27 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -830,7 +830,7 @@ void bx_init_options ()
"memory.rom.addr",
"The address at which the ROM image should be loaded",
0, BX_MAX_BIT32U,
0xf0000);
0);
bx_options.rom.Oaddress->set_base (16);
#if BX_WITH_WX
bx_options.rom.Opath->set_label ("ROM BIOS image");
@ -2619,20 +2619,25 @@ static Bit32s parse_line_formatted(char *context, int num_params, char *params[]
}
bx_options.memory.Osize->set (atol(params[1]));
} else if (!strcmp(params[0], "romimage")) {
if (num_params != 3) {
if ((num_params < 2) || (num_params > 3)) {
PARSE_ERR(("%s: romimage directive: wrong # args.", context));
}
for (i=1; i<num_params; i++) {
if (!strncmp(params[i], "file=", 5)) {
bx_options.rom.Opath->set (&params[i][5]);
} else if (!strncmp(params[i], "address=", 8)) {
if ((params[i][8] == '0') && (params[2][9] == 'x'))
bx_options.rom.Oaddress->set (strtoul (&params[i][8], NULL, 16));
if (!strncmp(params[1], "file=", 5)) {
bx_options.rom.Opath->set (&params[1][5]);
} else {
PARSE_ERR(("%s: romimage directive malformed.", context));
}
if (num_params == 3) {
if (!strncmp(params[2], "address=", 8)) {
if ((params[2][8] == '0') && (params[2][9] == 'x'))
bx_options.rom.Oaddress->set (strtoul (&params[2][8], NULL, 16));
else
bx_options.rom.Oaddress->set (strtoul (&params[i][8], NULL, 10));
bx_options.rom.Oaddress->set (strtoul (&params[2][8], NULL, 10));
} else {
PARSE_ERR(("%s: romimage directive malformed.", context));
}
} else {
bx_options.rom.Oaddress->set (0);
}
} else if (!strcmp(params[0], "vgaromimage")) {
if (num_params != 2) {

View File

@ -1,7 +1,7 @@
<!--
================================================================
doc/docbook/user/user.dbk
$Id: user.dbk,v 1.190 2005-11-29 19:27:42 vruppert Exp $
$Id: user.dbk,v 1.191 2005-12-27 16:59:27 vruppert Exp $
This is the top level file for the Bochs Users Manual.
================================================================
@ -3043,6 +3043,7 @@ Example:
romimage: file=bios/BIOS-bochs-latest, address=0xf0000
romimage: file=$BXSHARE/BIOS-bochs-latest, address=0xf0000
romimage: file=mybios.bin, address=0xfff80000
romimage: file=mybios.bin
</screen>
The ROM BIOS controls what the PC does when it first powers on. Normally, you
can use a precompiled BIOS in the source or binary distribution called
@ -3051,6 +3052,7 @@ starting at address 0xf0000, and it is exactly 64k long.
You can also use the environment variable $BXSHARE to specify the location of the BIOS.
The usage of external large BIOS images (up to 512k) at memory top is
now supported, but we still recommend to use the BIOS distributed with Bochs.
Now the start address can be calculated from image size.
</para>
</section>

View File

@ -97,11 +97,13 @@ The ROM BIOS is usually loaded starting at address 0xf0000, and it is exactly 64
You can also use the environment variable $BXSHARE to specify the location of the BIOS.
The usage of external large BIOS images (up to 512k) at memory top is
now supported, but we still recommend to use the BIOS distributed with Bochs.
Now the start address can be calculated from image size.
Examples:
romimage: file=bios/BIOS-bochs-latest, address=0xf0000
romimage: file=$BXSHARE/BIOS-bochs-latest, address=0xf0000
romimage: file=mybios.bin, address=0xfff80000
romimage: file=mybios.bin
.TP
.I "megs:"

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: misc_mem.cc,v 1.69 2005-12-25 19:30:48 vruppert Exp $
// $Id: misc_mem.cc,v 1.70 2005-12-27 16:59:27 vruppert 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.69 2005-12-25 19:30:48 vruppert Exp $"));
BX_DEBUG(("Init $Id: misc_mem.cc,v 1.70 2005-12-27 16:59:27 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) ));
@ -234,13 +234,17 @@ void BX_MEM_C::load_ROM(const char *path, Bit32u romaddress, Bit8u type)
return;
}
if (type == 0) {
if ( (romaddress + size) != 0x100000 && (romaddress + size) ) {
close(fd);
BX_PANIC(("ROM: System BIOS must end at 0xfffff"));
return;
if (romaddress > 0) {
if ((romaddress + size) != 0x100000 && (romaddress + size)) {
close(fd);
BX_PANIC(("ROM: System BIOS must end at 0xfffff"));
return;
}
} else {
romaddress = (Bit32u)-size;
}
offset = romaddress & BIOS_MASK;
if (romaddress < 0xf0000 ) {
if ((romaddress & 0xf0000) < 0xf0000) {
BX_MEM_THIS rom_present[64] = 1;
}
is_bochs_bios = (strstr(path, "BIOS-bochs-latest") != NULL);