more changes towards configurable cpuid

This commit is contained in:
Stanislav Shwartsman 2011-05-24 18:23:28 +00:00
parent 0638a4174d
commit de95fa8e13
2 changed files with 45 additions and 12 deletions

View File

@ -636,10 +636,17 @@ typedef struct
#define BX_CPU_X86_64 (1 << 28) /* x86-64 instruction */
// cpuid non-ISA features
#define BX_CPU_XAPIC (1 << 0) /* XAPIC support */
#define BX_CPU_X2APIC (1 << 1) /* X2APIC support */
#define BX_CPU_1G_PAGES (1 << 2) /* 1Gb pages support */
#define BX_CPU_PCID (1 << 3) /* PCID pages support */
#define BX_CPU_DEBUG_EXTENSIONS (1 << 0) /* Debug Extensions support */
#define BX_CPU_VME (1 << 1) /* VME support */
#define BX_CPU_PSE (1 << 2) /* PSE support */
#define BX_CPU_PAE (1 << 3) /* PAE support */
#define BX_CPU_PGE (1 << 4) /* Global Pages support */
#define BX_CPU_PSE36 (1 << 5) /* PSE-36 support */
#define BX_CPU_PAT_MTRR (1 << 6) /* PAT and MTRR support */
#define BX_CPU_XAPIC (1 << 7) /* XAPIC support */
#define BX_CPU_X2APIC (1 << 8) /* X2APIC support */
#define BX_CPU_1G_PAGES (1 << 9) /* 1Gb pages support */
#define BX_CPU_PCID (1 << 10) /* PCID pages support */
#include "cpuid.h"
#include "crregs.h"

View File

@ -218,15 +218,21 @@ Bit32u BX_CPU_C::get_std_cpuid_features(void)
#if BX_CPU_LEVEL >= 5
if (BX_CPUID_SUPPORT_ISA_EXTENSION(BX_CPU_PENTIUM)) {
// Pentium only features
features |= BX_CPUID_STD_VME;
features |= BX_CPUID_STD_DEBUG_EXTENSIONS;
features |= BX_CPUID_STD_PSE;
features |= BX_CPUID_STD_TSC;
features |= BX_CPUID_STD_MSR;
// support Machine Check
features |= BX_CPUID_STD_MCE | BX_CPUID_STD_MCA;
features |= BX_CPUID_STD_CMPXCHG8B;
}
if (BX_CPUID_SUPPORT_CPU_EXTENSION(BX_CPU_VME))
features |= BX_CPUID_STD_VME;
if (BX_CPUID_SUPPORT_CPU_EXTENSION(BX_CPU_DEBUG_EXTENSIONS))
features |= BX_CPUID_STD_DEBUG_EXTENSIONS;
if (BX_CPUID_SUPPORT_CPU_EXTENSION(BX_CPU_PSE))
features |= BX_CPUID_STD_PSE;
#endif
#if BX_SUPPORT_APIC
@ -249,15 +255,22 @@ Bit32u BX_CPU_C::get_std_cpuid_features(void)
#if BX_CPU_LEVEL >= 6
if (BX_CPUID_SUPPORT_ISA_EXTENSION(BX_CPU_P6)) {
features |= BX_CPUID_STD_PAE;
features |= BX_CPUID_STD_MTRR;
features |= BX_CPUID_STD_GLOBAL_PAGES;
features |= BX_CPUID_STD_CMOV;
features |= BX_CPUID_STD_PAT;
features |= BX_CPUID_STD_PSE36;
features |= BX_CPUID_STD_ACPI;
}
if (BX_CPUID_SUPPORT_CPU_EXTENSION(BX_CPU_PAT_MTRR))
features |= BX_CPUID_STD_PAT | BX_CPUID_STD_MTRR;
if (BX_CPUID_SUPPORT_CPU_EXTENSION(BX_CPU_PAE))
features |= BX_CPUID_STD_PAE;
if (BX_CPUID_SUPPORT_CPU_EXTENSION(BX_CPU_PGE))
features |= BX_CPUID_STD_GLOBAL_PAGES;
if (BX_CPUID_SUPPORT_CPU_EXTENSION(BX_CPU_PSE36))
features |= BX_CPUID_STD_PSE36;
if (BX_CPUID_SUPPORT_ISA_EXTENSION(BX_CPU_FXSAVE_FXRSTOR))
features |= BX_CPUID_STD_FXSAVE_FXRSTOR;
@ -1178,6 +1191,19 @@ void BX_CPU_C::init_cpu_features_bitmask(void)
}
#endif
#if BX_CPU_LEVEL >= 5
features_bitmask |= BX_CPU_VME;
features_bitmask |= BX_CPU_DEBUG_EXTENSIONS;
features_bitmask |= BX_CPU_PSE;
#endif
#if BX_CPU_LEVEL >= 6
features_bitmask |= BX_CPU_PAE;
features_bitmask |= BX_CPU_PGE;
features_bitmask |= BX_CPU_PSE36;
features_bitmask |= BX_CPU_PAT_MTRR;
#endif
#if BX_SUPPORT_X86_64
static bx_bool pcid_enabled = SIM->get_param_bool(BXPN_CPUID_PCID)->get();
if (pcid_enabled)