From f6396de61e93a30610bc27f651a04bdecc4da095 Mon Sep 17 00:00:00 2001 From: Stanislav Shwartsman Date: Tue, 1 Nov 2011 13:24:42 +0000 Subject: [PATCH] fixed segfault in debugger creg command when xsave is disabled --- bochs/bx_debug/dbg_main.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/bochs/bx_debug/dbg_main.cc b/bochs/bx_debug/dbg_main.cc index 51a94a147..6720a8422 100644 --- a/bochs/bx_debug/dbg_main.cc +++ b/bochs/bx_debug/dbg_main.cc @@ -749,7 +749,7 @@ void bx_dbg_print_mxcsr_state(void) void bx_dbg_print_sse_state(void) { #if BX_CPU_LEVEL >= 6 - Bit32u isa_extensions_bitmask = SIM->get_param_num("isa_extensions_bitmask", dbg_cpu_list)->get(); + Bit64u isa_extensions_bitmask = SIM->get_param_num("isa_extensions_bitmask", dbg_cpu_list)->get(); if ((isa_extensions_bitmask & BX_ISA_SSE) != 0) { bx_dbg_print_mxcsr_state(); @@ -774,7 +774,7 @@ void bx_dbg_print_sse_state(void) void bx_dbg_print_avx_state(unsigned vlen) { #if BX_SUPPORT_AVX - Bit32u isa_extensions_bitmask = SIM->get_param_num("isa_extensions_bitmask", dbg_cpu_list)->get(); + Bit64u isa_extensions_bitmask = SIM->get_param_num("isa_extensions_bitmask", dbg_cpu_list)->get(); if ((isa_extensions_bitmask & BX_ISA_AVX) != 0) { bx_dbg_print_mxcsr_state(); @@ -804,7 +804,7 @@ void bx_dbg_print_avx_state(unsigned vlen) void bx_dbg_print_mmx_state(void) { #if BX_CPU_LEVEL >= 5 - Bit32u isa_extensions_bitmask = SIM->get_param_num("isa_extensions_bitmask", dbg_cpu_list)->get(); + Bit64u isa_extensions_bitmask = SIM->get_param_num("isa_extensions_bitmask", dbg_cpu_list)->get(); if ((isa_extensions_bitmask & BX_ISA_MMX) != 0) { char param_name[20]; @@ -947,10 +947,13 @@ void bx_dbg_info_control_regs_command(void) #endif #if BX_CPU_LEVEL >= 6 Bit32u xcr0 = SIM->get_param_num("XCR0", dbg_cpu_list)->get(); - dbg_printf("XCR0=0x%08x: %s %s %s\n", xcr0, - (xcr0 & (1<<2)) ? "AVX" : "avx", - (xcr0 & (1<<1)) ? "SSE" : "sse", - (xcr0 & (1<<0)) ? "FPU" : "fpu"); + Bit64u isa_extensions_bitmask = SIM->get_param_num("isa_extensions_bitmask", dbg_cpu_list)->get(); + if ((isa_extensions_bitmask & BX_ISA_XSAVE) != 0) { + dbg_printf("XCR0=0x%08x: %s %s %s\n", xcr0, + (xcr0 & (1<<2)) ? "AVX" : "avx", + (xcr0 & (1<<1)) ? "SSE" : "sse", + (xcr0 & (1<<0)) ? "FPU" : "fpu"); + } #endif }