fixed debugger enabled code

This commit is contained in:
Stanislav Shwartsman 2014-08-31 18:48:04 +00:00
parent 9f57e70d5f
commit b6147d9de8
3 changed files with 21 additions and 17 deletions

View File

@ -1042,8 +1042,7 @@ void bx_dbg_info_control_regs_command(void)
(cr4 & (1<<1)) ? "PVI" : "pvi",
(cr4 & (1<<0)) ? "VME" : "vme");
#if BX_SUPPORT_X86_64
Bit64u cpu_extensions_bitmask = SIM->get_param_num("cpu_extensions_bitmask", dbg_cpu_list)->get();
if ((cpu_extensions_bitmask & BX_CPU_LONG_MODE) != 0) {
if (BX_CPU(dbg_cpu)->is_cpu_extension_supported(BX_ISA_LONG_MODE)) {
dbg_printf("CR8: 0x%x\n", BX_CPU(dbg_cpu)->get_cr8());
}
#endif
@ -1056,8 +1055,7 @@ void bx_dbg_info_control_regs_command(void)
(efer & (1<<0)) ? "SCE" : "sce");
#endif
#if BX_CPU_LEVEL >= 6
Bit64u isa_extensions_bitmask = SIM->get_param_num("isa_extensions_bitmask", dbg_cpu_list)->get64();
if ((isa_extensions_bitmask & BX_ISA_XSAVE) != 0) {
if (BX_CPU(dbg_cpu)->is_cpu_extension_supported(BX_ISA_XSAVE)) {
Bit32u xcr0 = SIM->get_param_num("XCR0", dbg_cpu_list)->get();
dbg_printf("XCR0=0x%08x: %s %s %s %s %s %s %s %s\n", xcr0,
(xcr0 & (1<<7)) ? "HI_ZMM" : "hi_zmm",

View File

@ -5013,6 +5013,11 @@ public: // for now...
BX_SMF BX_CPP_INLINE Bit8u get_apic_id(void) { return BX_CPU_THIS_PTR bx_cpuid; }
#endif
BX_CPP_INLINE bx_bool is_cpu_extension_supported(unsigned extension) const {
assert(extension < BX_ISA_EXTENSION_LAST);
return ia_extensions_bitmask[extension / 32] & (1 << (extension % 32));
}
BX_SMF BX_CPP_INLINE int bx_cpuid_support_x86_64(void);
BX_SMF BX_CPP_INLINE int bx_cpuid_support_debug_extensions(void);
BX_SMF BX_CPP_INLINE int bx_cpuid_support_1g_paging(void);

View File

@ -131,6 +131,7 @@ public:
}
BX_CPP_INLINE bx_bool is_cpu_extension_supported(unsigned extension) const {
assert(extension < BX_ISA_EXTENSION_LAST);
return ia_extensions_bitmask[extension / 32] & (1 << (extension % 32));
}
@ -166,30 +167,30 @@ protected:
Bit32u ia_extensions_bitmask[BX_ISA_EXTENSIONS_ARRAY_SIZE];
BX_CPP_INLINE void enable_cpu_extension(unsigned extension) {
assert(extension < BX_ISA_EXTENSION_LAST);
ia_extensions_bitmask[extension / 32] |= (1 << (extension % 32));
assert(extension < BX_ISA_EXTENSION_LAST);
ia_extensions_bitmask[extension / 32] |= (1 << (extension % 32));
}
BX_CPP_INLINE void disable_cpu_extension(unsigned extension) {
assert(extension < BX_ISA_EXTENSION_LAST);
ia_extensions_bitmask[extension / 32] &= ~(1 << (extension % 32));
assert(extension < BX_ISA_EXTENSION_LAST);
ia_extensions_bitmask[extension / 32] &= ~(1 << (extension % 32));
}
BX_CPP_INLINE void register_cpu_extensions(Bit8u *extensions)
{
while(1) {
unsigned cpu_extension = *extensions++;
if (cpu_extension == BX_ISA_EXTENSION_LAST) break;
enable_cpu_extension(cpu_extension);
}
while(1) {
unsigned cpu_extension = *extensions++;
if (cpu_extension == BX_ISA_EXTENSION_LAST) break;
enable_cpu_extension(cpu_extension);
}
}
BX_CPP_INLINE void get_reserved_leaf(cpuid_function_t *leaf) const
{
leaf->eax = 0;
leaf->ebx = 0;
leaf->ecx = 0;
leaf->edx = 0;
leaf->eax = 0;
leaf->ebx = 0;
leaf->ecx = 0;
leaf->edx = 0;
}
BX_CPP_INLINE void get_ext_cpuid_brand_string_leaf(const char *brand_string, Bit32u function, cpuid_function_t *leaf) const