Fixed MWAIT leaf CPUID - required for Fedora15 startup

This commit is contained in:
Stanislav Shwartsman 2011-08-03 20:29:24 +00:00
parent 5451be2676
commit 1adda7bf64
6 changed files with 96 additions and 62 deletions

View File

@ -94,6 +94,7 @@ romimage: file=$BXSHARE/BIOS-bochs-latest
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# p3_katmai Intel Pentium III (Katmai) # p3_katmai Intel Pentium III (Katmai)
# p4_willamette Intel(R) Pentium(R) 4 (Willamette) # p4_willamette Intel(R) Pentium(R) 4 (Willamette)
# atom_n270 Intel(R) Atom(TM) CPU N270
# athlon64_clawhammer AMD Athlon(tm) 64 Processor 2800+ # athlon64_clawhammer AMD Athlon(tm) 64 Processor 2800+
# p4_prescott_celeron_336 Intel(R) Celeron(R) 336 # p4_prescott_celeron_336 Intel(R) Celeron(R) 336
# core2_extreme_x9770 Intel(R) Core(TM)2 Extreme X9770 # core2_extreme_x9770 Intel(R) Core(TM)2 Extreme X9770
@ -116,6 +117,10 @@ romimage: file=$BXSHARE/BIOS-bochs-latest
# PANIC. Remember that if you trying to continue after triple fault the # PANIC. Remember that if you trying to continue after triple fault the
# simulation will be completely bogus ! # simulation will be completely bogus !
# #
# CPUID_LIMIT_WINNT:
# Determine whether to limit maximum CPUID function to 2. This mode is
# required to workaround WinNT installation and boot issues.
#
# MSRS: # MSRS:
# Define path to user CPU Model Specific Registers (MSRs) specification. # Define path to user CPU Model Specific Registers (MSRs) specification.
# See example in msrs.def. # See example in msrs.def.
@ -238,10 +243,6 @@ cpu: cpuid_limit_winnt=0
# #
# STEPPING: # STEPPING:
# Set stepping information returned by CPUID. Default stepping value is 3. # Set stepping information returned by CPUID. Default stepping value is 3.
#
# CPUID_LIMIT_WINNT:
# Determine whether to limit maximum CPUID function to 3. This mode is
# required to workaround WinNT installation and boot issues.
#======================================================================= #=======================================================================
cpuid: mmx=1, sep=1, sse=sse4_2, apic=xapic, aes=1, movbe=1, xsave=1 cpuid: mmx=1, sep=1, sse=sse4_2, apic=xapic, aes=1, movbe=1, xsave=1
cpuid: family=6, model=0x1a, stepping=5 cpuid: family=6, model=0x1a, stepping=5

View File

@ -371,11 +371,17 @@ void core2_extreme_x9770_t::get_std_cpuid_leaf_5(cpuid_function_t *leaf) const
// [31:2] - reserved // [31:2] - reserved
// [1:1] - exit MWAIT even with EFLAGS.IF = 0 // [1:1] - exit MWAIT even with EFLAGS.IF = 0
// [0:0] - MONITOR/MWAIT extensions are supported // [0:0] - MONITOR/MWAIT extensions are supported
// EDX - Reserved // EDX -
// [03-00] - number of C0 sub C-states supported using MWAIT
// [07-04] - number of C1 sub C-states supported using MWAIT
// [11-08] - number of C2 sub C-states supported using MWAIT
// [15-12] - number of C3 sub C-states supported using MWAIT
// [19-16] - number of C4 sub C-states supported using MWAIT
// [31-20] - reserved (MBZ)
leaf->eax = CACHE_LINE_SIZE; leaf->eax = CACHE_LINE_SIZE;
leaf->ebx = CACHE_LINE_SIZE; leaf->ebx = CACHE_LINE_SIZE;
leaf->ecx = 3; leaf->ecx = 3;
leaf->edx = 0; leaf->edx = 0x00020220;
#else #else
leaf->eax = 0; leaf->eax = 0;
leaf->ebx = 0; leaf->ebx = 0;

View File

@ -378,11 +378,17 @@ void core2_extreme_x9770_t::get_std_cpuid_leaf_5(cpuid_function_t *leaf) const
// [31:2] - reserved // [31:2] - reserved
// [1:1] - exit MWAIT even with EFLAGS.IF = 0 // [1:1] - exit MWAIT even with EFLAGS.IF = 0
// [0:0] - MONITOR/MWAIT extensions are supported // [0:0] - MONITOR/MWAIT extensions are supported
// EDX - Reserved // EDX -
// [03-00] - number of C0 sub C-states supported using MWAIT
// [07-04] - number of C1 sub C-states supported using MWAIT
// [11-08] - number of C2 sub C-states supported using MWAIT
// [15-12] - number of C3 sub C-states supported using MWAIT
// [19-16] - number of C4 sub C-states supported using MWAIT
// [31-20] - reserved (MBZ)
leaf->eax = CACHE_LINE_SIZE; leaf->eax = CACHE_LINE_SIZE;
leaf->ebx = CACHE_LINE_SIZE; leaf->ebx = CACHE_LINE_SIZE;
leaf->ecx = 3; leaf->ecx = 3;
leaf->edx = 0; leaf->edx = 0x00000020;
#else #else
leaf->eax = 0; leaf->eax = 0;
leaf->ebx = 0; leaf->ebx = 0;

View File

@ -163,7 +163,7 @@ Bit32u corei7_sandy_bridge_2600k_t::get_cpu_extensions_bitmask(void) const
BX_CPU_PSE36 | BX_CPU_PSE36 |
BX_CPU_PAT_MTRR | BX_CPU_PAT_MTRR |
BX_CPU_XAPIC | BX_CPU_XAPIC |
BX_CPU_X2APIC | /* BX_CPU_X2APIC | */
BX_CPU_PCID; BX_CPU_PCID;
} }
@ -417,11 +417,17 @@ void corei7_sandy_bridge_2600k_t::get_std_cpuid_leaf_5(cpuid_function_t *leaf) c
// [31:2] - reserved // [31:2] - reserved
// [1:1] - exit MWAIT even with EFLAGS.IF = 0 // [1:1] - exit MWAIT even with EFLAGS.IF = 0
// [0:0] - MONITOR/MWAIT extensions are supported // [0:0] - MONITOR/MWAIT extensions are supported
// EDX - Reserved // EDX -
// [03-00] - number of C0 sub C-states supported using MWAIT
// [07-04] - number of C1 sub C-states supported using MWAIT
// [11-08] - number of C2 sub C-states supported using MWAIT
// [15-12] - number of C3 sub C-states supported using MWAIT
// [19-16] - number of C4 sub C-states supported using MWAIT
// [31-20] - reserved (MBZ)
leaf->eax = CACHE_LINE_SIZE; leaf->eax = CACHE_LINE_SIZE;
leaf->ebx = CACHE_LINE_SIZE; leaf->ebx = CACHE_LINE_SIZE;
leaf->ecx = 3; leaf->ecx = 3;
leaf->edx = 0; leaf->edx = 0x00001120;
#else #else
leaf->eax = 0; leaf->eax = 0;
leaf->ebx = 0; leaf->ebx = 0;

View File

@ -255,11 +255,17 @@ void bx_generic_cpuid_t::get_std_cpuid_leaf_5(cpuid_function_t *leaf) const
// [31:2] - reserved // [31:2] - reserved
// [1:1] - exit MWAIT even with EFLAGS.IF = 0 // [1:1] - exit MWAIT even with EFLAGS.IF = 0
// [0:0] - MONITOR/MWAIT extensions are supported // [0:0] - MONITOR/MWAIT extensions are supported
// EDX - Reserved // EDX -
// [03-00] - number of C0 sub C-states supported using MWAIT
// [07-04] - number of C1 sub C-states supported using MWAIT
// [11-08] - number of C2 sub C-states supported using MWAIT
// [15-12] - number of C3 sub C-states supported using MWAIT
// [19-16] - number of C4 sub C-states supported using MWAIT
// [31-20] - reserved (MBZ)
leaf->eax = CACHE_LINE_SIZE; leaf->eax = CACHE_LINE_SIZE;
leaf->ebx = CACHE_LINE_SIZE; leaf->ebx = CACHE_LINE_SIZE;
leaf->ecx = 3; leaf->ecx = 3;
leaf->edx = 0; leaf->edx = 0x00000020;
} }
else else
#endif #endif
@ -770,7 +776,7 @@ void bx_generic_cpuid_t::init_isa_extensions_bitmask(void)
#endif #endif
#if BX_SUPPORT_X86_64 #if BX_SUPPORT_X86_64
features_bitmask |= BX_CPU_X86_64 | BX_CPU_RDTSCP; features_bitmask |= BX_CPU_X86_64 | BX_CPU_RDTSCP | BX_CPU_LM_LAHF_SAHF;
if (sse_enabled < BX_CPUID_SUPPORT_SSE2) { if (sse_enabled < BX_CPUID_SUPPORT_SSE2) {
BX_PANIC(("PANIC: x86-64 emulation requires SSE2 support !")); BX_PANIC(("PANIC: x86-64 emulation requires SSE2 support !"));

View File

@ -994,26 +994,6 @@ void bx_init_hardware()
io->set_log_prefix(SIM->get_param_string(BXPN_LOG_PREFIX)->getptr()); io->set_log_prefix(SIM->get_param_string(BXPN_LOG_PREFIX)->getptr());
#if BX_CPU_LEVEL >= 5
bx_bool mmx_enabled = SIM->get_param_bool(BXPN_CPUID_MMX)->get();
#endif
#if BX_CPU_LEVEL >= 6
bx_bool aes_enabled = SIM->get_param_bool(BXPN_CPUID_AES)->get();
bx_bool movbe_enabled = SIM->get_param_bool(BXPN_CPUID_MOVBE)->get();
bx_bool sep_enabled = SIM->get_param_bool(BXPN_CPUID_SEP)->get();
bx_bool xsave_enabled = SIM->get_param_bool(BXPN_CPUID_XSAVE)->get();
bx_bool xsaveopt_enabled = SIM->get_param_bool(BXPN_CPUID_XSAVEOPT)->get();
#if BX_SUPPORT_AVX
bx_bool avx_enabled = SIM->get_param_bool(BXPN_CPUID_AVX)->get();
#endif
#if BX_SUPPORT_X86_64
bx_bool xlarge_pages_enabled = SIM->get_param_bool(BXPN_CPUID_1G_PAGES)->get();
#endif
#if BX_SUPPORT_MONITOR_MWAIT
bx_bool mwait_enabled = SIM->get_param_bool(BXPN_CPUID_MWAIT)->get();
#endif
#endif
// Output to the log file the cpu and device settings // Output to the log file the cpu and device settings
// This will by handy for bug reports // This will by handy for bug reports
BX_INFO(("Bochs x86 Emulator %s", VER_STRING)); BX_INFO(("Bochs x86 Emulator %s", VER_STRING));
@ -1028,7 +1008,7 @@ void bx_init_hardware()
BX_INFO(("System configuration")); BX_INFO(("System configuration"));
BX_INFO((" processors: %d (cores=%u, HT threads=%u)", BX_SMP_PROCESSORS, BX_INFO((" processors: %d (cores=%u, HT threads=%u)", BX_SMP_PROCESSORS,
SIM->get_param_num(BXPN_CPU_NCORES)->get(), SIM->get_param_num(BXPN_CPU_NTHREADS)->get())); SIM->get_param_num(BXPN_CPU_NCORES)->get(), SIM->get_param_num(BXPN_CPU_NTHREADS)->get()));
BX_INFO((" A20 line support: %s",BX_SUPPORT_A20?"yes":"no")); BX_INFO((" A20 line support: %s", BX_SUPPORT_A20?"yes":"no"));
#if BX_CONFIGURE_MSRS #if BX_CONFIGURE_MSRS
const char *msrs_file = SIM->get_param_string(BXPN_CONFIGURABLE_MSRS_PATH)->getptr(); const char *msrs_file = SIM->get_param_string(BXPN_CONFIGURABLE_MSRS_PATH)->getptr();
if(strlen(msrs_file) > 0) if(strlen(msrs_file) > 0)
@ -1036,54 +1016,83 @@ void bx_init_hardware()
#endif #endif
BX_INFO(("IPS is set to %d", (Bit32u) SIM->get_param_num(BXPN_IPS)->get())); BX_INFO(("IPS is set to %d", (Bit32u) SIM->get_param_num(BXPN_IPS)->get()));
BX_INFO(("CPU configuration")); BX_INFO(("CPU configuration"));
BX_INFO((" level: %d",BX_CPU_LEVEL)); BX_INFO((" level: %d", BX_CPU_LEVEL));
#if BX_SUPPORT_SMP #if BX_SUPPORT_SMP
BX_INFO((" SMP support: yes, quantum=%d", SIM->get_param_num(BXPN_SMP_QUANTUM)->get())); BX_INFO((" SMP support: yes, quantum=%d", SIM->get_param_num(BXPN_SMP_QUANTUM)->get()));
#else #else
BX_INFO((" SMP support: no")); BX_INFO((" SMP support: no"));
#endif #endif
unsigned cpu_model = SIM->get_param_enum(BXPN_CPU_MODEL)->get();
if (! cpu_model) {
#if BX_CPU_LEVEL >= 5 #if BX_CPU_LEVEL >= 5
BX_INFO((" APIC support: %s", SIM->get_param_enum(BXPN_CPUID_APIC)->get_selected())); bx_bool mmx_enabled = SIM->get_param_bool(BXPN_CPUID_MMX)->get();
#else
BX_INFO((" APIC support: no"));
#endif
BX_INFO((" FPU support: %s",BX_SUPPORT_FPU?"yes":"no"));
#if BX_CPU_LEVEL >= 5
BX_INFO((" MMX support: %s",mmx_enabled?"yes":"no"));
BX_INFO((" 3dnow! support: %s",BX_SUPPORT_3DNOW?"yes":"no"));
#endif #endif
#if BX_CPU_LEVEL >= 6 #if BX_CPU_LEVEL >= 6
BX_INFO((" SEP support: %s",sep_enabled?"yes":"no")); bx_bool aes_enabled = SIM->get_param_bool(BXPN_CPUID_AES)->get();
BX_INFO((" SSE support: %s", SIM->get_param_enum(BXPN_CPUID_SSE)->get_selected())); bx_bool movbe_enabled = SIM->get_param_bool(BXPN_CPUID_MOVBE)->get();
BX_INFO((" XSAVE support: %s %s", bx_bool sep_enabled = SIM->get_param_bool(BXPN_CPUID_SEP)->get();
xsave_enabled?"xsave":"no", xsaveopt_enabled?"xsaveopt":"")); bx_bool xsave_enabled = SIM->get_param_bool(BXPN_CPUID_XSAVE)->get();
BX_INFO((" AES support: %s",aes_enabled?"yes":"no")); bx_bool xsaveopt_enabled = SIM->get_param_bool(BXPN_CPUID_XSAVEOPT)->get();
BX_INFO((" MOVBE support: %s",movbe_enabled?"yes":"no")); #if BX_SUPPORT_AVX
BX_INFO((" x86-64 support: %s",BX_SUPPORT_X86_64?"yes":"no")); bx_bool avx_enabled = SIM->get_param_bool(BXPN_CPUID_AVX)->get();
#endif
#if BX_SUPPORT_X86_64 #if BX_SUPPORT_X86_64
BX_INFO((" 1G paging support: %s",xlarge_pages_enabled?"yes":"no")); bx_bool xlarge_pages_enabled = SIM->get_param_bool(BXPN_CPUID_1G_PAGES)->get();
#endif #endif
#if BX_SUPPORT_MONITOR_MWAIT #if BX_SUPPORT_MONITOR_MWAIT
BX_INFO((" MWAIT support: %s",mwait_enabled?"yes":"no")); bx_bool mwait_enabled = SIM->get_param_bool(BXPN_CPUID_MWAIT)->get();
#endif
#endif
#if BX_CPU_LEVEL >= 5
BX_INFO((" APIC support: %s", SIM->get_param_enum(BXPN_CPUID_APIC)->get_selected()));
#else
BX_INFO((" APIC support: no"));
#endif
BX_INFO((" FPU support: %s", BX_SUPPORT_FPU?"yes":"no"));
#if BX_CPU_LEVEL >= 5
BX_INFO((" MMX support: %s", mmx_enabled?"yes":"no"));
BX_INFO((" 3dnow! support: %s", BX_SUPPORT_3DNOW?"yes":"no"));
#endif
#if BX_CPU_LEVEL >= 6
BX_INFO((" SEP support: %s", sep_enabled?"yes":"no"));
BX_INFO((" SSE support: %s", SIM->get_param_enum(BXPN_CPUID_SSE)->get_selected()));
BX_INFO((" XSAVE support: %s %s",
xsave_enabled?"xsave":"no", xsaveopt_enabled?"xsaveopt":""));
BX_INFO((" AES support: %s", aes_enabled?"yes":"no"));
BX_INFO((" MOVBE support: %s", movbe_enabled?"yes":"no"));
BX_INFO((" x86-64 support: %s", BX_SUPPORT_X86_64?"yes":"no"));
#if BX_SUPPORT_X86_64
BX_INFO((" 1G paging support: %s", xlarge_pages_enabled?"yes":"no"));
#endif
#if BX_SUPPORT_MONITOR_MWAIT
BX_INFO((" MWAIT support: %s", mwait_enabled?"yes":"no"));
#endif #endif
#if BX_SUPPORT_AVX #if BX_SUPPORT_AVX
BX_INFO((" AVX support: %s",avx_enabled?"yes":"no")); BX_INFO((" AVX support: %s", avx_enabled?"yes":"no"));
#endif #endif
#if BX_SUPPORT_VMX #if BX_SUPPORT_VMX
BX_INFO((" VMX support: %d",BX_SUPPORT_VMX)); BX_INFO((" VMX support: %d", BX_SUPPORT_VMX));
#else #else
BX_INFO((" VMX support: no")); BX_INFO((" VMX support: no"));
#endif #endif
#endif #endif
}
else {
BX_INFO((" Using pre-defined CPU configuration: %s",
SIM->get_param_enum(BXPN_CPU_MODEL)->get_selected()));
}
BX_INFO(("Optimization configuration")); BX_INFO(("Optimization configuration"));
BX_INFO((" RepeatSpeedups support: %s",BX_SupportRepeatSpeedups?"yes":"no")); BX_INFO((" RepeatSpeedups support: %s", BX_SupportRepeatSpeedups?"yes":"no"));
BX_INFO((" Fast function calls: %s",BX_FAST_FUNC_CALL?"yes":"no")); BX_INFO((" Fast function calls: %s", BX_FAST_FUNC_CALL?"yes":"no"));
BX_INFO(("Devices configuration")); BX_INFO(("Devices configuration"));
BX_INFO((" NE2000 support: %s",BX_SUPPORT_NE2K?"yes":"no")); BX_INFO((" NE2000 support: %s", BX_SUPPORT_NE2K?"yes":"no"));
BX_INFO((" PCI support: %s, enabled=%s",BX_SUPPORT_PCI?"yes":"no", BX_INFO((" PCI support: %s, enabled=%s", BX_SUPPORT_PCI?"yes":"no",
SIM->get_param_bool(BXPN_I440FX_SUPPORT)->get() ? "yes" : "no")); SIM->get_param_bool(BXPN_I440FX_SUPPORT)->get() ? "yes" : "no"));
BX_INFO((" SB16 support: %s",BX_SUPPORT_SB16?"yes":"no")); BX_INFO((" SB16 support: %s", BX_SUPPORT_SB16?"yes":"no"));
BX_INFO((" USB support: %s",BX_SUPPORT_PCIUSB?"yes":"no")); BX_INFO((" USB support: %s", BX_SUPPORT_PCIUSB?"yes":"no"));
BX_INFO((" VGA extension support: vbe %s", BX_SUPPORT_CLGD54XX?"cirrus":"")); BX_INFO((" VGA extension support: vbe %s", BX_SUPPORT_CLGD54XX?"cirrus":""));
// Check if there is a romimage // Check if there is a romimage