- use a dynamicly allocated buffer for the PCI ROM instead of a static one

- set maximum PCI ROM size to 128k
This commit is contained in:
Volker Ruppert 2011-06-27 19:46:13 +00:00
parent f7c6bd1134
commit 9c1b043abb
2 changed files with 7 additions and 3 deletions

View File

@ -1210,7 +1210,7 @@ void bx_pci_device_stub_c::load_pci_rom(const char *path)
return;
}
max_size = 0x10000;
max_size = 0x20000;
size = (unsigned long)stat_buf.st_size;
if (size > max_size) {
close(fd);
@ -1226,6 +1226,7 @@ void bx_pci_device_stub_c::load_pci_rom(const char *path)
max_size >>= 1;
}
pci_rom_size = (max_size << 1);
pci_rom = new Bit8u[pci_rom_size];
while (size > 0) {
ret = read(fd, (bx_ptr_t) pci_rom, size);

View File

@ -86,7 +86,10 @@ class device_image_t;
// but it make serious problems for cirrus_svga device
class BOCHSAPI bx_pci_device_stub_c {
public:
virtual ~bx_pci_device_stub_c() {}
bx_pci_device_stub_c(): pci_rom(NULL), pci_rom_size(0) {}
virtual ~bx_pci_device_stub_c() {
if (pci_rom != NULL) delete [] pci_rom;
}
virtual Bit32u pci_read_handler(Bit8u address, unsigned io_len) {
return 0;
@ -101,7 +104,7 @@ public:
protected:
Bit8u pci_conf[256];
Bit32u pci_base_address[6];
Bit8u pci_rom[65536];
Bit8u *pci_rom;
Bit32u pci_rom_address;
Bit32u pci_rom_size;
};