From 1414e0bd6e4ec0580188ae6ecebeab2b6c9567d3 Mon Sep 17 00:00:00 2001 From: Stanislav Shwartsman Date: Sun, 12 Jun 2011 20:27:36 +0000 Subject: [PATCH] Report memory above 4GB to BIOS (patch by Sebastian Herbszt) --- bochs/CHANGES | 7 +++++-- bochs/iodev/devices.cc | 20 ++++++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/bochs/CHANGES b/bochs/CHANGES index 944a5a04d..810bd1ba4 100644 --- a/bochs/CHANGES +++ b/bochs/CHANGES @@ -9,10 +9,10 @@ Bochs repository moved to the SVN version control ! using .bochsrc CPUID option. - Added support for AVX instruction set emulation, to enable configure with --enable-avx option. - When compiled in, AVX still could be disabled using .bochsrc CPUID option. + When compiled in, AVX still has to be enabled using .bochsrc CPUID option. - Added emulation of AVX float16 convert instructions, the feature can be enabled using .bochsrc CPUID option. - - Updated/Fixed instrumentation callbacks. + - Redefined/Updated/Fixed instrumentation callbacks. - Bugfixes for CPU emulation correctness and stability. - Configure and compile @@ -55,6 +55,9 @@ Bochs repository moved to the SVN version control ! as VGA mode 0x13) - VBE: added HDTV resolutions (patch by Tristan Schmelcher) + - ROM BIOS + - Report memory above 4GB to BIOS (patch by Sebastian Herbszt) + - GUI and display libraries - vga update interval now uses host timing if the realtime sychronization is enabled with the "clock" option (FIXME: it should always be used - independant diff --git a/bochs/iodev/devices.cc b/bochs/iodev/devices.cc index d554c35d6..c9665ecce 100644 --- a/bochs/iodev/devices.cc +++ b/bochs/iodev/devices.cc @@ -278,9 +278,9 @@ void bx_devices_c::init(BX_MEM_C *newmem) } #endif #if BX_SUPPORT_PCIPNIC - if (SIM->get_param_bool(BXPN_PNIC_ENABLED)->get()) { - PLUG_load_plugin(pcipnic, PLUGTYPE_OPTIONAL); - } + if (SIM->get_param_bool(BXPN_PNIC_ENABLED)->get()) { + PLUG_load_plugin(pcipnic, PLUGTYPE_OPTIONAL); + } #endif } #endif @@ -347,8 +347,8 @@ void bx_devices_c::init(BX_MEM_C *newmem) "Port 92h System Control", 1); // misc. CMOS - Bit32u memory_in_k = (Bit32u)mem->get_memory_len() / 1024; - Bit32u extended_memory_in_k = memory_in_k > 1024 ? (memory_in_k - 1024) : 0; + Bit64u memory_in_k = mem->get_memory_len() / 1024; + Bit64u extended_memory_in_k = memory_in_k > 1024 ? (memory_in_k - 1024) : 0; if (extended_memory_in_k > 0xfc00) extended_memory_in_k = 0xfc00; DEV_cmos_set_reg(0x15, (Bit8u) BASE_MEMORY_IN_K); @@ -358,13 +358,21 @@ void bx_devices_c::init(BX_MEM_C *newmem) DEV_cmos_set_reg(0x30, (Bit8u) (extended_memory_in_k & 0xff)); DEV_cmos_set_reg(0x31, (Bit8u) ((extended_memory_in_k >> 8) & 0xff)); - Bit32u extended_memory_in_64k = memory_in_k > 16384 ? (memory_in_k - 16384) / 64 : 0; + Bit64u extended_memory_in_64k = memory_in_k > 16384 ? (memory_in_k - 16384) / 64 : 0; // Limit to 3 GB - 16 MB. PCI Memory Address Space starts at 3 GB. if (extended_memory_in_64k > 0xbf00) extended_memory_in_64k = 0xbf00; DEV_cmos_set_reg(0x34, (Bit8u) (extended_memory_in_64k & 0xff)); DEV_cmos_set_reg(0x35, (Bit8u) ((extended_memory_in_64k >> 8) & 0xff)); + Bit64u memory_above_4gb = (mem->get_memory_len() > BX_CONST64(0x100000000)) ? + (mem->get_memory_len() - BX_CONST64(0x100000000)) : 0; + if (memory_above_4gb) { + DEV_cmos_set_reg(0x5b, memory_above_4gb >> 16); + DEV_cmos_set_reg(0x5c, memory_above_4gb >> 24); + DEV_cmos_set_reg(0x5d, memory_above_4gb >> 32); + } + if (timer_handle != BX_NULL_TIMER_HANDLE) { timer_handle = bx_pc_system.register_timer(this, timer_handler, (unsigned) BX_IODEV_HANDLER_PERIOD, 1, 1, "devices.cc");