mvoed MWAIT_IS_NOP option from CPUID to CPU - it has meaning even if CPUID tree is not used because CPU is configured with CPUDB pre-defined configuration

This commit is contained in:
Stanislav Shwartsman 2012-03-15 19:46:57 +00:00
parent 1dd0500259
commit 5a33b1be84
7 changed files with 44 additions and 28 deletions

View File

@ -152,6 +152,10 @@ romimage: file=$BXSHARE/BIOS-bochs-latest
# message instead of generating #GP exception. This option is enabled
# by default but will not be avaiable if configurable MSRs are enabled.
#
# MWAIT_IS_NOP:
# When this option is enabled MWAIT will not put the CPU into a sleep state.
# This option exists only if Bochs compiled with --enable-monitor-mwait.
#
# IPS:
# Emulated Instructions Per Second. This is the number of IPS that bochs
# is capable of running on your machine. You can recompile Bochs with
@ -272,10 +276,6 @@ cpu: cpuid_limit_winnt=0
# Select MONITOR/MWAIT instructions support.
# This option exists only if Bochs compiled with --enable-monitor-mwait.
#
# MWAIT_IS_NOP:
# When this option is enabled MWAIT will not put the CPU into a sleep state.
# This option exists only if Bochs compiled with --enable-monitor-mwait.
#
# VMX:
# Select VMX extensions emulation support.
# This option exists only if Bochs compiled with --enable-vmx option.

View File

@ -26,6 +26,7 @@ cpu
reset_on_triple_fault
msrs
cpuid_limit_winnt
mwait_is_nop
cpuid
family
@ -57,7 +58,6 @@ cpuid
fsgsbase
smep
mwait
mwait_is_nop
memory
standard

View File

@ -392,6 +392,12 @@ void bx_init_options()
"cpuid_limit_winnt", "Limit max CPUID function to 3",
"Limit max CPUID function reported to 3 to workaround WinNT issue",
0);
#if BX_SUPPORT_MONITOR_MWAIT
new bx_param_bool_c(cpu_param,
"mwait_is_nop", "Don't put CPU to sleep state by MWAIT",
"Don't put CPU to sleep state by MWAIT",
0);
#endif
#if BX_CONFIGURE_MSRS
new bx_param_filename_c(cpu_param,
"msrs",
@ -564,10 +570,6 @@ void bx_init_options()
"mwait", "MONITOR/MWAIT instructions support",
"MONITOR/MWAIT instructions support",
BX_SUPPORT_MONITOR_MWAIT);
new bx_param_bool_c(cpuid_param,
"mwait_is_nop", "Don't put CPU to sleep state by MWAIT",
"Don't put CPU to sleep state by MWAIT",
0);
#endif
#if BX_SUPPORT_VMX
new bx_param_num_c(cpuid_param,
@ -2532,6 +2534,12 @@ static int parse_line_formatted(const char *context, int num_params, char *param
if (parse_param_bool(params[i], 16, BXPN_IGNORE_BAD_MSRS) < 0) {
PARSE_ERR(("%s: cpu directive malformed.", context));
}
#endif
#if BX_SUPPORT_MONITOR_MWAIT
} else if (!strncmp(params[i], "mwait_is_nop=", 13)) {
if (parse_param_bool(params[i], 13, BXPN_MWAIT_IS_NOP) < 0) {
PARSE_ERR(("%s: cpu directive malformed.", context));
}
#endif
} else if (!strncmp(params[i], "msrs=", 5)) {
SIM->get_param_string(BXPN_CONFIGURABLE_MSRS_PATH)->set(&params[i][5]);
@ -2667,10 +2675,6 @@ static int parse_line_formatted(const char *context, int num_params, char *param
if (parse_param_bool(params[i], 6, BXPN_CPUID_MWAIT) < 0) {
PARSE_ERR(("%s: cpuid directive malformed.", context));
}
} else if (!strncmp(params[i], "mwait_is_nop=", 13)) {
if (parse_param_bool(params[i], 13, BXPN_CPUID_MWAIT_IS_NOP) < 0) {
PARSE_ERR(("%s: cpuid directive malformed.", context));
}
#endif
#endif
} else if (!strncmp(params[i], "cpuid_limit_winnt=", 18)) {
@ -3629,6 +3633,9 @@ int bx_write_configuration(const char *rc, int overwrite)
#if BX_CPU_LEVEL >= 5
fprintf(fp, ", ignore_bad_msrs=%d", SIM->get_param_bool(BXPN_IGNORE_BAD_MSRS)->get());
#endif
#if BX_SUPPORT_MONITOR_MWAIT
fprintf(fp, ", mwait_is_nop=%d", SIM->get_param_bool(BXPN_MWAIT_IS_NOP)->get());
#endif
#if BX_CONFIGURE_MSRS
strptr = SIM->get_param_string(BXPN_CONFIGURABLE_MSRS_PATH)->getptr();
if (strlen(strptr) > 0)
@ -3679,9 +3686,8 @@ int bx_write_configuration(const char *rc, int overwrite)
SIM->get_param_bool(BXPN_CPUID_FSGSBASE)->get());
#endif
#if BX_SUPPORT_MONITOR_MWAIT
fprintf(fp, ", mwait=%d, mwait_is_nop=%d",
SIM->get_param_bool(BXPN_CPUID_MWAIT)->get(),
SIM->get_param_bool(BXPN_CPUID_MWAIT_IS_NOP)->get());
fprintf(fp, ", mwait=%d",
SIM->get_param_bool(BXPN_CPUID_MWAIT)->get());
#endif
#endif
fprintf(fp, "\n");

View File

@ -741,7 +741,7 @@ BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::MWAIT(bxInstruction_c *i)
BX_NEXT_TRACE(i);
}
static bx_bool mwait_is_nop = SIM->get_param_bool(BXPN_CPUID_MWAIT_IS_NOP)->get();
static bx_bool mwait_is_nop = SIM->get_param_bool(BXPN_MWAIT_IS_NOP)->get();
if (mwait_is_nop) {
BX_NEXT_TRACE(i);
}

View File

@ -2959,6 +2959,11 @@ will be completely bogus !
Determine whether to limit maximum CPUID function to 2. This mode is required
to workaround WinNT installation and boot issues.
</para>
<para><command>mwait_is_nop</command></para>
<para>
When this option is enabled MWAIT will not put the CPU into a sleep state.
This option exists only if Bochs compiled with --enable-monitor-mwait.
</para>
<para><command>msrs</command></para>
<para>
Define path to user CPU Model Specific Registers (MSRs) specification.
@ -3124,16 +3129,16 @@ This option exists only if Bochs compiled with BX_CPU_LEVEL >= 6.
Select MONITOR/MWAIT instructions support.
This option exists only if Bochs compiled with --enable-monitor-mwait.
</para>
<para><command>mwait_is_nop</command></para>
<para>
When this option is enabled MWAIT will not put the CPU into a sleep state.
This option exists only if Bochs compiled with --enable-monitor-mwait.
</para>
<para><command>vmx</command></para>
<para>
Select VMX extensions emulation support.
This option exists only if Bochs compiled with --enable-vmx option.
</para>
<para><command>svm</command></para>
<para>
Select AMD SVM (Secure Virtual Machine) extensions emulation support.
This option exists only if Bochs compiled with --enable-vmx option.
</para>
<para><command>family</command></para>
<para>
Set family information returned by CPUID. Default family value determined

View File

@ -157,6 +157,11 @@ cpuid_limit_winnt:
Determine whether to limit maximum CPUID function to 2. This mode is
required to workaround WinNT installation and boot issues.
mwait_is_nop:
When this option is enabled MWAIT will not put the CPU into a sleep state.
This option exists only if Bochs compiled with --enable-monitor-mwait.
msrs:
Define path to user CPU Model Specific Registers (MSRs) specification.
@ -311,16 +316,16 @@ mwait:
Select MONITOR/MWAIT instructions support.
This option exists only if Bochs compiled with --enable-monitor-mwait.
mwait_is_nop:
When this option is enabled MWAIT will not put the CPU into a sleep state.
This option exists only if Bochs compiled with --enable-monitor-mwait.
vmx:
Select VMX extensions emulation support.
This option exists only if Bochs compiled with --enable-vmx option.
svm:
Select AMD SVM (Secure Virtual Machine) extensions emulation support.
This option exists only if Bochs compiled with --enable-svm option.
family:
Set family information returned by CPUID. Default family value determined

View File

@ -43,6 +43,7 @@
#define BXPN_IGNORE_BAD_MSRS "cpu.ignore_bad_msrs"
#define BXPN_CONFIGURABLE_MSRS_PATH "cpu.msrs"
#define BXPN_CPUID_LIMIT_WINNT "cpu.cpuid_limit_winnt"
#define BXPN_MWAIT_IS_NOP "cpu.mwait_is_nop"
#define BXPN_VENDOR_STRING "cpuid.vendor_string"
#define BXPN_BRAND_STRING "cpuid.brand_string"
#define BXPN_CPUID_FAMILY "cpuid.family"
@ -67,7 +68,6 @@
#define BXPN_CPUID_FMA4 "cpuid.fma4"
#define BXPN_CPUID_APIC "cpuid.apic"
#define BXPN_CPUID_MWAIT "cpuid.mwait"
#define BXPN_CPUID_MWAIT_IS_NOP "cpuid.mwait_is_nop"
#define BXPN_CPUID_X86_64 "cpuid.x86_64"
#define BXPN_CPUID_1G_PAGES "cpuid.1g_pages"
#define BXPN_CPUID_PCID "cpuid.pcid"