mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-07-05 13:28:56 +00:00
Load bootrom code to primary ROM region.
This commit is contained in:
parent
bb0ca2ac40
commit
89e79d05cb
@ -48,7 +48,7 @@ AddressMapEntry* MemCtrlBase::find_range(uint32_t addr) {
|
|||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -146,3 +146,14 @@ bool MemCtrlBase::add_mmio_region(uint32_t start_addr, uint32_t size, MMIODevice
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AddressMapEntry* MemCtrlBase::find_rom_region()
|
||||||
|
{
|
||||||
|
for (auto& entry : address_map) {
|
||||||
|
if (entry->type == RT_ROM) {
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
@ -60,6 +60,7 @@ public:
|
|||||||
virtual bool set_data(uint32_t reg_addr, const uint8_t* data, uint32_t size);
|
virtual bool set_data(uint32_t reg_addr, const uint8_t* data, uint32_t size);
|
||||||
|
|
||||||
AddressMapEntry* find_range(uint32_t addr);
|
AddressMapEntry* find_range(uint32_t addr);
|
||||||
|
AddressMapEntry* find_rom_region();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool add_mem_region(
|
bool add_mem_region(
|
||||||
|
@ -235,6 +235,7 @@ int load_boot_rom(string& rom_filepath) {
|
|||||||
ifstream rom_file;
|
ifstream rom_file;
|
||||||
size_t file_size;
|
size_t file_size;
|
||||||
int result;
|
int result;
|
||||||
|
AddressMapEntry *rom_reg;
|
||||||
|
|
||||||
rom_file.open(rom_filepath, ios::in | ios::binary);
|
rom_file.open(rom_filepath, ios::in | ios::binary);
|
||||||
if (rom_file.fail()) {
|
if (rom_file.fail()) {
|
||||||
@ -259,7 +260,12 @@ int load_boot_rom(string& rom_filepath) {
|
|||||||
MemCtrlBase* mem_ctrl = dynamic_cast<MemCtrlBase*>(
|
MemCtrlBase* mem_ctrl = dynamic_cast<MemCtrlBase*>(
|
||||||
gMachineObj->get_comp_by_type(HWCompType::MEM_CTRL));
|
gMachineObj->get_comp_by_type(HWCompType::MEM_CTRL));
|
||||||
|
|
||||||
mem_ctrl->set_data(0xFFC00000, sysrom_mem, file_size);
|
if ((rom_reg = mem_ctrl->find_rom_region())) {
|
||||||
|
mem_ctrl->set_data(rom_reg->start, sysrom_mem, file_size);
|
||||||
|
} else {
|
||||||
|
ABORT_F("Could not locate physical ROM region!");
|
||||||
|
}
|
||||||
|
|
||||||
delete[] sysrom_mem;
|
delete[] sysrom_mem;
|
||||||
|
|
||||||
result = 0;
|
result = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user