fixed 64-bit segment print from internal debugger

This commit is contained in:
Stanislav Shwartsman 2012-06-14 18:56:47 +00:00
parent 02749956e0
commit 720a9b2fb7
18 changed files with 40 additions and 105 deletions

View File

@ -2944,25 +2944,33 @@ void bx_dbg_print_descriptor(Bit32u lo, Bit32u hi)
unsigned s = (hi >> 12) & 0x1;
unsigned d_b = (hi >> 22) & 0x1;
unsigned g = (hi >> 23) & 0x1;
#if BX_SUPPORT_X86_64
unsigned l = (hi >> 21) & 0x1;
#endif
// 32-bit trap gate, target=0010:c0108ec4, DPL=0, present=1
// code segment, base=0000:00cfffff, length=0xffff
if (s) {
// either a code or a data segment. bit 11 (type file MSB) then says
// 0=data segment, 1=code seg
if (type&8) {
dbg_printf("Code segment, base=0x%08x, limit=0x%08x, %s%s%s, %d-bit\n",
if (IS_CODE_SEGMENT(type)) {
dbg_printf("Code segment, base=0x%08x, limit=0x%08x, %s%s%s",
base, g ? (limit * 4096 + 4095) : limit,
(type&2)? "Execute/Read" : "Execute-Only",
(type&4)? ", Conforming" : "",
(type&1)? ", Accessed" : "",
d_b ? 32 : 16);
IS_CODE_SEGMENT_READABLE(type) ? "Execute/Read" : "Execute-Only",
IS_CODE_SEGMENT_CONFORMING(type)? ", Conforming" : "Non-Conforming",
IS_SEGMENT_ACCESSED(type)? ", Accessed" : "");
#if BX_SUPPORT_X86_64
if (l && !d_b)
dbg_printf(", 64-bit\n");
else
#endif
dbg_printf(", %d-bit\n", d_b ? 32 : 16);
} else {
dbg_printf("Data segment, base=0x%08x, limit=0x%08x, %s%s%s\n",
base, g ? (limit * 4096 + 4095) : limit,
(type&2)? "Read/Write" : "Read-Only",
(type&4)? ", Expand-down" : "",
(type&1)? ", Accessed" : "");
IS_DATA_SEGMENT_WRITEABLE(type)? "Read/Write" : "Read-Only",
IS_DATA_SEGMENT_EXPAND_DOWN(type)? ", Expand-down" : "",
IS_SEGMENT_ACCESSED(type)? ", Accessed" : "");
}
} else {
// types from IA32-devel-guide-3, page 3-15.

View File

@ -55,7 +55,7 @@ void atom_n270_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_func
get_ext_cpuid_brand_string_leaf(function, leaf);
return;
case 0x80000005:
get_ext_cpuid_leaf_5(leaf);
get_reserved_leaf(leaf);
return;
case 0x80000006:
get_ext_cpuid_leaf_6(leaf);
@ -521,15 +521,7 @@ void atom_n270_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cpuid_functio
#endif
}
// leaf 0x80000005 //
void atom_n270_t::get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const
{
// CPUID function 0x800000005 - L1 Cache and TLB Identifiers
leaf->eax = 0;
leaf->ebx = 0;
leaf->ecx = 0; // reserved for Intel
leaf->edx = 0;
}
// leaf 0x80000005 - L1 Cache and TLB Identifiers (reserved for Intel)
// leaf 0x80000006 //
void atom_n270_t::get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const

View File

@ -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;
void get_ext_cpuid_leaf_8(cpuid_function_t *leaf) const;

View File

@ -58,7 +58,7 @@ void core2_penryn_t9600_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, c
get_ext_cpuid_brand_string_leaf(function, leaf);
return;
case 0x80000005:
get_ext_cpuid_leaf_5(leaf);
get_reserved_leaf(leaf);
return;
case 0x80000006:
get_ext_cpuid_leaf_6(leaf);
@ -603,15 +603,7 @@ void core2_penryn_t9600_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cpui
#endif
}
// leaf 0x80000005 //
void core2_penryn_t9600_t::get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const
{
// CPUID function 0x800000005 - L1 Cache and TLB Identifiers
leaf->eax = 0;
leaf->ebx = 0;
leaf->ecx = 0; // reserved for Intel
leaf->edx = 0;
}
// leaf 0x80000005 - L1 Cache and TLB Identifiers (reserved for Intel)
// leaf 0x80000006 //
void core2_penryn_t9600_t::get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const

View File

@ -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_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;
void get_ext_cpuid_leaf_8(cpuid_function_t *leaf) const;

View File

@ -55,7 +55,7 @@ void core_duo_t2400_yonah_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction,
get_ext_cpuid_brand_string_leaf(function, leaf);
return;
case 0x80000005:
get_ext_cpuid_leaf_5(leaf);
get_reserved_leaf(leaf);
return;
case 0x80000006:
get_ext_cpuid_leaf_6(leaf);
@ -519,15 +519,7 @@ void core_duo_t2400_yonah_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cp
#endif
}
// leaf 0x80000005 //
void core_duo_t2400_yonah_t::get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const
{
// CPUID function 0x800000005 - L1 Cache and TLB Identifiers
leaf->eax = 0;
leaf->ebx = 0;
leaf->ecx = 0; // reserved for Intel
leaf->edx = 0;
}
// leaf 0x80000005 - L1 Cache and TLB Identifiers (reserved for Intel)
// leaf 0x80000006 //
void core_duo_t2400_yonah_t::get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const

View File

@ -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;
void get_ext_cpuid_leaf_8(cpuid_function_t *leaf) const;

View File

@ -61,7 +61,7 @@ void corei5_arrandale_m520_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction
get_ext_cpuid_brand_string_leaf(function, leaf);
return;
case 0x80000005:
get_ext_cpuid_leaf_5(leaf);
get_reserved_leaf(leaf);
return;
case 0x80000006:
get_ext_cpuid_leaf_6(leaf);
@ -674,15 +674,7 @@ void corei5_arrandale_m520_t::get_ext_cpuid_brand_string_leaf(Bit32u function, c
#endif
}
// leaf 0x80000005 //
void corei5_arrandale_m520_t::get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const
{
// CPUID function 0x800000005 - L1 Cache and TLB Identifiers
leaf->eax = 0;
leaf->ebx = 0;
leaf->ecx = 0; // reserved for Intel
leaf->edx = 0;
}
// leaf 0x80000005 - L1 Cache and TLB Identifiers (reserved for Intel)
// leaf 0x80000006 //
void corei5_arrandale_m520_t::get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const

View File

@ -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_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;
void get_ext_cpuid_leaf_8(cpuid_function_t *leaf) const;

View File

@ -61,7 +61,7 @@ void corei5_lynnfield_750_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction,
get_ext_cpuid_brand_string_leaf(function, leaf);
return;
case 0x80000005:
get_ext_cpuid_leaf_5(leaf);
get_reserved_leaf(leaf);
return;
case 0x80000006:
get_ext_cpuid_leaf_6(leaf);
@ -650,15 +650,7 @@ void corei5_lynnfield_750_t::get_ext_cpuid_brand_string_leaf(Bit32u function, cp
#endif
}
// leaf 0x80000005 //
void corei5_lynnfield_750_t::get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const
{
// CPUID function 0x800000005 - L1 Cache and TLB Identifiers
leaf->eax = 0;
leaf->ebx = 0;
leaf->ecx = 0; // reserved for Intel
leaf->edx = 0;
}
// leaf 0x80000005 - L1 Cache and TLB Identifiers (reserved for Intel)
// leaf 0x80000006 //
void corei5_lynnfield_750_t::get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const

View File

@ -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_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;
void get_ext_cpuid_leaf_8(cpuid_function_t *leaf) const;

View File

@ -66,7 +66,7 @@ void corei7_ivy_bridge_3770k_t::get_cpuid_leaf(Bit32u function, Bit32u subfuncti
get_ext_cpuid_brand_string_leaf(function, leaf);
return;
case 0x80000005:
get_ext_cpuid_leaf_5(leaf);
get_reserved_leaf(leaf);
return;
case 0x80000006:
get_ext_cpuid_leaf_6(leaf);
@ -779,15 +779,7 @@ void corei7_ivy_bridge_3770k_t::get_ext_cpuid_brand_string_leaf(Bit32u function,
#endif
}
// leaf 0x80000005 //
void corei7_ivy_bridge_3770k_t::get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const
{
// CPUID function 0x800000005 - L1 Cache and TLB Identifiers
leaf->eax = 0;
leaf->ebx = 0;
leaf->ecx = 0; // reserved for Intel
leaf->edx = 0;
}
// leaf 0x80000005 - L1 Cache and TLB Identifiers (reserved for Intel)
// leaf 0x80000006 //
void corei7_ivy_bridge_3770k_t::get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const

View File

@ -61,7 +61,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;
void get_ext_cpuid_leaf_8(cpuid_function_t *leaf) const;

View File

@ -64,7 +64,7 @@ void corei7_sandy_bridge_2600k_t::get_cpuid_leaf(Bit32u function, Bit32u subfunc
get_ext_cpuid_brand_string_leaf(function, leaf);
return;
case 0x80000005:
get_ext_cpuid_leaf_5(leaf);
get_reserved_leaf(leaf);
return;
case 0x80000006:
get_ext_cpuid_leaf_6(leaf);
@ -739,15 +739,7 @@ void corei7_sandy_bridge_2600k_t::get_ext_cpuid_brand_string_leaf(Bit32u functio
#endif
}
// leaf 0x80000005 //
void corei7_sandy_bridge_2600k_t::get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const
{
// CPUID function 0x800000005 - L1 Cache and TLB Identifiers
leaf->eax = 0;
leaf->ebx = 0;
leaf->ecx = 0; // reserved for Intel
leaf->edx = 0;
}
// leaf 0x80000005 - L1 Cache and TLB Identifiers (reserved for Intel)
// leaf 0x80000006 //
void corei7_sandy_bridge_2600k_t::get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const

View File

@ -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_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;
void get_ext_cpuid_leaf_8(cpuid_function_t *leaf) const;

View File

@ -53,7 +53,7 @@ void p4_prescott_celeron_336_t::get_cpuid_leaf(Bit32u function, Bit32u subfuncti
get_ext_cpuid_brand_string_leaf(function, leaf);
return;
case 0x80000005:
get_ext_cpuid_leaf_5(leaf);
get_reserved_leaf(leaf);
return;
case 0x80000006:
get_ext_cpuid_leaf_6(leaf);
@ -392,15 +392,7 @@ void p4_prescott_celeron_336_t::get_ext_cpuid_brand_string_leaf(Bit32u function,
#endif
}
// leaf 0x80000005 //
void p4_prescott_celeron_336_t::get_ext_cpuid_leaf_5(cpuid_function_t *leaf) const
{
// CPUID function 0x800000005 - L1 Cache and TLB Identifiers
leaf->eax = 0;
leaf->ebx = 0;
leaf->ecx = 0; // reserved for Intel
leaf->edx = 0;
}
// leaf 0x80000005 - L1 Cache and TLB Identifiers (reserved for Intel)
// leaf 0x80000006 //
void p4_prescott_celeron_336_t::get_ext_cpuid_leaf_6(cpuid_function_t *leaf) const

View File

@ -52,7 +52,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;
void get_ext_cpuid_leaf_8(cpuid_function_t *leaf) const;

View File

@ -155,14 +155,6 @@ union {
#define IS_LONG64_SEGMENT(descriptor) (0)
#endif
#define IS_CODE_SEGMENT(type) (((type) >> 3) & 0x1)
#define IS_CODE_SEGMENT_CONFORMING(type) (((type) >> 2) & 0x1)
#define IS_DATA_SEGMENT_EXPAND_DOWN(type) (((type) >> 2) & 0x1)
#define IS_CODE_SEGMENT_READABLE(type) (((type) >> 1) & 0x1)
#define IS_DATA_SEGMENT_WRITEABLE(type) (((type) >> 1) & 0x1)
#define IS_SEGMENT_ACCESSED(type) ((type) & 0x1)
#define BX_SEGMENT_CODE (0x8)
#define BX_SEGMENT_DATA_EXPAND_DOWN (0x4)
#define BX_SEGMENT_CODE_CONFORMING (0x4)
@ -170,6 +162,13 @@ union {
#define BX_SEGMENT_CODE_READ (0x2)
#define BX_SEGMENT_ACCESSED (0x1)
#define IS_CODE_SEGMENT(type) ((type) & BX_SEGMENT_CODE)
#define IS_CODE_SEGMENT_CONFORMING(type) ((type) & BX_SEGMENT_CODE_CONFORMING)
#define IS_DATA_SEGMENT_EXPAND_DOWN(type) ((type) & BX_SEGMENT_DATA_EXPAND_DOWN)
#define IS_CODE_SEGMENT_READABLE(type) ((type) & BX_SEGMENT_CODE_READ)
#define IS_DATA_SEGMENT_WRITEABLE(type) ((type) & BX_SEGMENT_DATA_WRITE)
#define IS_SEGMENT_ACCESSED(type) ((type) & BX_SEGMENT_ACCESSED)
#define IS_DATA_SEGMENT(type) (! IS_CODE_SEGMENT(type))
#define IS_CODE_SEGMENT_NON_CONFORMING(type) \
(! IS_CODE_SEGMENT_CONFORMING(type))