| 1 | ///////////////////////////////////////////////////////////////////////// |
| 2 | // $Id$ |
| 3 | ///////////////////////////////////////////////////////////////////////// |
| 4 | // |
| 5 | // Copyright (c) 2013-2017 Stanislav Shwartsman |
| 6 | // Written by Stanislav Shwartsman [sshwarts at sourceforge net] |
| 7 | // |
| 8 | // This library is free software; you can redistribute it and/or |
| 9 | // modify it under the terms of the GNU Lesser General Public |
| 10 | // License as published by the Free Software Foundation; either |
| 11 | // version 2 of the License, or (at your option) any later version. |
| 12 | // |
| 13 | // This library is distributed in the hope that it will be useful, |
| 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | // Lesser General Public License for more details. |
| 17 | // |
| 18 | // You should have received a copy of the GNU Lesser General Public |
| 19 | // License along with this library; if not, write to the Free Software |
| 20 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA B 02110-1301 USA |
| 21 | // |
| 22 | ///////////////////////////////////////////////////////////////////////// |
| 23 | |
| 24 | #include "bochs.h" |
| 25 | #include "cpu.h" |
| 26 | #include "gui/siminterface.h" |
| 27 | #include "param_names.h" |
| 28 | #include "corei7_ivy_bridge_3770K.h" |
| 29 | |
| 30 | #define LOG_THIS cpu-> |
| 31 | |
| 32 | #if BX_SUPPORT_X86_64 && BX_SUPPORT_AVX |
| 33 | |
| 34 | corei7_ivy_bridge_3770k_t::corei7_ivy_bridge_3770k_t(BX_CPU_C *cpu): bx_cpuid_t(cpu) |
| 35 | { |
| 36 | if (BX_SUPPORT_VMX == 1) |
| 37 | BX_INFO(("You must compile with --enable-vmx=2 for Intel Core i7 Ivy Bridge VMX configuration")); |
| 38 | |
| 39 | if (! BX_SUPPORT_MONITOR_MWAIT) |
| 40 | BX_INFO(("WARNING: MONITOR/MWAIT support is not compiled in !")); |
| 41 | |
| 42 | enable_cpu_extension(BX_ISA_X87); |
| 43 | enable_cpu_extension(BX_ISA_486); |
| 44 | enable_cpu_extension(BX_ISA_PENTIUM); |
| 45 | enable_cpu_extension(BX_ISA_P6); |
| 46 | enable_cpu_extension(BX_ISA_MMX); |
| 47 | enable_cpu_extension(BX_ISA_SYSENTER_SYSEXIT); |
| 48 | enable_cpu_extension(BX_ISA_CLFLUSH); |
| 49 | enable_cpu_extension(BX_ISA_DEBUG_EXTENSIONS); |
| 50 | enable_cpu_extension(BX_ISA_VME); |
| 51 | enable_cpu_extension(BX_ISA_PSE); |
| 52 | enable_cpu_extension(BX_ISA_PAE); |
| 53 | enable_cpu_extension(BX_ISA_PGE); |
| 54 | enable_cpu_extension(BX_ISA_MTRR); |
| 55 | enable_cpu_extension(BX_ISA_PAT); |
| 56 | enable_cpu_extension(BX_ISA_XAPIC); |
| 57 | enable_cpu_extension(BX_ISA_X2APIC); |
| 58 | enable_cpu_extension(BX_ISA_LONG_MODE); |
| 59 | enable_cpu_extension(BX_ISA_LM_LAHF_SAHF); |
| 60 | enable_cpu_extension(BX_ISA_CMPXCHG16B); |
| 61 | enable_cpu_extension(BX_ISA_NX); |
| 62 | enable_cpu_extension(BX_ISA_PCID); |
| 63 | enable_cpu_extension(BX_ISA_TSC_DEADLINE); |
| 64 | enable_cpu_extension(BX_ISA_SSE); |
| 65 | enable_cpu_extension(BX_ISA_SSE2); |
| 66 | enable_cpu_extension(BX_ISA_SSE3); |
| 67 | enable_cpu_extension(BX_ISA_SSSE3); |
| 68 | enable_cpu_extension(BX_ISA_SSE4_1); |
| 69 | enable_cpu_extension(BX_ISA_SSE4_2); |
| 70 | enable_cpu_extension(BX_ISA_POPCNT); |
| 71 | #if BX_SUPPORT_MONITOR_MWAIT |
| 72 | enable_cpu_extension(BX_ISA_MONITOR_MWAIT); |
| 73 | #endif |
| 74 | #if BX_SUPPORT_VMX >= 2 |
| 75 | enable_cpu_extension(BX_ISA_VMX); |
| 76 | #endif |
| 77 | //enable_cpu_extension(BX_ISA_SMX); |
| 78 | enable_cpu_extension(BX_ISA_RDTSCP); |
| 79 | enable_cpu_extension(BX_ISA_XSAVE); |
| 80 | enable_cpu_extension(BX_ISA_XSAVEOPT); |
| 81 | enable_cpu_extension(BX_ISA_AES_PCLMULQDQ); |
| 82 | enable_cpu_extension(BX_ISA_AVX); |
| 83 | enable_cpu_extension(BX_ISA_AVX_F16C); |
| 84 | enable_cpu_extension(BX_ISA_FSGSBASE); |
| 85 | enable_cpu_extension(BX_ISA_SMEP); |
| 86 | enable_cpu_extension(BX_ISA_RDRAND); |
| 87 | |
| 88 | max_std_leaf = 0xD; |
| 89 | max_ext_leaf = 0x80000008; |
| 90 | } |
| 91 | |
| 92 | void corei7_ivy_bridge_3770k_t::get_cpuid_leaf(Bit32u function, Bit32u subfunction, cpuid_function_t *leaf) const |
| 93 | { |
| 94 | static const char* brand_string = " Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz"; |
| 95 | |
| 96 | static bool cpuid_limit_winnt = SIM->get_param_bool(BXPN_CPUID_LIMIT_WINNT)->get(); |
| 97 | if (cpuid_limit_winnt) |
| 98 | if (function > 2 && function < 0x80000000) function = 2; |
| 99 | |
| 100 | switch(function) { |
| 101 | case 0x80000000: |
| 102 | get_leaf_0(max_ext_leaf, NULL, leaf); // highest extended function understood by CPUID |
| 103 | return; |
| 104 | case 0x80000001: |
| 105 | get_ext_cpuid_leaf_1(leaf); |
| 106 | return; |
| 107 | case 0x80000002: |
| 108 | case 0x80000003: |
| 109 | case 0x80000004: |
| 110 | get_ext_cpuid_brand_string_leaf(brand_string, function, leaf); |
| 111 | return; |
| 112 | case 0x80000005: |
| 113 | get_reserved_leaf(leaf); |
| 114 | return; |
| 115 | case 0x80000006: // CPUID leaf 0x80000006 - L2 Cache and TLB Identifiers |
| 116 | get_leaf(leaf, 0x00000000, 0x00000000, 0x01006040, 0x00000000); |
| 117 | return; |
| 118 | case 0x80000007: // CPUID leaf 0x80000007 - Advanced Power Management leaf |
| 119 | get_leaf(leaf, 0x00000000, 0x00000000, 0x00000000, 0x00000100); // EDX[8] - invariant TSC |
| 120 | return; |
| 121 | case 0x80000008: |
| 122 | get_ext_cpuid_leaf_8(leaf); |
| 123 | return; |
| 124 | case 0x00000000: |
| 125 | get_leaf_0(max_std_leaf, "GenuineIntel", leaf); |
| 126 | return; |
| 127 | case 0x00000001: |
| 128 | get_std_cpuid_leaf_1(leaf); |
| 129 | return; |
| 130 | case 0x00000002: |
| 131 | get_std_cpuid_leaf_2(leaf); |
| 132 | return; |
| 133 | case 0x00000003: |
| 134 | get_reserved_leaf(leaf); |
| 135 | return; |
| 136 | case 0x00000004: |
| 137 | get_std_cpuid_leaf_4(subfunction, leaf); |
| 138 | return; |
| 139 | case 0x00000005: |
| 140 | get_std_cpuid_monitor_mwait_leaf(leaf, 0x00001120); |
| 141 | return; |
| 142 | case 0x00000006: // CPUID leaf 0x00000006 - Thermal and Power Management Leaf |
| 143 | get_leaf(leaf, 0x00000077, 0x00000002, 0x00000009, 0x00000000); |
| 144 | return; |
| 145 | case 0x00000007: |
| 146 | get_std_cpuid_leaf_7(subfunction, leaf); |
| 147 | return; |
| 148 | case 0x00000008: |
| 149 | case 0x00000009: |
| 150 | get_reserved_leaf(leaf); |
| 151 | return; |
| 152 | case 0x0000000A: |
| 153 | get_std_cpuid_leaf_A(leaf); |
| 154 | return; |
| 155 | case 0x0000000B: |
| 156 | get_std_cpuid_extended_topology_leaf(subfunction, leaf); |
| 157 | return; |
| 158 | case 0x0000000C: |
| 159 | get_reserved_leaf(leaf); |
| 160 | return; |
| 161 | case 0x0000000D: |
| 162 | default: |
| 163 | get_std_cpuid_xsave_leaf(subfunction, leaf); |
| 164 | return; |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | #if BX_SUPPORT_VMX >= 2 |
| 169 | |
| 170 | // |
| 171 | // MSR 00000480 : 00DA0400 00000010 BX_MSR_VMX_BASIC |
| 172 | // MSR 00000481 : 0000007F 00000016 BX_MSR_VMX_PINBASED_CTRLS |
| 173 | // MSR 00000482 : FFF9FFFE 0401E172 BX_MSR_VMX_PROCBASED_CTRLS |
| 174 | // MSR 00000483 : 007FFFFF 00036DFF BX_MSR_VMX_VMEXIT_CTRLS |
| 175 | // MSR 00000484 : 0000FFFF 000011FF BX_MSR_VMX_VMENTRY_CTRLS |
| 176 | // MSR 00000485 : 00000000 100401E5 BX_MSR_VMX_MISC |
| 177 | // MSR 00000486 : 00000000 80000021 BX_MSR_VMX_CR0_FIXED0 |
| 178 | // MSR 00000487 : 00000000 FFFFFFFF BX_MSR_VMX_CR0_FIXED1 |
| 179 | // MSR 00000488 : 00000000 00002000 BX_MSR_VMX_CR4_FIXED0 |
| 180 | // MSR 00000489 : 00000000 001727FF BX_MSR_VMX_CR4_FIXED1 |
| 181 | // MSR 0000048A : 00000000 0000002A BX_MSR_VMX_VMCS_ENUM |
| 182 | // MSR 0000048B : 000000FF 00000000 BX_MSR_VMX_PROCBASED_CTRLS2 |
| 183 | // MSR 0000048C : 00000F01 06114141 BX_MSR_VMX_MSR_VMX_EPT_VPID_CAP |
| 184 | // MSR 0000048D : 0000007F 00000016 BX_MSR_VMX_TRUE_PINBASED_CTRLS |
| 185 | // MSR 0000048E : FFF9FFFE 04006172 BX_MSR_VMX_TRUE_PROCBASED_CTRLS |
| 186 | // MSR 0000048F : 007FFFFF 00036DFB BX_MSR_VMX_TRUE_VMEXIT_CTRLS |
| 187 | // MSR 00000490 : 0000FFFF 000011FB BX_MSR_VMX_TRUE_VMENTRY_CTRLS |
| 188 | // |
| 189 | |
| 190 | Bit32u corei7_ivy_bridge_3770k_t::get_vmx_extensions_bitmask(void) const |
| 191 | { |
| 192 | return BX_VMX_TPR_SHADOW | |
| 193 | BX_VMX_VIRTUAL_NMI | |
| 194 | BX_VMX_APIC_VIRTUALIZATION | |
| 195 | BX_VMX_WBINVD_VMEXIT | |
| 196 | BX_VMX_MONITOR_TRAP_FLAG | |
| 197 | BX_VMX_VPID | |
| 198 | BX_VMX_EPT | |
| 199 | BX_VMX_UNRESTRICTED_GUEST | |
| 200 | BX_VMX_SAVE_DEBUGCTL_DISABLE | |
| 201 | BX_VMX_PERF_GLOBAL_CTRL | // MSR not implemented yet |
| 202 | BX_VMX_PAT | |
| 203 | BX_VMX_EFER | |
| 204 | BX_VMX_DESCRIPTOR_TABLE_EXIT | |
| 205 | BX_VMX_X2APIC_VIRTUALIZATION | |
| 206 | BX_VMX_PREEMPTION_TIMER; |
| 207 | } |
| 208 | |
| 209 | #endif |
| 210 | |
| 211 | // leaf 0x00000000 // |
| 212 | |
| 213 | // leaf 0x00000001 // |
| 214 | void corei7_ivy_bridge_3770k_t::get_std_cpuid_leaf_1(cpuid_function_t *leaf) const |
| 215 | { |
| 216 | // EAX: CPU Version Information |
| 217 | // [3:0] Stepping ID |
| 218 | // [7:4] Model: starts at 1 |
| 219 | // [11:8] Family: 4=486, 5=Pentium, 6=PPro, ... |
| 220 | // [13:12] Type: 0=OEM, 1=overdrive, 2=dual cpu, 3=reserved |
| 221 | // [19:16] Extended Model |
| 222 | // [27:20] Extended Family |
| 223 | leaf->eax = 0x000306a9; |
| 224 | |
| 225 | // EBX: |
| 226 | // [7:0] Brand ID |
| 227 | // [15:8] CLFLUSH cache line size (value*8 = cache line size in bytes) |
| 228 | // [23:16] Number of logical processors in one physical processor |
| 229 | // [31:24] Local Apic ID |
| 230 | |
| 231 | unsigned n_logical_processors = ncores*nthreads; |
| 232 | leaf->ebx = ((CACHE_LINE_SIZE / 8) << 8) | |
| 233 | (n_logical_processors << 16); |
| 234 | #if BX_SUPPORT_APIC |
| 235 | leaf->ebx |= ((cpu->get_apic_id() & 0xff) << 24); |
| 236 | #endif |
| 237 | |
| 238 | // ECX: Extended Feature Flags |
| 239 | // * [0:0] SSE3: SSE3 Instructions |
| 240 | // * [1:1] PCLMULQDQ Instruction support |
| 241 | // * [2:2] DTES64: 64-bit DS area |
| 242 | // * [3:3] MONITOR/MWAIT support |
| 243 | // * [4:4] DS-CPL: CPL qualified debug store |
| 244 | // * [5:5] VMX: Virtual Machine Technology |
| 245 | // [6:6] SMX: Secure Virtual Machine Technology |
| 246 | // * [7:7] EST: Enhanced Intel SpeedStep Technology |
| 247 | // * [8:8] TM2: Thermal Monitor 2 |
| 248 | // * [9:9] SSSE3: SSSE3 Instructions |
| 249 | // [10:10] CNXT-ID: L1 context ID |
| 250 | // [11:11] reserved |
| 251 | // [12:12] FMA Instructions support |
| 252 | // * [13:13] CMPXCHG16B: CMPXCHG16B instruction support |
| 253 | // * [14:14] xTPR update control |
| 254 | // * [15:15] PDCM - Perfmon and Debug Capability MSR |
| 255 | // [16:16] reserved |
| 256 | // * [17:17] PCID: Process Context Identifiers |
| 257 | // [18:18] DCA - Direct Cache Access |
| 258 | // * [19:19] SSE4.1 Instructions |
| 259 | // * [20:20] SSE4.2 Instructions |
| 260 | // * [21:21] X2APIC |
| 261 | // [22:22] MOVBE instruction |
| 262 | // * [23:23] POPCNT instruction |
| 263 | // * [24:24] TSC Deadline |
| 264 | // * [25:25] AES Instructions |
| 265 | // * [26:26] XSAVE extensions support |
| 266 | // * [27:27] OSXSAVE support |
| 267 | // * [28:28] AVX extensions support |
| 268 | // * [29:29] AVX F16C - Float16 conversion support |
| 269 | // * [30:30] RDRAND instruction |
| 270 | // [31:31] reserved |
| 271 | leaf->ecx = get_std_cpuid_leaf_1_ecx(BX_CPUID_STD1_ECX_DTES64 | |
| 272 | BX_CPUID_STD1_ECX_DS_CPL | |
| 273 | BX_CPUID_STD1_ECX_EST | |
| 274 | BX_CPUID_STD1_ECX_THERMAL_MONITOR2 | |
| 275 | BX_CPUID_STD1_ECX_xTPR | |
| 276 | BX_CPUID_STD1_ECX_PDCM); |
| 277 | |
| 278 | // EDX: Standard Feature Flags |
| 279 | // * [0:0] FPU on chip |
| 280 | // * [1:1] VME: Virtual-8086 Mode enhancements |
| 281 | // * [2:2] DE: Debug Extensions (I/O breakpoints) |
| 282 | // * [3:3] PSE: Page Size Extensions |
| 283 | // * [4:4] TSC: Time Stamp Counter |
| 284 | // * [5:5] MSR: RDMSR and WRMSR support |
| 285 | // * [6:6] PAE: Physical Address Extensions |
| 286 | // * [7:7] MCE: Machine Check Exception |
| 287 | // * [8:8] CXS: CMPXCHG8B instruction |
| 288 | // * [9:9] APIC: APIC on Chip |
| 289 | // [10:10] Reserved |
| 290 | // * [11:11] SYSENTER/SYSEXIT support |
| 291 | // * [12:12] MTRR: Memory Type Range Reg |
| 292 | // * [13:13] PGE/PTE Global Bit |
| 293 | // * [14:14] MCA: Machine Check Architecture |
| 294 | // * [15:15] CMOV: Cond Mov/Cmp Instructions |
| 295 | // * [16:16] PAT: Page Attribute Table |
| 296 | // * [17:17] PSE-36: Physical Address Extensions |
| 297 | // [18:18] PSN: Processor Serial Number |
| 298 | // * [19:19] CLFLUSH: CLFLUSH Instruction support |
| 299 | // [20:20] Reserved |
| 300 | // * [21:21] DS: Debug Store |
| 301 | // * [22:22] ACPI: Thermal Monitor and Software Controlled Clock Facilities |
| 302 | // * [23:23] MMX Technology |
| 303 | // * [24:24] FXSR: FXSAVE/FXRSTOR (also indicates CR4.OSFXSR is available) |
| 304 | // * [25:25] SSE: SSE Extensions |
| 305 | // * [26:26] SSE2: SSE2 Extensions |
| 306 | // * [27:27] Self Snoop |
| 307 | // * [28:28] Hyper Threading Technology |
| 308 | // * [29:29] TM: Thermal Monitor |
| 309 | // [30:30] Reserved |
| 310 | // * [31:31] PBE: Pending Break Enable |
| 311 | leaf->edx = get_std_cpuid_leaf_1_edx(BX_CPUID_STD1_EDX_DEBUG_STORE | |
| 312 | BX_CPUID_STD1_EDX_ACPI | |
| 313 | BX_CPUID_STD1_EDX_SELF_SNOOP | |
| 314 | #if BX_SUPPORT_SMP |
| 315 | BX_CPUID_STD1_EDX_HT | |
| 316 | #endif |
| 317 | BX_CPUID_STD1_EDX_THERMAL_MONITOR | |
| 318 | BX_CPUID_STD1_EDX_PBE); |
| 319 | } |
| 320 | |
| 321 | // leaf 0x00000002 // |
| 322 | void corei7_ivy_bridge_3770k_t::get_std_cpuid_leaf_2(cpuid_function_t *leaf) const |
| 323 | { |
| 324 | // CPUID function 0x00000002 - Cache and TLB Descriptors |
| 325 | leaf->eax = 0x76035A01; |
| 326 | leaf->ebx = 0x00F0B2FF; |
| 327 | leaf->ecx = 0x00000000; |
| 328 | leaf->edx = 0x00CA0000; |
| 329 | } |
| 330 | |
| 331 | // leaf 0x00000003 - Processor Serial Number (not supported) // |
| 332 | |
| 333 | // leaf 0x00000004 // |
| 334 | void corei7_ivy_bridge_3770k_t::get_std_cpuid_leaf_4(Bit32u subfunction, cpuid_function_t *leaf) const |
| 335 | { |
| 336 | // CPUID function 0x00000004 - Deterministic Cache Parameters |
| 337 | |
| 338 | // EAX: |
| 339 | // [04-00] - Cache Type Field |
| 340 | // 0 = No more caches |
| 341 | // 1 = Data Cache |
| 342 | // 2 = Instruction Cache |
| 343 | // 3 = Unified Cache |
| 344 | // [07-05] - Cache Level (starts at 1)] |
| 345 | // [08] - Self Initializing cache level (doesn't need software initialization) |
| 346 | // [09] - Fully Associative cache |
| 347 | // [13-10] - Reserved |
| 348 | // [25-14] - Maximum number of addressable IDs for logical processors sharing this cache |
| 349 | // [31-26] - Maximum number of addressable IDs for processor cores in the physical package - 1 |
| 350 | // EBX: |
| 351 | // [11-00] - L = System Coherency Line Size |
| 352 | // [21-12] - P = Physical Line partitions |
| 353 | // [31-22] - W = Ways of associativity |
| 354 | // ECX: Number of Sets |
| 355 | // EDX: |
| 356 | // [00] - Writeback invalidate |
| 357 | // [01] - Cache Inclusiveness |
| 358 | // [02] - Complex Cache Indexing |
| 359 | // [31-03] - Reserved |
| 360 | |
| 361 | switch(subfunction) { |
| 362 | case 0: |
| 363 | leaf->eax = 0x1C004121; |
| 364 | leaf->ebx = 0x01C0003F; |
| 365 | leaf->ecx = 0x0000003F; |
| 366 | leaf->edx = 0x00000000; |
| 367 | break; |
| 368 | case 1: |
| 369 | leaf->eax = 0x1C004122; |
| 370 | leaf->ebx = 0x01C0003F; |
| 371 | leaf->ecx = 0x0000003F; |
| 372 | leaf->edx = 0x00000000; |
| 373 | break; |
| 374 | case 2: |
| 375 | leaf->eax = 0x1C004143; |
| 376 | leaf->ebx = 0x01C0003F; |
| 377 | leaf->ecx = 0x000001FF; |
| 378 | leaf->edx = 0x00000000; |
| 379 | break; |
| 380 | case 3: |
| 381 | leaf->eax = 0x1C03C163; |
| 382 | leaf->ebx = 0x03C0003F; |
| 383 | leaf->ecx = 0x00001FFF; |
| 384 | leaf->edx = 0x00000006; |
| 385 | break; |
| 386 | default: |
| 387 | leaf->eax = 0; |
| 388 | leaf->ebx = 0; |
| 389 | leaf->ecx = 0; |
| 390 | leaf->edx = 0; |
| 391 | return; |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | // leaf 0x00000005 MONITOR/MWAIT Leaf // |
| 396 | // leaf 0x00000006 Thermal and Power Management Leaf // |
| 397 | |
| 398 | // leaf 0x00000007 // |
| 399 | void corei7_ivy_bridge_3770k_t::get_std_cpuid_leaf_7(Bit32u subfunction, cpuid_function_t *leaf) const |
| 400 | { |
| 401 | switch(subfunction) { |
| 402 | case 0: |
| 403 | leaf->eax = 0; /* report max sub-leaf that supported in leaf 7 */ |
| 404 | |
| 405 | // * [0:0] FS/GS BASE access instructions |
| 406 | // [1:1] Support for IA32_TSC_ADJUST MSR |
| 407 | // [2:2] reserved |
| 408 | // [3:3] BMI1: Advanced Bit Manipulation Extensions |
| 409 | // [4:4] HLE: Hardware Lock Elision |
| 410 | // [5:5] AVX2 |
| 411 | // [6:6] reserved |
| 412 | // * [7:7] SMEP: Supervisor Mode Execution Protection |
| 413 | // [8:8] BMI2: Advanced Bit Manipulation Extensions |
| 414 | // * [9:9] Support for Enhanced REP MOVSB/STOSB |
| 415 | // [10:10] Support for INVPCID instruction |
| 416 | // [11:11] RTM: Restricted Transactional Memory |
| 417 | // [12:12] Supports Quality of Service (QoS) capability |
| 418 | // [13:13] Deprecates FPU CS and FPU DS values |
| 419 | // [17:14] reserved |
| 420 | // [18:18] RDSEED instruction support |
| 421 | // [19:19] ADCX/ADOX instructions support |
| 422 | // [20:20] SMAP: Supervisor Mode Access Prevention |
| 423 | // [31:21] reserved |
| 424 | leaf->ebx = get_std_cpuid_leaf_7_ebx(BX_CPUID_STD7_SUBLEAF0_EBX_ENCHANCED_REP_STRINGS); |
| 425 | leaf->ecx = 0; |
| 426 | leaf->edx = 0; |
| 427 | break; |
| 428 | default: |
| 429 | leaf->eax = 0; |
| 430 | leaf->ebx = 0; |
| 431 | leaf->ecx = 0; |
| 432 | leaf->edx = 0; |
| 433 | } |
| 434 | } |
| 435 | |
| 436 | // leaf 0x00000008 reserved // |
| 437 | // leaf 0x00000009 direct cache access not supported // |
| 438 | |
| 439 | // leaf 0x0000000A // |
| 440 | void corei7_ivy_bridge_3770k_t::get_std_cpuid_leaf_A(cpuid_function_t *leaf) const |
| 441 | { |
| 442 | // CPUID function 0x0000000A - Architectural Performance Monitoring Leaf |
| 443 | |
| 444 | // EAX: |
| 445 | // [7:0] Version ID of architectural performance monitoring |
| 446 | // [15:8] Number of general-purpose performance monitoring counters per logical processor |
| 447 | // [23:16] Bit width of general-purpose, performance monitoring counter |
| 448 | // [31:24] Length of EBX bit vector to enumerate architectural performance |
| 449 | // monitoring events. |
| 450 | |
| 451 | // EBX: |
| 452 | // [0] Core cycle event not available if 1 |
| 453 | // [1] Instruction retired event not available if 1 |
| 454 | // [2] Reference cycles event not available if 1 |
| 455 | // [3] Last-level cache reference event not available if 1 |
| 456 | // [4] Last-level cache misses event not available if 1 |
| 457 | // [5] Branch instruction retired event not available if 1 |
| 458 | // [6] Branch mispredict retired event not available if 1 |
| 459 | // [31:7] reserved |
| 460 | |
| 461 | // ECX: reserved |
| 462 | |
| 463 | // EDX: |
| 464 | // [4:0] Number of fixed performance counters (if Version ID > 1) |
| 465 | // [12:5] Bit width of fixed-function performance counters (if Version ID > 1) |
| 466 | // [31:13] reserved |
| 467 | |
| 468 | leaf->eax = 0x07300403; |
| 469 | leaf->ebx = 0x00000000; |
| 470 | leaf->ecx = 0x00000000; |
| 471 | leaf->edx = 0x00000603; |
| 472 | |
| 473 | BX_INFO(("WARNING: Architectural Performance Monitoring is not implemented")); |
| 474 | } |
| 475 | |
| 476 | // leaf 0x0000000C reserved // |
| 477 | // leaf 0x0000000D - XSAVE // |
| 478 | |
| 479 | // leaf 0x80000000 // |
| 480 | |
| 481 | // leaf 0x80000001 // |
| 482 | void corei7_ivy_bridge_3770k_t::get_ext_cpuid_leaf_1(cpuid_function_t *leaf) const |
| 483 | { |
| 484 | // EAX: CPU Version Information (reserved for Intel) |
| 485 | leaf->eax = 0; |
| 486 | |
| 487 | // EBX: Brand ID (reserved for Intel) |
| 488 | leaf->ebx = 0; |
| 489 | |
| 490 | // ECX: |
| 491 | // * [0:0] LAHF/SAHF instructions support in 64-bit mode |
| 492 | // [1:1] CMP_Legacy: Core multi-processing legacy mode (AMD) |
| 493 | // [2:2] SVM: Secure Virtual Machine (AMD) |
| 494 | // [3:3] Extended APIC Space |
| 495 | // [4:4] AltMovCR8: LOCK MOV CR0 means MOV CR8 |
| 496 | // [5:5] LZCNT: LZCNT instruction support |
| 497 | // [6:6] SSE4A: SSE4A Instructions support |
| 498 | // [7:7] Misaligned SSE support |
| 499 | // [8:8] PREFETCHW: PREFETCHW instruction support |
| 500 | // [9:9] OSVW: OS visible workarounds (AMD) |
| 501 | // [10:10] IBS: Instruction based sampling |
| 502 | // [11:11] XOP: Extended Operations Support and XOP Prefix |
| 503 | // [12:12] SKINIT support |
| 504 | // [13:13] WDT: Watchdog timer support |
| 505 | // [14:14] Reserved |
| 506 | // [15:15] LWP: Light weight profiling |
| 507 | // [16:16] FMA4: Four-operand FMA instructions support |
| 508 | // [17:17] Reserved |
| 509 | // [18:18] Reserved |
| 510 | // [19:19] NodeId: Indicates support for NodeId MSR (0xc001100c) |
| 511 | // [20:20] Reserved |
| 512 | // [21:21] TBM: trailing bit manipulation instructions support |
| 513 | // [22:22] Topology extensions support |
| 514 | // [23:23] PerfCtrExtCore: core perf counter extensions support |
| 515 | // [24:24] PerfCtrExtNB: NB perf counter extensions support |
| 516 | // [31:25] Reserved |
| 517 | leaf->ecx = get_ext_cpuid_leaf_1_ecx(); |
| 518 | |
| 519 | // EDX: |
| 520 | // [10:0] Reserved for Intel |
| 521 | // * [11:11] SYSCALL/SYSRET support |
| 522 | // [19:12] Reserved for Intel |
| 523 | // * [20:20] No-Execute page protection |
| 524 | // [25:21] Reserved |
| 525 | // [26:26] 1G paging support |
| 526 | // * [27:27] Support RDTSCP Instruction |
| 527 | // [28:28] Reserved |
| 528 | // * [29:29] Long Mode |
| 529 | // [30:30] AMD 3DNow! Extensions |
| 530 | // [31:31] AMD 3DNow! Instructions |
| 531 | leaf->edx = get_ext_cpuid_leaf_1_edx_intel(); |
| 532 | } |
| 533 | |
| 534 | // leaf 0x80000002 // |
| 535 | // leaf 0x80000003 // |
| 536 | // leaf 0x80000004 // |
| 537 | |
| 538 | // leaf 0x80000005 - L1 Cache and TLB Identifiers (reserved for Intel) |
| 539 | // leaf 0x80000006 - L2 Cache and TLB Identifiers |
| 540 | // leaf 0x80000007 - Advanced Power Management |
| 541 | // leaf 0x80000008 // |
| 542 | |
| 543 | void corei7_ivy_bridge_3770k_t::dump_cpuid(void) const |
| 544 | { |
| 545 | bx_cpuid_t::dump_cpuid(max_std_leaf, max_ext_leaf); |
| 546 | } |
| 547 | |
| 548 | bx_cpuid_t *create_corei7_ivy_bridge_3770k_cpuid(BX_CPU_C *cpu) { return new corei7_ivy_bridge_3770k_t(cpu); } |
| 549 | |
| 550 | #endif |