From 378e7e16eb3d9e19529408b8976d4fb905254cec Mon Sep 17 00:00:00 2001 From: Stanislav Shwartsman Date: Sat, 15 Mar 2014 19:24:42 +0000 Subject: [PATCH] fixed major code duplication in CPUDB classes --- bochs/cpu/cpudb/amd_k6_2_chomper.cc | 45 ++------------------ bochs/cpu/cpudb/amd_k6_2_chomper.h | 3 +- bochs/cpu/cpudb/athlon64_clawhammer.cc | 41 ++---------------- bochs/cpu/cpudb/athlon64_clawhammer.h | 3 +- bochs/cpu/cpudb/athlon64_venice.cc | 41 ++---------------- bochs/cpu/cpudb/athlon64_venice.h | 3 +- bochs/cpu/cpudb/atom_n270.cc | 41 ++---------------- bochs/cpu/cpudb/atom_n270.h | 3 +- bochs/cpu/cpudb/core2_penryn_t9600.cc | 41 ++---------------- bochs/cpu/cpudb/core2_penryn_t9600.h | 3 +- bochs/cpu/cpudb/core_duo_t2400_yonah.cc | 41 ++---------------- bochs/cpu/cpudb/core_duo_t2400_yonah.h | 3 +- bochs/cpu/cpudb/corei5_arrandale_m520.cc | 41 ++---------------- bochs/cpu/cpudb/corei5_arrandale_m520.h | 3 +- bochs/cpu/cpudb/corei5_lynnfield_750.cc | 41 ++---------------- bochs/cpu/cpudb/corei5_lynnfield_750.h | 3 +- bochs/cpu/cpudb/corei7_haswell_4770.cc | 44 ++----------------- bochs/cpu/cpudb/corei7_haswell_4770.h | 3 +- bochs/cpu/cpudb/corei7_ivy_bridge_3770K.cc | 44 ++----------------- bochs/cpu/cpudb/corei7_ivy_bridge_3770K.h | 3 +- bochs/cpu/cpudb/corei7_sandy_bridge_2600K.cc | 44 ++----------------- bochs/cpu/cpudb/corei7_sandy_bridge_2600K.h | 3 +- bochs/cpu/cpudb/p4_prescott_celeron_336.cc | 41 ++---------------- bochs/cpu/cpudb/p4_prescott_celeron_336.h | 3 +- bochs/cpu/cpudb/p4_willamette.cc | 42 +++--------------- bochs/cpu/cpudb/p4_willamette.h | 3 +- bochs/cpu/cpudb/phenomx3_8650_toliman.cc | 41 ++---------------- bochs/cpu/cpudb/phenomx3_8650_toliman.h | 3 +- bochs/cpu/cpudb/trinity_apu.cc | 38 ++--------------- bochs/cpu/cpudb/trinity_apu.h | 1 - bochs/cpu/cpudb/turion64_tyler.cc | 41 ++---------------- bochs/cpu/cpudb/turion64_tyler.h | 3 +- bochs/cpu/cpudb/zambezi.cc | 39 ++--------------- bochs/cpu/cpudb/zambezi.h | 3 +- bochs/cpu/cpuid.h | 34 +++++++++++++++ bochs/cpudb.h | 2 +- 36 files changed, 118 insertions(+), 673 deletions(-) diff --git a/bochs/cpu/cpudb/amd_k6_2_chomper.cc b/bochs/cpu/cpudb/amd_k6_2_chomper.cc index 34e8ed8b8..6d08cbc64 100644 --- a/bochs/cpu/cpudb/amd_k6_2_chomper.cc +++ b/bochs/cpu/cpudb/amd_k6_2_chomper.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -39,6 +39,8 @@ amd_k6_2_chomper_t::amd_k6_2_chomper_t(BX_CPU_C *cpu): bx_cpuid_t(cpu) void amd_k6_2_chomper_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_function_t *leaf) const { + static const char* brand_string = "AMD-K6(tm) 3D processor\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; + switch(function) { case 0x8FFFFFFF: get_cpuid_hidden_level(leaf); @@ -52,7 +54,7 @@ void amd_k6_2_chomper_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpu case 0x80000002: case 0x80000003: case 0x80000004: - get_ext_cpuid_brand_string_leaf(function, leaf); + get_ext_cpuid_brand_string_leaf(brand_string, function, leaf); return; case 0x80000005: get_ext_cpuid_leaf_5(leaf); @@ -259,45 +261,6 @@ void amd_k6_2_chomper_t::get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const #endif } -// leaf 0x80000002 // -// leaf 0x80000003 // -// leaf 0x80000004 // -void amd_k6_2_chomper_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const -{ - // CPUID function 0x80000002-0x80000004 - Processor Name String Identifier - static const char* brand_string = "AMD-K6(tm) 3D processor\0\0\0\0\0\0\0\0\0\0\0\0\0"; - - switch(function) { - case 0x80000002: - memcpy(&(leaf->eax), brand_string , 4); - memcpy(&(leaf->ebx), brand_string + 4, 4); - memcpy(&(leaf->ecx), brand_string + 8, 4); - memcpy(&(leaf->edx), brand_string + 12, 4); - break; - case 0x80000003: - memcpy(&(leaf->eax), brand_string + 16, 4); - memcpy(&(leaf->ebx), brand_string + 20, 4); - leaf->ecx = 0; - leaf->edx = 0; - break; - case 0x80000004: - leaf->eax = 0; - leaf->ebx = 0; - leaf->ecx = 0; - leaf->edx = 0; - break; - default: - break; - } - -#ifdef BX_BIG_ENDIAN - leaf->eax = bx_bswap32(leaf->eax); - leaf->ebx = bx_bswap32(leaf->ebx); - leaf->ecx = bx_bswap32(leaf->ecx); - leaf->edx = bx_bswap32(leaf->edx); -#endif -} - // leaf 0x80000005 // void amd_k6_2_chomper_t::get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const { diff --git a/bochs/cpu/cpudb/amd_k6_2_chomper.h b/bochs/cpu/cpudb/amd_k6_2_chomper.h index 7c1a5d4e0..8b41d9e5f 100644 --- a/bochs/cpu/cpudb/amd_k6_2_chomper.h +++ b/bochs/cpu/cpudb/amd_k6_2_chomper.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -49,7 +49,6 @@ private: void get_ext_cpuid_leaf_0(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const; - void get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const; void get_cpuid_hidden_level(cpuid_function_t *leaf) const; diff --git a/bochs/cpu/cpudb/athlon64_clawhammer.cc b/bochs/cpu/cpudb/athlon64_clawhammer.cc index a7a1852bc..1d43eb570 100644 --- a/bochs/cpu/cpudb/athlon64_clawhammer.cc +++ b/bochs/cpu/cpudb/athlon64_clawhammer.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -39,6 +39,8 @@ athlon64_clawhammer_t::athlon64_clawhammer_t(BX_CPU_C *cpu): bx_cpuid_t(cpu) void athlon64_clawhammer_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_function_t *leaf) const { + static const char* brand_string = "AMD Athlon(tm) 64 Processor 2800+\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; + switch(function) { case 0x8FFFFFFF: get_cpuid_hidden_level(leaf); @@ -52,7 +54,7 @@ void athlon64_clawhammer_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, case 0x80000002: case 0x80000003: case 0x80000004: - get_ext_cpuid_brand_string_leaf(function, leaf); + get_ext_cpuid_brand_string_leaf(brand_string, function, leaf); return; case 0x80000005: get_ext_cpuid_leaf_5(leaf); @@ -319,41 +321,6 @@ void athlon64_clawhammer_t::get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const // leaf 0x80000002 // // leaf 0x80000003 // // leaf 0x80000004 // -void athlon64_clawhammer_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const -{ - // CPUID function 0x80000002-0x80000004 - Processor Name String Identifier - static const char* brand_string = "AMD Athlon(tm) 64 Processor 2800+\0\0\0"; - - switch(function) { - case 0x80000002: - memcpy(&(leaf->eax), brand_string , 4); - memcpy(&(leaf->ebx), brand_string + 4, 4); - memcpy(&(leaf->ecx), brand_string + 8, 4); - memcpy(&(leaf->edx), brand_string + 12, 4); - break; - case 0x80000003: - memcpy(&(leaf->eax), brand_string + 16, 4); - memcpy(&(leaf->ebx), brand_string + 20, 4); - memcpy(&(leaf->ecx), brand_string + 24, 4); - memcpy(&(leaf->edx), brand_string + 28, 4); - break; - case 0x80000004: - memcpy(&(leaf->eax), brand_string + 32, 4); - leaf->ebx = 0; - leaf->ecx = 0; - leaf->edx = 0; - break; - default: - break; - } - -#ifdef BX_BIG_ENDIAN - leaf->eax = bx_bswap32(leaf->eax); - leaf->ebx = bx_bswap32(leaf->ebx); - leaf->ecx = bx_bswap32(leaf->ecx); - leaf->edx = bx_bswap32(leaf->edx); -#endif -} // leaf 0x80000005 // void athlon64_clawhammer_t::get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const diff --git a/bochs/cpu/cpudb/athlon64_clawhammer.h b/bochs/cpu/cpudb/athlon64_clawhammer.h index 7d1c3bfca..52e4df1ed 100644 --- a/bochs/cpu/cpudb/athlon64_clawhammer.h +++ b/bochs/cpu/cpudb/athlon64_clawhammer.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -49,7 +49,6 @@ private: void get_ext_cpuid_leaf_0(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const; - void get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_7(cpuid_function_t *leaf) const; diff --git a/bochs/cpu/cpudb/athlon64_venice.cc b/bochs/cpu/cpudb/athlon64_venice.cc index 67948cf98..d27a37283 100644 --- a/bochs/cpu/cpudb/athlon64_venice.cc +++ b/bochs/cpu/cpudb/athlon64_venice.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -39,6 +39,8 @@ athlon64_venice_t::athlon64_venice_t(BX_CPU_C *cpu): bx_cpuid_t(cpu) void athlon64_venice_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_function_t *leaf) const { + static const char* brand_string = "AMD Athlon(tm) 64 Processor 3000+\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; + switch(function) { case 0x8FFFFFFF: get_cpuid_hidden_level(leaf); @@ -52,7 +54,7 @@ void athlon64_venice_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpui case 0x80000002: case 0x80000003: case 0x80000004: - get_ext_cpuid_brand_string_leaf(function, leaf); + get_ext_cpuid_brand_string_leaf(brand_string, function, leaf); return; case 0x80000005: get_ext_cpuid_leaf_5(leaf); @@ -370,41 +372,6 @@ void athlon64_venice_t::get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const // leaf 0x80000002 // // leaf 0x80000003 // // leaf 0x80000004 // -void athlon64_venice_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const -{ - // CPUID function 0x80000002-0x80000004 - Processor Name String Identifier - static const char* brand_string = "AMD Athlon(tm) 64 Processor 3000+\0\0\0"; - - switch(function) { - case 0x80000002: - memcpy(&(leaf->eax), brand_string , 4); - memcpy(&(leaf->ebx), brand_string + 4, 4); - memcpy(&(leaf->ecx), brand_string + 8, 4); - memcpy(&(leaf->edx), brand_string + 12, 4); - break; - case 0x80000003: - memcpy(&(leaf->eax), brand_string + 16, 4); - memcpy(&(leaf->ebx), brand_string + 20, 4); - memcpy(&(leaf->ecx), brand_string + 24, 4); - memcpy(&(leaf->edx), brand_string + 28, 4); - break; - case 0x80000004: - memcpy(&(leaf->eax), brand_string + 32, 4); - leaf->ebx = 0; - leaf->ecx = 0; - leaf->edx = 0; - break; - default: - break; - } - -#ifdef BX_BIG_ENDIAN - leaf->eax = bx_bswap32(leaf->eax); - leaf->ebx = bx_bswap32(leaf->ebx); - leaf->ecx = bx_bswap32(leaf->ecx); - leaf->edx = bx_bswap32(leaf->edx); -#endif -} // leaf 0x80000005 // void athlon64_venice_t::get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const diff --git a/bochs/cpu/cpudb/athlon64_venice.h b/bochs/cpu/cpudb/athlon64_venice.h index 558a9390a..ed0867b36 100644 --- a/bochs/cpu/cpudb/athlon64_venice.h +++ b/bochs/cpu/cpudb/athlon64_venice.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -49,7 +49,6 @@ private: void get_ext_cpuid_leaf_0(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const; - void get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_7(cpuid_function_t *leaf) const; diff --git a/bochs/cpu/cpudb/atom_n270.cc b/bochs/cpu/cpudb/atom_n270.cc index 8db4d07b2..e771a14af 100644 --- a/bochs/cpu/cpudb/atom_n270.cc +++ b/bochs/cpu/cpudb/atom_n270.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -38,6 +38,8 @@ atom_n270_t::atom_n270_t(BX_CPU_C *cpu): bx_cpuid_t(cpu) void atom_n270_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_function_t *leaf) const { + static const char* brand_string = " Intel(R) Atom(TM) CPU N270 @ 1.60GHz"; + static bx_bool cpuid_limit_winnt = SIM->get_param_bool(BXPN_CPUID_LIMIT_WINNT)->get(); if (cpuid_limit_winnt) if (function > 2 && function < 0x80000000) function = 2; @@ -52,7 +54,7 @@ void atom_n270_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_func case 0x80000002: case 0x80000003: case 0x80000004: - get_ext_cpuid_brand_string_leaf(function, leaf); + get_ext_cpuid_brand_string_leaf(brand_string, function, leaf); return; case 0x80000005: get_reserved_leaf(leaf); @@ -491,41 +493,6 @@ void atom_n270_t::get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const // leaf 0x80000002 // // leaf 0x80000003 // // leaf 0x80000004 // -void atom_n270_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const -{ - // CPUID function 0x80000002-0x80000004 - Processor Name String Identifier - static const char* brand_string = " Intel(R) Atom(TM) CPU N270 @ 1.60GHz"; - - switch(function) { - case 0x80000002: - memcpy(&(leaf->eax), brand_string , 4); - memcpy(&(leaf->ebx), brand_string + 4, 4); - memcpy(&(leaf->ecx), brand_string + 8, 4); - memcpy(&(leaf->edx), brand_string + 12, 4); - break; - case 0x80000003: - memcpy(&(leaf->eax), brand_string + 16, 4); - memcpy(&(leaf->ebx), brand_string + 20, 4); - memcpy(&(leaf->ecx), brand_string + 24, 4); - memcpy(&(leaf->edx), brand_string + 28, 4); - break; - case 0x80000004: - memcpy(&(leaf->eax), brand_string + 32, 4); - memcpy(&(leaf->ebx), brand_string + 36, 4); - memcpy(&(leaf->ecx), brand_string + 40, 4); - memcpy(&(leaf->edx), brand_string + 44, 4); - break; - default: - break; - } - -#ifdef BX_BIG_ENDIAN - leaf->eax = bx_bswap32(leaf->eax); - leaf->ebx = bx_bswap32(leaf->ebx); - leaf->ecx = bx_bswap32(leaf->ecx); - leaf->edx = bx_bswap32(leaf->edx); -#endif -} // leaf 0x80000005 - L1 Cache and TLB Identifiers (reserved for Intel) diff --git a/bochs/cpu/cpudb/atom_n270.h b/bochs/cpu/cpudb/atom_n270.h index b43c41f91..3b568cee9 100644 --- a/bochs/cpu/cpudb/atom_n270.h +++ b/bochs/cpu/cpudb/atom_n270.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -54,7 +54,6 @@ private: void get_ext_cpuid_leaf_0(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const; - void get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_7(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_8(cpuid_function_t *leaf) const; diff --git a/bochs/cpu/cpudb/core2_penryn_t9600.cc b/bochs/cpu/cpudb/core2_penryn_t9600.cc index 63910a6cf..ff5ab3e19 100644 --- a/bochs/cpu/cpudb/core2_penryn_t9600.cc +++ b/bochs/cpu/cpudb/core2_penryn_t9600.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -41,6 +41,8 @@ core2_penryn_t9600_t::core2_penryn_t9600_t(BX_CPU_C *cpu): bx_cpuid_t(cpu) void core2_penryn_t9600_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_function_t *leaf) const { + static const char* brand_string = "Intel(R) Core(TM)2 Duo CPU T9600 @ 2.80GHz"; + static bx_bool cpuid_limit_winnt = SIM->get_param_bool(BXPN_CPUID_LIMIT_WINNT)->get(); if (cpuid_limit_winnt) if (function > 2 && function < 0x80000000) function = 2; @@ -55,7 +57,7 @@ void core2_penryn_t9600_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, c case 0x80000002: case 0x80000003: case 0x80000004: - get_ext_cpuid_brand_string_leaf(function, leaf); + get_ext_cpuid_brand_string_leaf(brand_string, function, leaf); return; case 0x80000005: get_reserved_leaf(leaf); @@ -573,41 +575,6 @@ void core2_penryn_t9600_t::get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const // leaf 0x80000002 // // leaf 0x80000003 // // leaf 0x80000004 // -void core2_penryn_t9600_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const -{ - // CPUID function 0x80000002-0x80000004 - Processor Name String Identifier - static const char* brand_string = "Intel(R) Core(TM)2 Duo CPU T9600 @ 2.80GHz"; - - switch(function) { - case 0x80000002: - memcpy(&(leaf->eax), brand_string , 4); - memcpy(&(leaf->ebx), brand_string + 4, 4); - memcpy(&(leaf->ecx), brand_string + 8, 4); - memcpy(&(leaf->edx), brand_string + 12, 4); - break; - case 0x80000003: - memcpy(&(leaf->eax), brand_string + 16, 4); - memcpy(&(leaf->ebx), brand_string + 20, 4); - memcpy(&(leaf->ecx), brand_string + 24, 4); - memcpy(&(leaf->edx), brand_string + 28, 4); - break; - case 0x80000004: - memcpy(&(leaf->eax), brand_string + 32, 4); - memcpy(&(leaf->ebx), brand_string + 36, 4); - memcpy(&(leaf->ecx), brand_string + 40, 4); - memcpy(&(leaf->edx), brand_string + 44, 4); - break; - default: - break; - } - -#ifdef BX_BIG_ENDIAN - leaf->eax = bx_bswap32(leaf->eax); - leaf->ebx = bx_bswap32(leaf->ebx); - leaf->ecx = bx_bswap32(leaf->ecx); - leaf->edx = bx_bswap32(leaf->edx); -#endif -} // leaf 0x80000005 - L1 Cache and TLB Identifiers (reserved for Intel) diff --git a/bochs/cpu/cpudb/core2_penryn_t9600.h b/bochs/cpu/cpudb/core2_penryn_t9600.h index 43f37e0b9..9e9a090bd 100644 --- a/bochs/cpu/cpudb/core2_penryn_t9600.h +++ b/bochs/cpu/cpudb/core2_penryn_t9600.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -58,7 +58,6 @@ private: void get_ext_cpuid_leaf_0(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const; - void get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_7(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_8(cpuid_function_t *leaf) const; diff --git a/bochs/cpu/cpudb/core_duo_t2400_yonah.cc b/bochs/cpu/cpudb/core_duo_t2400_yonah.cc index 95a691716..111c98eed 100644 --- a/bochs/cpu/cpudb/core_duo_t2400_yonah.cc +++ b/bochs/cpu/cpudb/core_duo_t2400_yonah.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -38,6 +38,8 @@ core_duo_t2400_yonah_t::core_duo_t2400_yonah_t(BX_CPU_C *cpu): bx_cpuid_t(cpu) void core_duo_t2400_yonah_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_function_t *leaf) const { + static const char* brand_string = "Intel(R) Core(TM) Duo CPU T2400 @ 1.83GHz"; + static bx_bool cpuid_limit_winnt = SIM->get_param_bool(BXPN_CPUID_LIMIT_WINNT)->get(); if (cpuid_limit_winnt) if (function > 2 && function < 0x80000000) function = 2; @@ -52,7 +54,7 @@ void core_duo_t2400_yonah_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, case 0x80000002: case 0x80000003: case 0x80000004: - get_ext_cpuid_brand_string_leaf(function, leaf); + get_ext_cpuid_brand_string_leaf(brand_string, function, leaf); return; case 0x80000005: get_reserved_leaf(leaf); @@ -489,41 +491,6 @@ void core_duo_t2400_yonah_t::get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const // leaf 0x80000002 // // leaf 0x80000003 // // leaf 0x80000004 // -void core_duo_t2400_yonah_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const -{ - // CPUID function 0x80000002-0x80000004 - Processor Name String Identifier - static const char* brand_string = "Intel(R) Core(TM) Duo CPU T2400 @ 1.83GHz"; - - switch(function) { - case 0x80000002: - memcpy(&(leaf->eax), brand_string , 4); - memcpy(&(leaf->ebx), brand_string + 4, 4); - memcpy(&(leaf->ecx), brand_string + 8, 4); - memcpy(&(leaf->edx), brand_string + 12, 4); - break; - case 0x80000003: - memcpy(&(leaf->eax), brand_string + 16, 4); - memcpy(&(leaf->ebx), brand_string + 20, 4); - memcpy(&(leaf->ecx), brand_string + 24, 4); - memcpy(&(leaf->edx), brand_string + 28, 4); - break; - case 0x80000004: - memcpy(&(leaf->eax), brand_string + 32, 4); - memcpy(&(leaf->ebx), brand_string + 36, 4); - memcpy(&(leaf->ecx), brand_string + 40, 4); - memcpy(&(leaf->edx), brand_string + 44, 4); - break; - default: - break; - } - -#ifdef BX_BIG_ENDIAN - leaf->eax = bx_bswap32(leaf->eax); - leaf->ebx = bx_bswap32(leaf->ebx); - leaf->ecx = bx_bswap32(leaf->ecx); - leaf->edx = bx_bswap32(leaf->edx); -#endif -} // leaf 0x80000005 - L1 Cache and TLB Identifiers (reserved for Intel) diff --git a/bochs/cpu/cpudb/core_duo_t2400_yonah.h b/bochs/cpu/cpudb/core_duo_t2400_yonah.h index 764019b33..ca10ce96e 100644 --- a/bochs/cpu/cpudb/core_duo_t2400_yonah.h +++ b/bochs/cpu/cpudb/core_duo_t2400_yonah.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -57,7 +57,6 @@ private: void get_ext_cpuid_leaf_0(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const; - void get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_7(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_8(cpuid_function_t *leaf) const; diff --git a/bochs/cpu/cpudb/corei5_arrandale_m520.cc b/bochs/cpu/cpudb/corei5_arrandale_m520.cc index 65496d5ac..4e47bc03f 100644 --- a/bochs/cpu/cpudb/corei5_arrandale_m520.cc +++ b/bochs/cpu/cpudb/corei5_arrandale_m520.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011-2013 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -44,6 +44,8 @@ corei5_arrandale_m520_t::corei5_arrandale_m520_t(BX_CPU_C *cpu): bx_cpuid_t(cpu) void corei5_arrandale_m520_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_function_t *leaf) const { + static const char* brand_string = "Intel(R) Core(TM) i5 CPU M 520 @ 2.40GHz"; + static bx_bool cpuid_limit_winnt = SIM->get_param_bool(BXPN_CPUID_LIMIT_WINNT)->get(); if (cpuid_limit_winnt) if (function > 2 && function < 0x80000000) function = 2; @@ -58,7 +60,7 @@ void corei5_arrandale_m520_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction case 0x80000002: case 0x80000003: case 0x80000004: - get_ext_cpuid_brand_string_leaf(function, leaf); + get_ext_cpuid_brand_string_leaf(brand_string, function, leaf); return; case 0x80000005: get_reserved_leaf(leaf); @@ -644,41 +646,6 @@ void corei5_arrandale_m520_t::get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const // leaf 0x80000002 // // leaf 0x80000003 // // leaf 0x80000004 // -void corei5_arrandale_m520_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const -{ - // CPUID function 0x80000002-0x80000004 - Processor Name String Identifier - static const char* brand_string = "Intel(R) Core(TM) i5 CPU M 520 @ 2.40GHz"; - - switch(function) { - case 0x80000002: - memcpy(&(leaf->eax), brand_string , 4); - memcpy(&(leaf->ebx), brand_string + 4, 4); - memcpy(&(leaf->ecx), brand_string + 8, 4); - memcpy(&(leaf->edx), brand_string + 12, 4); - break; - case 0x80000003: - memcpy(&(leaf->eax), brand_string + 16, 4); - memcpy(&(leaf->ebx), brand_string + 20, 4); - memcpy(&(leaf->ecx), brand_string + 24, 4); - memcpy(&(leaf->edx), brand_string + 28, 4); - break; - case 0x80000004: - memcpy(&(leaf->eax), brand_string + 32, 4); - memcpy(&(leaf->ebx), brand_string + 36, 4); - memcpy(&(leaf->ecx), brand_string + 40, 4); - memcpy(&(leaf->edx), brand_string + 44, 4); - break; - default: - break; - } - -#ifdef BX_BIG_ENDIAN - leaf->eax = bx_bswap32(leaf->eax); - leaf->ebx = bx_bswap32(leaf->ebx); - leaf->ecx = bx_bswap32(leaf->ecx); - leaf->edx = bx_bswap32(leaf->edx); -#endif -} // leaf 0x80000005 - L1 Cache and TLB Identifiers (reserved for Intel) diff --git a/bochs/cpu/cpudb/corei5_arrandale_m520.h b/bochs/cpu/cpudb/corei5_arrandale_m520.h index 42eb1ce7d..8e648cf57 100644 --- a/bochs/cpu/cpudb/corei5_arrandale_m520.h +++ b/bochs/cpu/cpudb/corei5_arrandale_m520.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011-2013 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -58,7 +58,6 @@ private: void get_ext_cpuid_leaf_0(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const; - void get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_7(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_8(cpuid_function_t *leaf) const; diff --git a/bochs/cpu/cpudb/corei5_lynnfield_750.cc b/bochs/cpu/cpudb/corei5_lynnfield_750.cc index fda9b2348..cc714ed99 100644 --- a/bochs/cpu/cpudb/corei5_lynnfield_750.cc +++ b/bochs/cpu/cpudb/corei5_lynnfield_750.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011-2013 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -44,6 +44,8 @@ corei5_lynnfield_750_t::corei5_lynnfield_750_t(BX_CPU_C *cpu): bx_cpuid_t(cpu) void corei5_lynnfield_750_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_function_t *leaf) const { + static const char* brand_string = "Intel(R) Core(TM) i5 CPU 750 @ 2.67GHz"; + static bx_bool cpuid_limit_winnt = SIM->get_param_bool(BXPN_CPUID_LIMIT_WINNT)->get(); if (cpuid_limit_winnt) if (function > 2 && function < 0x80000000) function = 2; @@ -58,7 +60,7 @@ void corei5_lynnfield_750_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, case 0x80000002: case 0x80000003: case 0x80000004: - get_ext_cpuid_brand_string_leaf(function, leaf); + get_ext_cpuid_brand_string_leaf(brand_string, function, leaf); return; case 0x80000005: get_reserved_leaf(leaf); @@ -620,41 +622,6 @@ void corei5_lynnfield_750_t::get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const // leaf 0x80000002 // // leaf 0x80000003 // // leaf 0x80000004 // -void corei5_lynnfield_750_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const -{ - // CPUID function 0x80000002-0x80000004 - Processor Name String Identifier - static const char* brand_string = "Intel(R) Core(TM) i5 CPU 750 @ 2.67GHz"; - - switch(function) { - case 0x80000002: - memcpy(&(leaf->eax), brand_string , 4); - memcpy(&(leaf->ebx), brand_string + 4, 4); - memcpy(&(leaf->ecx), brand_string + 8, 4); - memcpy(&(leaf->edx), brand_string + 12, 4); - break; - case 0x80000003: - memcpy(&(leaf->eax), brand_string + 16, 4); - memcpy(&(leaf->ebx), brand_string + 20, 4); - memcpy(&(leaf->ecx), brand_string + 24, 4); - memcpy(&(leaf->edx), brand_string + 28, 4); - break; - case 0x80000004: - memcpy(&(leaf->eax), brand_string + 32, 4); - memcpy(&(leaf->ebx), brand_string + 36, 4); - memcpy(&(leaf->ecx), brand_string + 40, 4); - memcpy(&(leaf->edx), brand_string + 44, 4); - break; - default: - break; - } - -#ifdef BX_BIG_ENDIAN - leaf->eax = bx_bswap32(leaf->eax); - leaf->ebx = bx_bswap32(leaf->ebx); - leaf->ecx = bx_bswap32(leaf->ecx); - leaf->edx = bx_bswap32(leaf->edx); -#endif -} // leaf 0x80000005 - L1 Cache and TLB Identifiers (reserved for Intel) diff --git a/bochs/cpu/cpudb/corei5_lynnfield_750.h b/bochs/cpu/cpudb/corei5_lynnfield_750.h index 0b8285e9f..28cf0ecd3 100644 --- a/bochs/cpu/cpudb/corei5_lynnfield_750.h +++ b/bochs/cpu/cpudb/corei5_lynnfield_750.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011-2013 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -58,7 +58,6 @@ private: void get_ext_cpuid_leaf_0(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const; - void get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_7(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_8(cpuid_function_t *leaf) const; diff --git a/bochs/cpu/cpudb/corei7_haswell_4770.cc b/bochs/cpu/cpudb/corei7_haswell_4770.cc index e8c444041..5604b2db6 100644 --- a/bochs/cpu/cpudb/corei7_haswell_4770.cc +++ b/bochs/cpu/cpudb/corei7_haswell_4770.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2013 Stanislav Shwartsman +// Copyright (c) 2013-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -35,9 +35,6 @@ corei7_haswell_4770_t::corei7_haswell_4770_t(BX_CPU_C *cpu): bx_cpuid_t(cpu) if (! BX_SUPPORT_X86_64) BX_PANIC(("You must enable x86-64 for Intel Core i7 Haswell configuration")); - if (! BX_SUPPORT_AVX) - BX_PANIC(("You must enable AVX for Intel Core i7 Haswell configuration")); - if (BX_SUPPORT_VMX == 1) BX_INFO(("You must compile with --enable-vmx=2 for Intel Core i7 Haswell VMX configuration")); @@ -51,6 +48,8 @@ corei7_haswell_4770_t::corei7_haswell_4770_t(BX_CPU_C *cpu): bx_cpuid_t(cpu) void corei7_haswell_4770_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_function_t *leaf) const { + static const char* brand_string = "Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz\0\0\0\0\0\0\0\0"; + static bx_bool cpuid_limit_winnt = SIM->get_param_bool(BXPN_CPUID_LIMIT_WINNT)->get(); if (cpuid_limit_winnt) if (function > 2 && function < 0x80000000) function = 2; @@ -65,7 +64,7 @@ void corei7_haswell_4770_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, case 0x80000002: case 0x80000003: case 0x80000004: - get_ext_cpuid_brand_string_leaf(function, leaf); + get_ext_cpuid_brand_string_leaf(brand_string, function, leaf); return; case 0x80000005: get_reserved_leaf(leaf); @@ -779,41 +778,6 @@ void corei7_haswell_4770_t::get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const // leaf 0x80000002 // // leaf 0x80000003 // // leaf 0x80000004 // -void corei7_haswell_4770_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const -{ - // CPUID function 0x80000002-0x80000004 - Processor Name String Identifier - static const char* brand_string = "Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz"; - - switch(function) { - case 0x80000002: - memcpy(&(leaf->eax), brand_string , 4); - memcpy(&(leaf->ebx), brand_string + 4, 4); - memcpy(&(leaf->ecx), brand_string + 8, 4); - memcpy(&(leaf->edx), brand_string + 12, 4); - break; - case 0x80000003: - memcpy(&(leaf->eax), brand_string + 16, 4); - memcpy(&(leaf->ebx), brand_string + 20, 4); - memcpy(&(leaf->ecx), brand_string + 24, 4); - memcpy(&(leaf->edx), brand_string + 28, 4); - break; - case 0x80000004: - memcpy(&(leaf->eax), brand_string + 32, 4); - memcpy(&(leaf->ebx), brand_string + 36, 4); - leaf->ecx = 0; - leaf->edx = 0; - break; - default: - break; - } - -#ifdef BX_BIG_ENDIAN - leaf->eax = bx_bswap32(leaf->eax); - leaf->ebx = bx_bswap32(leaf->ebx); - leaf->ecx = bx_bswap32(leaf->ecx); - leaf->edx = bx_bswap32(leaf->edx); -#endif -} // leaf 0x80000005 - L1 Cache and TLB Identifiers (reserved for Intel) diff --git a/bochs/cpu/cpudb/corei7_haswell_4770.h b/bochs/cpu/cpudb/corei7_haswell_4770.h index 2056c794c..359bc8982 100644 --- a/bochs/cpu/cpudb/corei7_haswell_4770.h +++ b/bochs/cpu/cpudb/corei7_haswell_4770.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2013 Stanislav Shwartsman +// Copyright (c) 2013-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -60,7 +60,6 @@ private: void get_ext_cpuid_leaf_0(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const; - void get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_7(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_8(cpuid_function_t *leaf) const; diff --git a/bochs/cpu/cpudb/corei7_ivy_bridge_3770K.cc b/bochs/cpu/cpudb/corei7_ivy_bridge_3770K.cc index 718d7984c..d4bf89849 100644 --- a/bochs/cpu/cpudb/corei7_ivy_bridge_3770K.cc +++ b/bochs/cpu/cpudb/corei7_ivy_bridge_3770K.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011-2013 Stanislav Shwartsman +// Copyright (c) 2013-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -35,9 +35,6 @@ corei7_ivy_bridge_3770k_t::corei7_ivy_bridge_3770k_t(BX_CPU_C *cpu): bx_cpuid_t( if (! BX_SUPPORT_X86_64) BX_PANIC(("You must enable x86-64 for Intel Core i7 Ivy Bridge configuration")); - if (! BX_SUPPORT_AVX) - BX_PANIC(("You must enable AVX for Intel Core i7 Ivy Bridge configuration")); - if (BX_SUPPORT_VMX == 1) BX_INFO(("You must compile with --enable-vmx=2 for Intel Core i7 Ivy Bridge VMX configuration")); @@ -49,6 +46,8 @@ corei7_ivy_bridge_3770k_t::corei7_ivy_bridge_3770k_t(BX_CPU_C *cpu): bx_cpuid_t( void corei7_ivy_bridge_3770k_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_function_t *leaf) const { + static const char* brand_string = " Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz"; + static bx_bool cpuid_limit_winnt = SIM->get_param_bool(BXPN_CPUID_LIMIT_WINNT)->get(); if (cpuid_limit_winnt) if (function > 2 && function < 0x80000000) function = 2; @@ -63,7 +62,7 @@ void corei7_ivy_bridge_3770k_t::get_cpuid_leaf(Bit32u function, Bit32u subfuncti case 0x80000002: case 0x80000003: case 0x80000004: - get_ext_cpuid_brand_string_leaf(function, leaf); + get_ext_cpuid_brand_string_leaf(brand_string, function, leaf); return; case 0x80000005: get_reserved_leaf(leaf); @@ -770,41 +769,6 @@ void corei7_ivy_bridge_3770k_t::get_ext_cpuid_leaf_1(cpuid_function_t *leaf) con // leaf 0x80000002 // // leaf 0x80000003 // // leaf 0x80000004 // -void corei7_ivy_bridge_3770k_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const -{ - // CPUID function 0x80000002-0x80000004 - Processor Name String Identifier - static const char* brand_string = " Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz"; - - switch(function) { - case 0x80000002: - memcpy(&(leaf->eax), brand_string , 4); - memcpy(&(leaf->ebx), brand_string + 4, 4); - memcpy(&(leaf->ecx), brand_string + 8, 4); - memcpy(&(leaf->edx), brand_string + 12, 4); - break; - case 0x80000003: - memcpy(&(leaf->eax), brand_string + 16, 4); - memcpy(&(leaf->ebx), brand_string + 20, 4); - memcpy(&(leaf->ecx), brand_string + 24, 4); - memcpy(&(leaf->edx), brand_string + 28, 4); - break; - case 0x80000004: - memcpy(&(leaf->eax), brand_string + 32, 4); - memcpy(&(leaf->ebx), brand_string + 36, 4); - memcpy(&(leaf->ecx), brand_string + 40, 4); - memcpy(&(leaf->edx), brand_string + 44, 4); - break; - default: - break; - } - -#ifdef BX_BIG_ENDIAN - leaf->eax = bx_bswap32(leaf->eax); - leaf->ebx = bx_bswap32(leaf->ebx); - leaf->ecx = bx_bswap32(leaf->ecx); - leaf->edx = bx_bswap32(leaf->edx); -#endif -} // leaf 0x80000005 - L1 Cache and TLB Identifiers (reserved for Intel) diff --git a/bochs/cpu/cpudb/corei7_ivy_bridge_3770K.h b/bochs/cpu/cpudb/corei7_ivy_bridge_3770K.h index 5919b17d3..df45fda99 100644 --- a/bochs/cpu/cpudb/corei7_ivy_bridge_3770K.h +++ b/bochs/cpu/cpudb/corei7_ivy_bridge_3770K.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2013 Stanislav Shwartsman +// Copyright (c) 2013-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -60,7 +60,6 @@ private: void get_ext_cpuid_leaf_0(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const; - void get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_7(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_8(cpuid_function_t *leaf) const; diff --git a/bochs/cpu/cpudb/corei7_sandy_bridge_2600K.cc b/bochs/cpu/cpudb/corei7_sandy_bridge_2600K.cc index 0b10b0f0e..b75d55c5a 100644 --- a/bochs/cpu/cpudb/corei7_sandy_bridge_2600K.cc +++ b/bochs/cpu/cpudb/corei7_sandy_bridge_2600K.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011-2013 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -35,9 +35,6 @@ corei7_sandy_bridge_2600k_t::corei7_sandy_bridge_2600k_t(BX_CPU_C *cpu): bx_cpui if (! BX_SUPPORT_X86_64) BX_PANIC(("You must enable x86-64 for Intel Core i7 Sandy Bridge configuration")); - if (! BX_SUPPORT_AVX) - BX_PANIC(("You must enable AVX for Intel Core i7 Sandy Bridge configuration")); - if (BX_SUPPORT_VMX == 1) BX_INFO(("You must compile with --enable-vmx=2 for Intel Core i7 Sandy Bridge VMX configuration")); @@ -47,6 +44,8 @@ corei7_sandy_bridge_2600k_t::corei7_sandy_bridge_2600k_t(BX_CPU_C *cpu): bx_cpui void corei7_sandy_bridge_2600k_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_function_t *leaf) const { + static const char* brand_string = " Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz"; + static bx_bool cpuid_limit_winnt = SIM->get_param_bool(BXPN_CPUID_LIMIT_WINNT)->get(); if (cpuid_limit_winnt) if (function > 2 && function < 0x80000000) function = 2; @@ -61,7 +60,7 @@ void corei7_sandy_bridge_2600k_t::get_cpuid_leaf(Bit32u function, Bit32u subfunc case 0x80000002: case 0x80000003: case 0x80000004: - get_ext_cpuid_brand_string_leaf(function, leaf); + get_ext_cpuid_brand_string_leaf(brand_string, function, leaf); return; case 0x80000005: get_reserved_leaf(leaf); @@ -709,41 +708,6 @@ void corei7_sandy_bridge_2600k_t::get_ext_cpuid_leaf_1(cpuid_function_t *leaf) c // leaf 0x80000002 // // leaf 0x80000003 // // leaf 0x80000004 // -void corei7_sandy_bridge_2600k_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const -{ - // CPUID function 0x80000002-0x80000004 - Processor Name String Identifier - static const char* brand_string = " Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz"; - - switch(function) { - case 0x80000002: - memcpy(&(leaf->eax), brand_string , 4); - memcpy(&(leaf->ebx), brand_string + 4, 4); - memcpy(&(leaf->ecx), brand_string + 8, 4); - memcpy(&(leaf->edx), brand_string + 12, 4); - break; - case 0x80000003: - memcpy(&(leaf->eax), brand_string + 16, 4); - memcpy(&(leaf->ebx), brand_string + 20, 4); - memcpy(&(leaf->ecx), brand_string + 24, 4); - memcpy(&(leaf->edx), brand_string + 28, 4); - break; - case 0x80000004: - memcpy(&(leaf->eax), brand_string + 32, 4); - memcpy(&(leaf->ebx), brand_string + 36, 4); - memcpy(&(leaf->ecx), brand_string + 40, 4); - memcpy(&(leaf->edx), brand_string + 44, 4); - break; - default: - break; - } - -#ifdef BX_BIG_ENDIAN - leaf->eax = bx_bswap32(leaf->eax); - leaf->ebx = bx_bswap32(leaf->ebx); - leaf->ecx = bx_bswap32(leaf->ecx); - leaf->edx = bx_bswap32(leaf->edx); -#endif -} // leaf 0x80000005 - L1 Cache and TLB Identifiers (reserved for Intel) diff --git a/bochs/cpu/cpudb/corei7_sandy_bridge_2600K.h b/bochs/cpu/cpudb/corei7_sandy_bridge_2600K.h index 5a04e1369..2e72030c9 100644 --- a/bochs/cpu/cpudb/corei7_sandy_bridge_2600K.h +++ b/bochs/cpu/cpudb/corei7_sandy_bridge_2600K.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011-2013 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -59,7 +59,6 @@ private: void get_ext_cpuid_leaf_0(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const; - void get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_7(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_8(cpuid_function_t *leaf) const; diff --git a/bochs/cpu/cpudb/p4_prescott_celeron_336.cc b/bochs/cpu/cpudb/p4_prescott_celeron_336.cc index 3d5a3cfcb..da891a9fb 100644 --- a/bochs/cpu/cpudb/p4_prescott_celeron_336.cc +++ b/bochs/cpu/cpudb/p4_prescott_celeron_336.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -40,6 +40,8 @@ p4_prescott_celeron_336_t::p4_prescott_celeron_336_t(BX_CPU_C *cpu): bx_cpuid_t( void p4_prescott_celeron_336_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_function_t *leaf) const { + static const char* brand_string = " Intel(R) Celeron(R) CPU 2.80GHz"; + switch(function) { case 0x80000000: get_ext_cpuid_leaf_0(leaf); @@ -50,7 +52,7 @@ void p4_prescott_celeron_336_t::get_cpuid_leaf(Bit32u function, Bit32u subfuncti case 0x80000002: case 0x80000003: case 0x80000004: - get_ext_cpuid_brand_string_leaf(function, leaf); + get_ext_cpuid_brand_string_leaf(brand_string, function, leaf); return; case 0x80000005: get_reserved_leaf(leaf); @@ -356,41 +358,6 @@ void p4_prescott_celeron_336_t::get_ext_cpuid_leaf_1(cpuid_function_t *leaf) con // leaf 0x80000002 // // leaf 0x80000003 // // leaf 0x80000004 // -void p4_prescott_celeron_336_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const -{ - // CPUID function 0x80000002-0x80000004 - Processor Name String Identifier - static const char* brand_string = " Intel(R) Celeron(R) CPU 2.80GHz"; - - switch(function) { - case 0x80000002: - memcpy(&(leaf->eax), brand_string , 4); - memcpy(&(leaf->ebx), brand_string + 4, 4); - memcpy(&(leaf->ecx), brand_string + 8, 4); - memcpy(&(leaf->edx), brand_string + 12, 4); - break; - case 0x80000003: - memcpy(&(leaf->eax), brand_string + 16, 4); - memcpy(&(leaf->ebx), brand_string + 20, 4); - memcpy(&(leaf->ecx), brand_string + 24, 4); - memcpy(&(leaf->edx), brand_string + 28, 4); - break; - case 0x80000004: - memcpy(&(leaf->eax), brand_string + 32, 4); - memcpy(&(leaf->ebx), brand_string + 36, 4); - memcpy(&(leaf->ecx), brand_string + 40, 4); - memcpy(&(leaf->edx), brand_string + 44, 4); - break; - default: - break; - } - -#ifdef BX_BIG_ENDIAN - leaf->eax = bx_bswap32(leaf->eax); - leaf->ebx = bx_bswap32(leaf->ebx); - leaf->ecx = bx_bswap32(leaf->ecx); - leaf->edx = bx_bswap32(leaf->edx); -#endif -} // leaf 0x80000005 - L1 Cache and TLB Identifiers (reserved for Intel) diff --git a/bochs/cpu/cpudb/p4_prescott_celeron_336.h b/bochs/cpu/cpudb/p4_prescott_celeron_336.h index 6c7855e84..4d7a6f5bf 100644 --- a/bochs/cpu/cpudb/p4_prescott_celeron_336.h +++ b/bochs/cpu/cpudb/p4_prescott_celeron_336.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -51,7 +51,6 @@ private: void get_ext_cpuid_leaf_0(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const; - void get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_7(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_8(cpuid_function_t *leaf) const; diff --git a/bochs/cpu/cpudb/p4_willamette.cc b/bochs/cpu/cpudb/p4_willamette.cc index bbfcc8b4b..bf6913543 100644 --- a/bochs/cpu/cpudb/p4_willamette.cc +++ b/bochs/cpu/cpudb/p4_willamette.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -31,6 +31,9 @@ void p4_willamette_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_function_t *leaf) const { + // CPUID function 0x80000002-0x80000004 - Processor Name String Identifier + static const char* brand_string = " Intel(R) Pentium(R) 4 CPU 1.80GHz"; + switch(function) { case 0x80000000: get_ext_cpuid_leaf_0(leaf); @@ -41,7 +44,7 @@ void p4_willamette_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_ case 0x80000002: case 0x80000003: case 0x80000004: - get_ext_cpuid_brand_string_leaf(function, leaf); + get_ext_cpuid_brand_string_leaf(brand_string, function, leaf); return; case 0x00000000: get_std_cpuid_leaf_0(leaf); @@ -270,41 +273,6 @@ void p4_willamette_t::get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const // leaf 0x80000002 // // leaf 0x80000003 // // leaf 0x80000004 // -void p4_willamette_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const -{ - // CPUID function 0x80000002-0x80000004 - Processor Name String Identifier - static const char* brand_string = " Intel(R) Pentium(R) 4 CPU 1.80GHz"; - - switch(function) { - case 0x80000002: - memcpy(&(leaf->eax), brand_string , 4); - memcpy(&(leaf->ebx), brand_string + 4, 4); - memcpy(&(leaf->ecx), brand_string + 8, 4); - memcpy(&(leaf->edx), brand_string + 12, 4); - break; - case 0x80000003: - memcpy(&(leaf->eax), brand_string + 16, 4); - memcpy(&(leaf->ebx), brand_string + 20, 4); - memcpy(&(leaf->ecx), brand_string + 24, 4); - memcpy(&(leaf->edx), brand_string + 28, 4); - break; - case 0x80000004: - memcpy(&(leaf->eax), brand_string + 32, 4); - memcpy(&(leaf->ebx), brand_string + 36, 4); - memcpy(&(leaf->ecx), brand_string + 40, 4); - memcpy(&(leaf->edx), brand_string + 44, 4); - break; - default: - break; - } - -#ifdef BX_BIG_ENDIAN - leaf->eax = bx_bswap32(leaf->eax); - leaf->ebx = bx_bswap32(leaf->ebx); - leaf->ecx = bx_bswap32(leaf->ecx); - leaf->edx = bx_bswap32(leaf->edx); -#endif -} void p4_willamette_t::dump_cpuid(void) const { diff --git a/bochs/cpu/cpudb/p4_willamette.h b/bochs/cpu/cpudb/p4_willamette.h index ec6b9a4ff..ed69284e4 100644 --- a/bochs/cpu/cpudb/p4_willamette.h +++ b/bochs/cpu/cpudb/p4_willamette.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -50,7 +50,6 @@ private: void get_ext_cpuid_leaf_0(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const; - void get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const; }; extern bx_cpuid_t *create_p4_willamette_cpuid(BX_CPU_C *cpu); diff --git a/bochs/cpu/cpudb/phenomx3_8650_toliman.cc b/bochs/cpu/cpudb/phenomx3_8650_toliman.cc index 13192b0af..8175ae4a8 100644 --- a/bochs/cpu/cpudb/phenomx3_8650_toliman.cc +++ b/bochs/cpu/cpudb/phenomx3_8650_toliman.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011 Stanislav Shwartsman +// Copyright (c) 2012-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -46,6 +46,8 @@ phenom_8650_toliman_t::phenom_8650_toliman_t(BX_CPU_C *cpu): bx_cpuid_t(cpu) void phenom_8650_toliman_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_function_t *leaf) const { + static const char* brand_string = "AMD Phenom(tm) 8650 Triple-Core Processor\0\0\0\0\0\0\0"; + static bx_bool cpuid_limit_winnt = SIM->get_param_bool(BXPN_CPUID_LIMIT_WINNT)->get(); if (cpuid_limit_winnt) if (function > 1 && function < 0x80000000) function = 1; @@ -60,7 +62,7 @@ void phenom_8650_toliman_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, case 0x80000002: case 0x80000003: case 0x80000004: - get_ext_cpuid_brand_string_leaf(function, leaf); + get_ext_cpuid_brand_string_leaf(brand_string, function, leaf); return; case 0x80000005: get_ext_cpuid_leaf_5(leaf); @@ -488,41 +490,6 @@ void phenom_8650_toliman_t::get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const // leaf 0x80000002 // // leaf 0x80000003 // // leaf 0x80000004 // -void phenom_8650_toliman_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const -{ - // CPUID function 0x80000002-0x80000004 - Processor Name String Identifier - static const char* brand_string = "AMD Phenom(tm) 8650 Triple-Core Processor\0\0\0"; - - switch(function) { - case 0x80000002: - memcpy(&(leaf->eax), brand_string , 4); - memcpy(&(leaf->ebx), brand_string + 4, 4); - memcpy(&(leaf->ecx), brand_string + 8, 4); - memcpy(&(leaf->edx), brand_string + 12, 4); - break; - case 0x80000003: - memcpy(&(leaf->eax), brand_string + 16, 4); - memcpy(&(leaf->ebx), brand_string + 20, 4); - memcpy(&(leaf->ecx), brand_string + 24, 4); - memcpy(&(leaf->edx), brand_string + 28, 4); - break; - case 0x80000004: - memcpy(&(leaf->eax), brand_string + 32, 4); - memcpy(&(leaf->ebx), brand_string + 36, 4); - memcpy(&(leaf->ecx), brand_string + 40, 4); - leaf->edx = 0; - break; - default: - break; - } - -#ifdef BX_BIG_ENDIAN - leaf->eax = bx_bswap32(leaf->eax); - leaf->ebx = bx_bswap32(leaf->ebx); - leaf->ecx = bx_bswap32(leaf->ecx); - leaf->edx = bx_bswap32(leaf->edx); -#endif -} // leaf 0x80000005 // void phenom_8650_toliman_t::get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const diff --git a/bochs/cpu/cpudb/phenomx3_8650_toliman.h b/bochs/cpu/cpudb/phenomx3_8650_toliman.h index c6830927c..b1db8ca95 100644 --- a/bochs/cpu/cpudb/phenomx3_8650_toliman.h +++ b/bochs/cpu/cpudb/phenomx3_8650_toliman.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2012 Stanislav Shwartsman +// Copyright (c) 2012-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -55,7 +55,6 @@ private: void get_ext_cpuid_leaf_0(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const; - void get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_7(cpuid_function_t *leaf) const; diff --git a/bochs/cpu/cpudb/trinity_apu.cc b/bochs/cpu/cpudb/trinity_apu.cc index a0b73e1ca..8372032c5 100644 --- a/bochs/cpu/cpudb/trinity_apu.cc +++ b/bochs/cpu/cpudb/trinity_apu.cc @@ -46,6 +46,8 @@ trinity_apu_t::trinity_apu_t(BX_CPU_C *cpu): bx_cpuid_t(cpu) void trinity_apu_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_function_t *leaf) const { + static const char* brand_string = "AMD A8-5600K APU with Radeon(tm) HD Graphics "; + static bx_bool cpuid_limit_winnt = SIM->get_param_bool(BXPN_CPUID_LIMIT_WINNT)->get(); if (cpuid_limit_winnt) if (function > 1 && function < 0x80000000) function = 1; @@ -60,7 +62,7 @@ void trinity_apu_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_fu case 0x80000002: case 0x80000003: case 0x80000004: - get_ext_cpuid_brand_string_leaf(function, leaf); + get_ext_cpuid_brand_string_leaf(brand_string, function, leaf); return; case 0x80000005: get_ext_cpuid_leaf_5(leaf); @@ -635,40 +637,6 @@ void trinity_apu_t::get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const // leaf 0x80000002 // // leaf 0x80000003 // // leaf 0x80000004 // -void trinity_apu_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const -{ - // CPUID function 0x80000002-0x80000004 - Processor Name String Identifier - static const char* brand_string = "AMD A8-5600K APU with Radeon(tm) HD Graphics "; - switch(function) { - case 0x80000002: - memcpy(&(leaf->eax), brand_string , 4); - memcpy(&(leaf->ebx), brand_string + 4, 4); - memcpy(&(leaf->ecx), brand_string + 8, 4); - memcpy(&(leaf->edx), brand_string + 12, 4); - break; - case 0x80000003: - memcpy(&(leaf->eax), brand_string + 16, 4); - memcpy(&(leaf->ebx), brand_string + 20, 4); - memcpy(&(leaf->ecx), brand_string + 24, 4); - memcpy(&(leaf->edx), brand_string + 28, 4); - break; - case 0x80000004: - memcpy(&(leaf->eax), brand_string + 32, 4); - memcpy(&(leaf->ebx), brand_string + 36, 4); - memcpy(&(leaf->ecx), brand_string + 40, 4); - memcpy(&(leaf->edx), brand_string + 44, 4); - break; - default: - break; - } - -#ifdef BX_BIG_ENDIAN - leaf->eax = bx_bswap32(leaf->eax); - leaf->ebx = bx_bswap32(leaf->ebx); - leaf->ecx = bx_bswap32(leaf->ecx); - leaf->edx = bx_bswap32(leaf->edx); -#endif -} // leaf 0x80000005 // void trinity_apu_t::get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const diff --git a/bochs/cpu/cpudb/trinity_apu.h b/bochs/cpu/cpudb/trinity_apu.h index fc97c11ce..eb3ed2577 100644 --- a/bochs/cpu/cpudb/trinity_apu.h +++ b/bochs/cpu/cpudb/trinity_apu.h @@ -58,7 +58,6 @@ private: void get_ext_cpuid_leaf_0(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const; - void get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_7(cpuid_function_t *leaf) const; diff --git a/bochs/cpu/cpudb/turion64_tyler.cc b/bochs/cpu/cpudb/turion64_tyler.cc index 54d4c2cd8..c25395479 100644 --- a/bochs/cpu/cpudb/turion64_tyler.cc +++ b/bochs/cpu/cpudb/turion64_tyler.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -42,6 +42,8 @@ turion64_tyler_t::turion64_tyler_t(BX_CPU_C *cpu): bx_cpuid_t(cpu) void turion64_tyler_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_function_t *leaf) const { + static const char* brand_string = "AMD Turion(tm) 64 X2 Mobile Technology TL-60"; + switch(function) { case 0x80000000: get_ext_cpuid_leaf_0(leaf); @@ -52,7 +54,7 @@ void turion64_tyler_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid case 0x80000002: case 0x80000003: case 0x80000004: - get_ext_cpuid_brand_string_leaf(function, leaf); + get_ext_cpuid_brand_string_leaf(brand_string, function, leaf); return; case 0x80000005: get_ext_cpuid_leaf_5(leaf); @@ -404,41 +406,6 @@ void turion64_tyler_t::get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const // leaf 0x80000002 // // leaf 0x80000003 // // leaf 0x80000004 // -void turion64_tyler_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const -{ - // CPUID function 0x80000002-0x80000004 - Processor Name String Identifier - static const char* brand_string = "AMD Turion(tm) 64 X2 Mobile Technology TL-60"; - - switch(function) { - case 0x80000002: - memcpy(&(leaf->eax), brand_string , 4); - memcpy(&(leaf->ebx), brand_string + 4, 4); - memcpy(&(leaf->ecx), brand_string + 8, 4); - memcpy(&(leaf->edx), brand_string + 12, 4); - break; - case 0x80000003: - memcpy(&(leaf->eax), brand_string + 16, 4); - memcpy(&(leaf->ebx), brand_string + 20, 4); - memcpy(&(leaf->ecx), brand_string + 24, 4); - memcpy(&(leaf->edx), brand_string + 28, 4); - break; - case 0x80000004: - memcpy(&(leaf->eax), brand_string + 32, 4); - memcpy(&(leaf->ebx), brand_string + 36, 4); - memcpy(&(leaf->ecx), brand_string + 40, 4); - leaf->edx = 0; - break; - default: - break; - } - -#ifdef BX_BIG_ENDIAN - leaf->eax = bx_bswap32(leaf->eax); - leaf->ebx = bx_bswap32(leaf->ebx); - leaf->ecx = bx_bswap32(leaf->ecx); - leaf->edx = bx_bswap32(leaf->edx); -#endif -} // leaf 0x80000005 // void turion64_tyler_t::get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const diff --git a/bochs/cpu/cpudb/turion64_tyler.h b/bochs/cpu/cpudb/turion64_tyler.h index e5e558ff5..b131c3221 100644 --- a/bochs/cpu/cpudb/turion64_tyler.h +++ b/bochs/cpu/cpudb/turion64_tyler.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -49,7 +49,6 @@ private: void get_ext_cpuid_leaf_0(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const; - void get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_7(cpuid_function_t *leaf) const; diff --git a/bochs/cpu/cpudb/zambezi.cc b/bochs/cpu/cpudb/zambezi.cc index 0664a2471..9ab690625 100644 --- a/bochs/cpu/cpudb/zambezi.cc +++ b/bochs/cpu/cpudb/zambezi.cc @@ -46,6 +46,8 @@ zambezi_t::zambezi_t(BX_CPU_C *cpu): bx_cpuid_t(cpu) void zambezi_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_function_t *leaf) const { + static const char* brand_string = "AMD FX(tm)-4100 Quad-Core Processor "; + static bx_bool cpuid_limit_winnt = SIM->get_param_bool(BXPN_CPUID_LIMIT_WINNT)->get(); if (cpuid_limit_winnt) if (function > 1 && function < 0x80000000) function = 1; @@ -60,7 +62,7 @@ void zambezi_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_functi case 0x80000002: case 0x80000003: case 0x80000004: - get_ext_cpuid_brand_string_leaf(function, leaf); + get_ext_cpuid_brand_string_leaf(brand_string, function, leaf); return; case 0x80000005: get_ext_cpuid_leaf_5(leaf); @@ -585,41 +587,6 @@ void zambezi_t::get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const // leaf 0x80000002 // // leaf 0x80000003 // // leaf 0x80000004 // -void zambezi_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const -{ - // CPUID function 0x80000002-0x80000004 - Processor Name String Identifier - static const char* brand_string = "AMD FX(tm)-4100 Quad-Core Processor "; - - switch(function) { - case 0x80000002: - memcpy(&(leaf->eax), brand_string , 4); - memcpy(&(leaf->ebx), brand_string + 4, 4); - memcpy(&(leaf->ecx), brand_string + 8, 4); - memcpy(&(leaf->edx), brand_string + 12, 4); - break; - case 0x80000003: - memcpy(&(leaf->eax), brand_string + 16, 4); - memcpy(&(leaf->ebx), brand_string + 20, 4); - memcpy(&(leaf->ecx), brand_string + 24, 4); - memcpy(&(leaf->edx), brand_string + 28, 4); - break; - case 0x80000004: - memcpy(&(leaf->eax), brand_string + 32, 4); - memcpy(&(leaf->ebx), brand_string + 36, 4); - memcpy(&(leaf->ecx), brand_string + 40, 4); - memcpy(&(leaf->edx), brand_string + 44, 4); - break; - default: - break; - } - -#ifdef BX_BIG_ENDIAN - leaf->eax = bx_bswap32(leaf->eax); - leaf->ebx = bx_bswap32(leaf->ebx); - leaf->ecx = bx_bswap32(leaf->ecx); - leaf->edx = bx_bswap32(leaf->edx); -#endif -} // leaf 0x80000005 // void zambezi_t::get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const diff --git a/bochs/cpu/cpudb/zambezi.h b/bochs/cpu/cpudb/zambezi.h index 2b158c2da..139fdec9e 100644 --- a/bochs/cpu/cpudb/zambezi.h +++ b/bochs/cpu/cpudb/zambezi.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2012-2013 Stanislav Shwartsman +// Copyright (c) 2012-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or @@ -57,7 +57,6 @@ private: void get_ext_cpuid_leaf_0(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const; - void get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const; void get_ext_cpuid_leaf_7(cpuid_function_t *leaf) const; diff --git a/bochs/cpu/cpuid.h b/bochs/cpu/cpuid.h index 31a0c5291..be2cdf0e2 100644 --- a/bochs/cpu/cpuid.h +++ b/bochs/cpu/cpuid.h @@ -77,6 +77,40 @@ protected: leaf->ecx = 0; leaf->edx = 0; } + + void get_ext_cpuid_brand_string_leaf(const char *brand_string, Bit32u function, cpuid_function_t *leaf) const + { + switch(function) { + case 0x80000002: + memcpy(&(leaf->eax), brand_string , 4); + memcpy(&(leaf->ebx), brand_string + 4, 4); + memcpy(&(leaf->ecx), brand_string + 8, 4); + memcpy(&(leaf->edx), brand_string + 12, 4); + break; + case 0x80000003: + memcpy(&(leaf->eax), brand_string + 16, 4); + memcpy(&(leaf->ebx), brand_string + 20, 4); + memcpy(&(leaf->ecx), brand_string + 24, 4); + memcpy(&(leaf->edx), brand_string + 28, 4); + break; + case 0x80000004: + memcpy(&(leaf->eax), brand_string + 32, 4); + memcpy(&(leaf->ebx), brand_string + 36, 4); + memcpy(&(leaf->ecx), brand_string + 40, 4); + memcpy(&(leaf->edx), brand_string + 44, 4); + break; + default: + break; + } + +#ifdef BX_BIG_ENDIAN + leaf->eax = bx_bswap32(leaf->eax); + leaf->ebx = bx_bswap32(leaf->ebx); + leaf->ecx = bx_bswap32(leaf->ecx); + leaf->edx = bx_bswap32(leaf->edx); +#endif + } + }; typedef bx_cpuid_t* (*bx_create_cpuid_method)(BX_CPU_C *cpu); diff --git a/bochs/cpudb.h b/bochs/cpudb.h index d0459c696..f9efd145b 100644 --- a/bochs/cpudb.h +++ b/bochs/cpudb.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (c) 2011-2013 Stanislav Shwartsman +// Copyright (c) 2011-2014 Stanislav Shwartsman // Written by Stanislav Shwartsman [sshwarts at sourceforge net] // // This library is free software; you can redistribute it and/or