diff --git a/bochs/bx_debug/dbg_main.cc b/bochs/bx_debug/dbg_main.cc index 7cc292388..8044f5f89 100644 --- a/bochs/bx_debug/dbg_main.cc +++ b/bochs/bx_debug/dbg_main.cc @@ -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. diff --git a/bochs/cpu/cpudb/atom_n270.cc b/bochs/cpu/cpudb/atom_n270.cc index 60657a5bc..c97627581 100644 --- a/bochs/cpu/cpudb/atom_n270.cc +++ b/bochs/cpu/cpudb/atom_n270.cc @@ -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 diff --git a/bochs/cpu/cpudb/atom_n270.h b/bochs/cpu/cpudb/atom_n270.h index aabe6484c..b43c41f91 100644 --- a/bochs/cpu/cpudb/atom_n270.h +++ b/bochs/cpu/cpudb/atom_n270.h @@ -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; diff --git a/bochs/cpu/cpudb/core2_penryn_t9600.cc b/bochs/cpu/cpudb/core2_penryn_t9600.cc index def68418e..09abf1ca1 100644 --- a/bochs/cpu/cpudb/core2_penryn_t9600.cc +++ b/bochs/cpu/cpudb/core2_penryn_t9600.cc @@ -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 diff --git a/bochs/cpu/cpudb/core2_penryn_t9600.h b/bochs/cpu/cpudb/core2_penryn_t9600.h index ae9586c60..43f37e0b9 100644 --- a/bochs/cpu/cpudb/core2_penryn_t9600.h +++ b/bochs/cpu/cpudb/core2_penryn_t9600.h @@ -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; diff --git a/bochs/cpu/cpudb/core_duo_t2400_yonah.cc b/bochs/cpu/cpudb/core_duo_t2400_yonah.cc index 17c0950bd..6f6e6dd65 100644 --- a/bochs/cpu/cpudb/core_duo_t2400_yonah.cc +++ b/bochs/cpu/cpudb/core_duo_t2400_yonah.cc @@ -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 diff --git a/bochs/cpu/cpudb/core_duo_t2400_yonah.h b/bochs/cpu/cpudb/core_duo_t2400_yonah.h index 6d487b7d7..764019b33 100644 --- a/bochs/cpu/cpudb/core_duo_t2400_yonah.h +++ b/bochs/cpu/cpudb/core_duo_t2400_yonah.h @@ -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; diff --git a/bochs/cpu/cpudb/corei5_arrandale_m520.cc b/bochs/cpu/cpudb/corei5_arrandale_m520.cc index c1fbcaa06..82e2518f9 100644 --- a/bochs/cpu/cpudb/corei5_arrandale_m520.cc +++ b/bochs/cpu/cpudb/corei5_arrandale_m520.cc @@ -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 diff --git a/bochs/cpu/cpudb/corei5_arrandale_m520.h b/bochs/cpu/cpudb/corei5_arrandale_m520.h index c221de105..f28b39f9f 100644 --- a/bochs/cpu/cpudb/corei5_arrandale_m520.h +++ b/bochs/cpu/cpudb/corei5_arrandale_m520.h @@ -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; diff --git a/bochs/cpu/cpudb/corei5_lynnfield_750.cc b/bochs/cpu/cpudb/corei5_lynnfield_750.cc index 6994a1086..e9b197c26 100644 --- a/bochs/cpu/cpudb/corei5_lynnfield_750.cc +++ b/bochs/cpu/cpudb/corei5_lynnfield_750.cc @@ -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 diff --git a/bochs/cpu/cpudb/corei5_lynnfield_750.h b/bochs/cpu/cpudb/corei5_lynnfield_750.h index 24603d24f..53f8a45c0 100644 --- a/bochs/cpu/cpudb/corei5_lynnfield_750.h +++ b/bochs/cpu/cpudb/corei5_lynnfield_750.h @@ -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; diff --git a/bochs/cpu/cpudb/corei7_ivy_bridge_3770K.cc b/bochs/cpu/cpudb/corei7_ivy_bridge_3770K.cc index a83bdf3bb..7f1e85ad8 100755 --- a/bochs/cpu/cpudb/corei7_ivy_bridge_3770K.cc +++ b/bochs/cpu/cpudb/corei7_ivy_bridge_3770K.cc @@ -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 diff --git a/bochs/cpu/cpudb/corei7_ivy_bridge_3770K.h b/bochs/cpu/cpudb/corei7_ivy_bridge_3770K.h index ea195dcd4..71fe7590e 100755 --- a/bochs/cpu/cpudb/corei7_ivy_bridge_3770K.h +++ b/bochs/cpu/cpudb/corei7_ivy_bridge_3770K.h @@ -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; diff --git a/bochs/cpu/cpudb/corei7_sandy_bridge_2600K.cc b/bochs/cpu/cpudb/corei7_sandy_bridge_2600K.cc index 33311d79b..0ca7a7ce7 100644 --- a/bochs/cpu/cpudb/corei7_sandy_bridge_2600K.cc +++ b/bochs/cpu/cpudb/corei7_sandy_bridge_2600K.cc @@ -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 diff --git a/bochs/cpu/cpudb/corei7_sandy_bridge_2600K.h b/bochs/cpu/cpudb/corei7_sandy_bridge_2600K.h index 02a714161..9c5067233 100644 --- a/bochs/cpu/cpudb/corei7_sandy_bridge_2600K.h +++ b/bochs/cpu/cpudb/corei7_sandy_bridge_2600K.h @@ -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; diff --git a/bochs/cpu/cpudb/p4_prescott_celeron_336.cc b/bochs/cpu/cpudb/p4_prescott_celeron_336.cc index 994dc1530..3f93b57a6 100644 --- a/bochs/cpu/cpudb/p4_prescott_celeron_336.cc +++ b/bochs/cpu/cpudb/p4_prescott_celeron_336.cc @@ -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 diff --git a/bochs/cpu/cpudb/p4_prescott_celeron_336.h b/bochs/cpu/cpudb/p4_prescott_celeron_336.h index fb7f3effb..6c7855e84 100644 --- a/bochs/cpu/cpudb/p4_prescott_celeron_336.h +++ b/bochs/cpu/cpudb/p4_prescott_celeron_336.h @@ -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; diff --git a/bochs/cpu/descriptor.h b/bochs/cpu/descriptor.h index 482e70b02..11a0a7db3 100644 --- a/bochs/cpu/descriptor.h +++ b/bochs/cpu/descriptor.h @@ -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))