Fixed ROM checksum code: added missing check for the upper 64k of Bochs BIOS.

This commit is contained in:
Volker Ruppert 2020-11-30 18:08:29 +00:00
parent 87d660e652
commit 6d55094650

View File

@ -505,10 +505,15 @@ void BX_MEM_C::load_ROM(const char *path, bx_phy_address romaddress, Bit8u type)
}
close(fd);
offset -= (unsigned long)stat_buf.st_size;
if (((romaddress & 0xfffff) != 0xe0000) ||
size = (unsigned long)stat_buf.st_size;
if (is_bochs_bios ||
((BX_MEM_THIS rom[offset] == 0x55) && (BX_MEM_THIS rom[offset+1] == 0xaa))) {
if ((type == 0) && ((romaddress & 0xfffff) == 0xe0000)) {
offset += 0x10000;
size = 0x10000;
}
Bit8u checksum = 0;
for (i = 0; i < stat_buf.st_size; i++) {
for (i = 0; i < (int)size; i++) {
checksum += BX_MEM_THIS rom[offset + i];
}
if (checksum != 0) {