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));
@ -1042,6 +1022,29 @@ void bx_init_hardware()
#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
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
#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_INFO((" APIC support: %s", SIM->get_param_enum(BXPN_CPUID_APIC)->get_selected()));
#else #else
@ -1075,6 +1078,12 @@ void bx_init_hardware()
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"));