From ca8daea6639d96ffa89a2fe5b4709e8309952838 Mon Sep 17 00:00:00 2001 From: Stanislav Shwartsman Date: Wed, 6 Nov 2024 07:16:37 +0200 Subject: [PATCH] move BRAND STRING parameter from CPUID to CPU option CPUID option will be removed soon --- bochs/PARAM_TREE.txt | 6 +++--- bochs/config.cc | 17 +++++++---------- bochs/cpu/cpuid.cc | 3 +++ bochs/doc/docbook/user/user.dbk | 11 ++++++----- bochs/doc/man/bochsrc.5 | 11 ++++++----- bochs/param_names.h | 2 +- 6 files changed, 26 insertions(+), 24 deletions(-) diff --git a/bochs/PARAM_TREE.txt b/bochs/PARAM_TREE.txt index 6d92f2983..dd8f684c3 100644 --- a/bochs/PARAM_TREE.txt +++ b/bochs/PARAM_TREE.txt @@ -22,22 +22,22 @@ cpu n_cores n_threads model + add_features + exclude_features ips quantum reset_on_triple_fault msrs cpuid_limit_winnt mwait_is_nop + brand_string cpuid level family model - add_features - exclude_features stepping vendor_string - brand_string mmx sep simd diff --git a/bochs/config.cc b/bochs/config.cc index 6461014df..ce05cce5b 100644 --- a/bochs/config.cc +++ b/bochs/config.cc @@ -689,6 +689,13 @@ void bx_init_options() "", BX_PATHNAME_LEN); #endif + new bx_param_string_c(cpu_param, + "brand_string", + "CPUID brand string", + "Set the CPUID brand string override (keep empty to use original brand string)", + "", + BX_CPUID_BRAND_LEN+1); + cpu_param->set_options(menu->SHOW_PARENT); // cpuid subtree @@ -729,16 +736,6 @@ void bx_init_options() "AuthenticAMD", #endif BX_CPUID_VENDOR_LEN+1); - new bx_param_string_c(cpuid_param, - "brand_string", - "CPUID brand string", - "Set the CPUID brand string", -#if BX_CPU_VENDOR_INTEL - " Intel(R) Pentium(R) 4 CPU ", -#else - "AMD Athlon(tm) processor", -#endif - BX_CPUID_BRAND_LEN+1); #if BX_CPU_LEVEL >= 5 new bx_param_bool_c(cpuid_param, diff --git a/bochs/cpu/cpuid.cc b/bochs/cpu/cpuid.cc index 88b77c3f5..fe9f11101 100644 --- a/bochs/cpu/cpuid.cc +++ b/bochs/cpu/cpuid.cc @@ -451,6 +451,9 @@ void bx_cpuid_t::get_leaf_0(unsigned max_leaf, const char *vendor_string, cpuid_ void bx_cpuid_t::get_ext_cpuid_brand_string_leaf(const char *brand_string, Bit32u function, cpuid_function_t *leaf) const { + static const char *brand_string_ovr = (const char *)SIM->get_param_string(BXPN_BRAND_STRING)->getptr(); + if (brand_string_ovr && *brand_string_ovr) brand_string = brand_string_ovr; + switch(function) { case 0x80000002: memcpy(&(leaf->eax), brand_string , 4); diff --git a/bochs/doc/docbook/user/user.dbk b/bochs/doc/docbook/user/user.dbk index a993ae974..f97e391e9 100644 --- a/bochs/doc/docbook/user/user.dbk +++ b/bochs/doc/docbook/user/user.dbk @@ -3457,6 +3457,12 @@ to work around WinNT installation and boot issues. When this option is enabled MWAIT will not put the CPU into a sleep state. This option exists only if Bochs compiled with . +brand_string + +Set the CPUID brand string returned by CPUID(0x80000002 .. 0x80000004). +This should be at most a forty-eight-character ASCII string. +Keep it empty to use original CPUID brand string. + msrs Define path to user CPU Model Specific Registers (MSRs) specification. @@ -3543,11 +3549,6 @@ Set stepping information returned by CPUID. Default stepping value is 3. Set the CPUID vendor string returned by CPUID(0x0). This should be a twelve-character ASCII string. -brand_string - -Set the CPUID brand string returned by CPUID(0x80000002 .. 0x80000004]). This should be -at most a forty-eight-character ASCII string. - mmx Select MMX instruction set support. diff --git a/bochs/doc/man/bochsrc.5 b/bochs/doc/man/bochsrc.5 index cf28baaff..c823660bb 100644 --- a/bochs/doc/man/bochsrc.5 +++ b/bochs/doc/man/bochsrc.5 @@ -182,6 +182,12 @@ 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. +brand_string: + +Set the CPUID brand string returned by CPUID(0x80000002 .. 0x80000004). +This should be at most a forty-eight-character ASCII string. +Keep it empty to use original CPUID brand string. + msrs: Define path to user CPU Model Specific Registers (MSRs) specification. @@ -259,11 +265,6 @@ vendor_string: Set the CPUID vendor string returned by CPUID(0x0). This should be a twelve-character ASCII string. -brand_string: - -Set the CPUID vendor string returned by CPUID(0x80000002 .. 0x80000004). -This should be at most a forty-eight-character ASCII string. - mmx: Select MMX instruction set support. diff --git a/bochs/param_names.h b/bochs/param_names.h index 47148da7f..edaea07be 100644 --- a/bochs/param_names.h +++ b/bochs/param_names.h @@ -48,8 +48,8 @@ #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_BRAND_STRING "cpu.brand_string" #define BXPN_VENDOR_STRING "cpuid.vendor_string" -#define BXPN_BRAND_STRING "cpuid.brand_string" #define BXPN_CPUID_LEVEL "cpuid.level" #define BXPN_CPUID_FAMILY "cpuid.family" #define BXPN_CPUID_MODEL "cpuid.model"