From 5a33b1be8469d9bfbbfd54b2aab9c381d71cd393 Mon Sep 17 00:00:00 2001 From: Stanislav Shwartsman Date: Thu, 15 Mar 2012 19:46:57 +0000 Subject: [PATCH] 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 --- bochs/.bochsrc | 8 ++++---- bochs/PARAM_TREE.txt | 2 +- bochs/config.cc | 28 +++++++++++++++++----------- bochs/cpu/proc_ctrl.cc | 2 +- bochs/doc/docbook/user/user.dbk | 15 ++++++++++----- bochs/doc/man/bochsrc.5 | 15 ++++++++++----- bochs/param_names.h | 2 +- 7 files changed, 44 insertions(+), 28 deletions(-) diff --git a/bochs/.bochsrc b/bochs/.bochsrc index 9ceefda0a..41e8ea0af 100644 --- a/bochs/.bochsrc +++ b/bochs/.bochsrc @@ -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. diff --git a/bochs/PARAM_TREE.txt b/bochs/PARAM_TREE.txt index 6ff148f4e..34bf6f40a 100644 --- a/bochs/PARAM_TREE.txt +++ b/bochs/PARAM_TREE.txt @@ -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 diff --git a/bochs/config.cc b/bochs/config.cc index 389b2e700..cc9ae87cc 100644 --- a/bochs/config.cc +++ b/bochs/config.cc @@ -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(¶ms[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"); diff --git a/bochs/cpu/proc_ctrl.cc b/bochs/cpu/proc_ctrl.cc index a15473a68..1931a0317 100644 --- a/bochs/cpu/proc_ctrl.cc +++ b/bochs/cpu/proc_ctrl.cc @@ -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); } diff --git a/bochs/doc/docbook/user/user.dbk b/bochs/doc/docbook/user/user.dbk index 874dcd3e2..9647bdfc1 100644 --- a/bochs/doc/docbook/user/user.dbk +++ b/bochs/doc/docbook/user/user.dbk @@ -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. +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. @@ -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. -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-vmx option. + family Set family information returned by CPUID. Default family value determined diff --git a/bochs/doc/man/bochsrc.5 b/bochs/doc/man/bochsrc.5 index 0f9e8162c..729ca8906 100644 --- a/bochs/doc/man/bochsrc.5 +++ b/bochs/doc/man/bochsrc.5 @@ -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 diff --git a/bochs/param_names.h b/bochs/param_names.h index a4985fd36..282daa928 100644 --- a/bochs/param_names.h +++ b/bochs/param_names.h @@ -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"