1 |
2 |
alfik |
/////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// $Id: generic_cpuid.h 11169 2012-05-11 06:51:04Z sshwarts $
|
3 |
|
|
/////////////////////////////////////////////////////////////////////////
|
4 |
|
|
//
|
5 |
|
|
// Copyright (c) 2011-2012 Stanislav Shwartsman
|
6 |
|
|
// Written by Stanislav Shwartsman [sshwarts at sourceforge net]
|
7 |
|
|
//
|
8 |
|
|
// This library is free software; you can redistribute it and/or
|
9 |
|
|
// modify it under the terms of the GNU Lesser General Public
|
10 |
|
|
// License as published by the Free Software Foundation; either
|
11 |
|
|
// version 2 of the License, or (at your option) any later version.
|
12 |
|
|
//
|
13 |
|
|
// This library is distributed in the hope that it will be useful,
|
14 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
16 |
|
|
// Lesser General Public License for more details.
|
17 |
|
|
//
|
18 |
|
|
// You should have received a copy of the GNU Lesser General Public
|
19 |
|
|
// License along with this library; if not, write to the Free Software
|
20 |
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA B 02110-1301 USA
|
21 |
|
|
//
|
22 |
|
|
/////////////////////////////////////////////////////////////////////////
|
23 |
|
|
|
24 |
|
|
#ifndef BX_GENERIC_CPUID_DEFINITIONS_H
|
25 |
|
|
#define BX_GENERIC_CPUID_DEFINITIONS_H
|
26 |
|
|
|
27 |
|
|
#if BX_CPU_LEVEL >= 4
|
28 |
|
|
|
29 |
|
|
#include "cpu/cpuid.h"
|
30 |
|
|
|
31 |
|
|
class bx_generic_cpuid_t : public bx_cpuid_t {
|
32 |
|
|
public:
|
33 |
|
|
bx_generic_cpuid_t(BX_CPU_C *cpu);
|
34 |
|
|
virtual ~bx_generic_cpuid_t() {}
|
35 |
|
|
|
36 |
|
|
// return CPU name
|
37 |
|
|
virtual const char *get_name(void) const { return "bochs"; }
|
38 |
|
|
|
39 |
|
|
virtual Bit64u get_isa_extensions_bitmask(void) const { return isa_extensions_bitmask; }
|
40 |
|
|
virtual Bit32u get_cpu_extensions_bitmask(void) const { return cpu_extensions_bitmask; }
|
41 |
|
|
#if BX_SUPPORT_VMX
|
42 |
|
|
virtual Bit32u get_vmx_extensions_bitmask(void) const { return vmx_extensions_bitmask; }
|
43 |
|
|
#endif
|
44 |
|
|
#if BX_SUPPORT_SVM
|
45 |
|
|
virtual Bit32u get_svm_extensions_bitmask(void) const { return svm_extensions_bitmask; }
|
46 |
|
|
#endif
|
47 |
|
|
|
48 |
|
|
virtual void get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_function_t *leaf) const;
|
49 |
|
|
|
50 |
|
|
virtual void dump_cpuid(void) const;
|
51 |
|
|
|
52 |
|
|
private:
|
53 |
|
|
void init_isa_extensions_bitmask(void);
|
54 |
|
|
void init_cpu_extensions_bitmask(void);
|
55 |
|
|
#if BX_SUPPORT_VMX
|
56 |
|
|
void init_vmx_extensions_bitmask(void);
|
57 |
|
|
#endif
|
58 |
|
|
#if BX_SUPPORT_SVM
|
59 |
|
|
void init_svm_extensions_bitmask(void);
|
60 |
|
|
#endif
|
61 |
|
|
|
62 |
|
|
Bit64u isa_extensions_bitmask;
|
63 |
|
|
Bit32u cpu_extensions_bitmask;
|
64 |
|
|
#if BX_SUPPORT_VMX
|
65 |
|
|
Bit32u vmx_extensions_bitmask;
|
66 |
|
|
#endif
|
67 |
|
|
#if BX_SUPPORT_SVM
|
68 |
|
|
Bit32u svm_extensions_bitmask;
|
69 |
|
|
#endif
|
70 |
|
|
|
71 |
|
|
unsigned max_std_leaf;
|
72 |
|
|
unsigned max_ext_leaf;
|
73 |
|
|
|
74 |
|
|
void get_std_cpuid_leaf_0(cpuid_function_t *leaf) const;
|
75 |
|
|
void get_std_cpuid_leaf_1(cpuid_function_t *leaf) const;
|
76 |
|
|
#if BX_CPU_LEVEL >= 6
|
77 |
|
|
void get_std_cpuid_leaf_2(cpuid_function_t *leaf) const;
|
78 |
|
|
void get_std_cpuid_leaf_4(Bit32u subfunction, cpuid_function_t *leaf) const;
|
79 |
|
|
void get_std_cpuid_leaf_5(cpuid_function_t *leaf) const;
|
80 |
|
|
void get_std_cpuid_leaf_6(cpuid_function_t *leaf) const;
|
81 |
|
|
void get_std_cpuid_leaf_7(Bit32u subfunction, cpuid_function_t *leaf) const;
|
82 |
|
|
void get_std_cpuid_leaf_A(cpuid_function_t *leaf) const;
|
83 |
|
|
void get_std_cpuid_extended_topology_leaf(Bit32u subfunction, cpuid_function_t *leaf) const;
|
84 |
|
|
void get_std_cpuid_xsave_leaf(Bit32u subfunction, cpuid_function_t *leaf) const;
|
85 |
|
|
|
86 |
|
|
void get_ext_cpuid_leaf_0(cpuid_function_t *leaf) const;
|
87 |
|
|
void get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const;
|
88 |
|
|
void get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_function_t *leaf) const;
|
89 |
|
|
void get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const;
|
90 |
|
|
void get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const;
|
91 |
|
|
void get_ext_cpuid_leaf_7(cpuid_function_t *leaf) const;
|
92 |
|
|
void get_ext_cpuid_leaf_8(cpuid_function_t *leaf) const;
|
93 |
|
|
#if BX_SUPPORT_SVM
|
94 |
|
|
void get_ext_cpuid_leaf_A(cpuid_function_t *leaf) const;
|
95 |
|
|
#endif
|
96 |
|
|
|
97 |
|
|
Bit32u get_std2_cpuid_features(void) const;
|
98 |
|
|
Bit32u get_ext2_cpuid_features(void) const;
|
99 |
|
|
Bit32u get_ext3_cpuid_features(void) const;
|
100 |
|
|
Bit32u get_extended_cpuid_features(void) const;
|
101 |
|
|
#endif
|
102 |
|
|
|
103 |
|
|
Bit32u get_cpu_version_information(void) const;
|
104 |
|
|
Bit32u get_std_cpuid_features(void) const;
|
105 |
|
|
};
|
106 |
|
|
|
107 |
|
|
extern bx_cpuid_t *create_bx_generic_cpuid(BX_CPU_C *cpu);
|
108 |
|
|
|
109 |
|
|
#endif // BX_CPU_LEVEL >= 4
|
110 |
|
|
|
111 |
|
|
#endif
|