- accept an optional rom image in the 0xe0000 area and load them into BIOS memory

This commit is contained in:
Volker Ruppert 2005-10-25 08:33:55 +00:00
parent d232d245f4
commit 9d3cbbdb76

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: misc_mem.cc,v 1.62 2005-10-12 17:11:44 vruppert Exp $
// $Id: misc_mem.cc,v 1.63 2005-10-25 08:33:55 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.62 2005-10-12 17:11:44 vruppert Exp $"));
BX_DEBUG(("Init $Id: misc_mem.cc,v 1.63 2005-10-25 08:33:55 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) ));
@ -210,14 +210,18 @@ void BX_MEM_C::load_ROM(const char *path, Bit32u romaddress, Bit8u type)
BX_PANIC(("ROM: ROM image must start at a 2k boundary"));
return;
}
if ((romaddress < 0xc0000) || (romaddress > 0xdffff)) {
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);
offset = (romaddress & EXROM_MASK) + BIOSROMSZ;
if (romaddress < 0xe0000) {
offset = (romaddress & EXROM_MASK) + BIOSROMSZ;
} else {
offset = romaddress & BIOS_MASK;
}
for (i = start_idx; i < end_idx; i++) {
if (BX_MEM_THIS rom_present[i]) {
close(fd);