implemented volatile BIOS memory write support (controlled by PIIX/PIIX3 XBCS register)
This commit is contained in:
parent
574b69c81e
commit
2ea45c0e4d
@ -386,6 +386,12 @@ void bx_piix3_c::pci_write_handler(Bit8u address, Bit32u value, unsigned io_len)
|
||||
}
|
||||
BX_P2I_THIS pci_conf[address+i] = (oldval & ~value8) | 0x02;
|
||||
break;
|
||||
case 0x4e:
|
||||
if ((value & 0x04) != (oldval & 0x04)) {
|
||||
DEV_mem_set_bios_write((value8 & 0x04) != 0);
|
||||
}
|
||||
BX_P2I_THIS pci_conf[address+i] = value8;
|
||||
break;
|
||||
case 0x4f:
|
||||
if (BX_P2I_THIS s.chipset == BX_PCI_CHIPSET_I440FX) {
|
||||
BX_P2I_THIS pci_conf[address+i] = (value8 & 0x01);
|
||||
|
@ -176,8 +176,23 @@ inc_one:
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else if (BX_MEM_THIS bios_write_enabled && (a20addr >= (bx_phy_address)~BIOS_MASK)) {
|
||||
// volatile BIOS write support
|
||||
#ifdef BX_LITTLE_ENDIAN
|
||||
data_ptr = (Bit8u *) data;
|
||||
#else // BX_BIG_ENDIAN
|
||||
data_ptr = (Bit8u *) data + (len - 1);
|
||||
#endif
|
||||
for (unsigned i = 0; i < len; i++) {
|
||||
BX_MEM_THIS rom[a20addr & BIOS_MASK] = *data_ptr;
|
||||
a20addr++;
|
||||
#ifdef BX_LITTLE_ENDIAN
|
||||
data_ptr++;
|
||||
#else // BX_BIG_ENDIAN
|
||||
data_ptr--;
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
// access outside limits of physical memory, ignore
|
||||
BX_DEBUG(("Write outside the limits of physical memory (0x"FMT_PHY_ADDRX") (ignore)", a20addr));
|
||||
}
|
||||
|
@ -83,6 +83,7 @@ class BOCHSAPI BX_MEM_C : public logfunctions {
|
||||
private:
|
||||
struct memory_handler_struct **memory_handlers;
|
||||
bx_bool pci_enabled;
|
||||
bx_bool bios_write_enabled;
|
||||
bx_bool smram_available;
|
||||
bx_bool smram_enable;
|
||||
bx_bool smram_restricted;
|
||||
@ -117,6 +118,7 @@ public:
|
||||
BX_MEM_SMF void disable_smram(void);
|
||||
BX_MEM_SMF bx_bool is_smram_accessible(void);
|
||||
|
||||
BX_MEM_SMF void set_bios_write(bx_bool enabled);
|
||||
BX_MEM_SMF void set_memory_type(memory_area_t area, bx_bool rw, bx_bool dram);
|
||||
|
||||
BX_MEM_SMF Bit8u* getHostMemAddr(BX_CPU_C *cpu, bx_phy_address addr, unsigned rw);
|
||||
|
@ -145,6 +145,7 @@ void BX_MEM_C::init_memory(Bit64u guest, Bit64u host)
|
||||
BX_MEM_THIS memory_handlers[idx] = NULL;
|
||||
|
||||
BX_MEM_THIS pci_enabled = SIM->get_param_bool(BXPN_PCI_ENABLED)->get();
|
||||
BX_MEM_THIS bios_write_enabled = 0;
|
||||
BX_MEM_THIS smram_available = 0;
|
||||
BX_MEM_THIS smram_enable = 0;
|
||||
BX_MEM_THIS smram_restricted = 0;
|
||||
@ -912,6 +913,11 @@ void BX_MEM_C::set_memory_type(memory_area_t area, bx_bool rw, bx_bool dram)
|
||||
}
|
||||
}
|
||||
|
||||
void BX_MEM_C::set_bios_write(bx_bool enabled)
|
||||
{
|
||||
BX_MEM_THIS bios_write_enabled = enabled;
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_MONITOR_MWAIT
|
||||
|
||||
//
|
||||
|
@ -245,6 +245,7 @@ extern "C" {
|
||||
bx_devices.mem->unregisterMemoryHandlers(param,b,e)
|
||||
#define DEV_mem_set_memory_type(a,b,c) \
|
||||
bx_devices.mem->set_memory_type((memory_area_t)a,b,c)
|
||||
#define DEV_mem_set_bios_write(a) bx_devices.mem->set_bios_write(a)
|
||||
|
||||
///////// USB device macros
|
||||
#define DEV_usb_init_device(a,b,c,d) (usbdev_type)bx_devices.pluginUsbDevCtl->init_device(a,b,(void**)c,d)
|
||||
|
Loading…
Reference in New Issue
Block a user