323 return ((_cpuid_info.ext_cpuid1_edx.value & INTEL64_FLAG) == INTEL64_FLAG); 324 } 325 326 bool VM_Version_Ext::is_netburst(void) { 327 return (is_intel() && (extended_cpu_family() == CPU_FAMILY_PENTIUM_4)); 328 } 329 330 bool VM_Version_Ext::supports_tscinv_ext(void) { 331 if (!supports_tscinv_bit()) { 332 return false; 333 } 334 335 if (is_intel()) { 336 return true; 337 } 338 339 if (is_amd()) { 340 return !is_amd_Barcelona(); 341 } 342 343 return false; 344 } 345 346 void VM_Version_Ext::resolve_cpu_information_details(void) { 347 348 // in future we want to base this information on proper cpu 349 // and cache topology enumeration such as: 350 // Intel 64 Architecture Processor Topology Enumeration 351 // which supports system cpu and cache topology enumeration 352 // either using 2xAPICIDs or initial APICIDs 353 354 // currently only rough cpu information estimates 355 // which will not necessarily reflect the exact configuration of the system 356 357 // this is the number of logical hardware threads 358 // visible to the operating system 359 _no_of_threads = os::processor_count(); 360 361 // find out number of threads per cpu package 362 int threads_per_package = threads_per_core() * cores_per_cpu(); 390 } 391 392 int VM_Version_Ext::number_of_sockets(void) { 393 if (_no_of_packages == 0) { 394 resolve_cpu_information_details(); 395 } 396 return _no_of_packages; 397 } 398 399 const char* VM_Version_Ext::cpu_family_description(void) { 400 int cpu_family_id = extended_cpu_family(); 401 if (is_amd()) { 402 return _family_id_amd[cpu_family_id]; 403 } 404 if (is_intel()) { 405 if (cpu_family_id == CPU_FAMILY_PENTIUMPRO) { 406 return cpu_model_description(); 407 } 408 return _family_id_intel[cpu_family_id]; 409 } 410 return "Unknown x86"; 411 } 412 413 int VM_Version_Ext::cpu_type_description(char* const buf, size_t buf_len) { 414 assert(buf != NULL, "buffer is NULL!"); 415 assert(buf_len >= CPU_TYPE_DESC_BUF_SIZE, "buffer len should at least be == CPU_TYPE_DESC_BUF_SIZE!"); 416 417 const char* cpu_type = NULL; 418 const char* x64 = NULL; 419 420 if (is_intel()) { 421 cpu_type = "Intel"; 422 x64 = cpu_is_em64t() ? " Intel64" : ""; 423 } else if (is_amd()) { 424 cpu_type = "AMD"; 425 x64 = cpu_is_em64t() ? " AMD64" : ""; 426 } else { 427 cpu_type = "Unknown x86"; 428 x64 = cpu_is_em64t() ? " x86_64" : ""; 429 } 430 431 jio_snprintf(buf, buf_len, "%s %s%s SSE SSE2%s%s%s%s%s%s%s%s", 432 cpu_type, 433 cpu_family_description(), 434 supports_ht() ? " (HT)" : "", 435 supports_sse3() ? " SSE3" : "", 436 supports_ssse3() ? " SSSE3" : "", 437 supports_sse4_1() ? " SSE4.1" : "", 438 supports_sse4_2() ? " SSE4.2" : "", 439 supports_sse4a() ? " SSE4A" : "", 440 is_netburst() ? " Netburst" : "", 441 is_intel_family_core() ? " Core" : "", 442 x64); 443 444 return OS_OK; 445 } 715 716 const char* const VM_Version_Ext::_family_id_amd[] = { 717 "", 718 "", 719 "", 720 "", 721 "5x86", 722 "K5/K6", 723 "Athlon/AthlonXP", 724 "", 725 "", 726 "", 727 "", 728 "", 729 "", 730 "", 731 "", 732 "Opteron/Athlon64", 733 "Opteron QC/Phenom" // Barcelona et.al. 734 }; 735 // Partially from Intel 64 and IA-32 Architecture Software Developer's Manual, 736 // September 2013, Vol 3C Table 35-1 737 const char* const VM_Version_Ext::_model_id_pentium_pro[] = { 738 "", 739 "Pentium Pro", 740 "", 741 "Pentium II model 3", 742 "", 743 "Pentium II model 5/Xeon/Celeron", 744 "Celeron", 745 "Pentium III/Pentium III Xeon", 746 "Pentium III/Pentium III Xeon", 747 "Pentium M model 9", // Yonah 748 "Pentium III, model A", 749 "Pentium III, model B", 750 "", 751 "Pentium M model D", // Dothan 752 "", 753 "Core 2", // 0xf Woodcrest/Conroe/Merom/Kentsfield/Clovertown 754 "", | 323 return ((_cpuid_info.ext_cpuid1_edx.value & INTEL64_FLAG) == INTEL64_FLAG); 324 } 325 326 bool VM_Version_Ext::is_netburst(void) { 327 return (is_intel() && (extended_cpu_family() == CPU_FAMILY_PENTIUM_4)); 328 } 329 330 bool VM_Version_Ext::supports_tscinv_ext(void) { 331 if (!supports_tscinv_bit()) { 332 return false; 333 } 334 335 if (is_intel()) { 336 return true; 337 } 338 339 if (is_amd()) { 340 return !is_amd_Barcelona(); 341 } 342 343 if (is_hygon()) { 344 return true; 345 } 346 347 return false; 348 } 349 350 void VM_Version_Ext::resolve_cpu_information_details(void) { 351 352 // in future we want to base this information on proper cpu 353 // and cache topology enumeration such as: 354 // Intel 64 Architecture Processor Topology Enumeration 355 // which supports system cpu and cache topology enumeration 356 // either using 2xAPICIDs or initial APICIDs 357 358 // currently only rough cpu information estimates 359 // which will not necessarily reflect the exact configuration of the system 360 361 // this is the number of logical hardware threads 362 // visible to the operating system 363 _no_of_threads = os::processor_count(); 364 365 // find out number of threads per cpu package 366 int threads_per_package = threads_per_core() * cores_per_cpu(); 394 } 395 396 int VM_Version_Ext::number_of_sockets(void) { 397 if (_no_of_packages == 0) { 398 resolve_cpu_information_details(); 399 } 400 return _no_of_packages; 401 } 402 403 const char* VM_Version_Ext::cpu_family_description(void) { 404 int cpu_family_id = extended_cpu_family(); 405 if (is_amd()) { 406 return _family_id_amd[cpu_family_id]; 407 } 408 if (is_intel()) { 409 if (cpu_family_id == CPU_FAMILY_PENTIUMPRO) { 410 return cpu_model_description(); 411 } 412 return _family_id_intel[cpu_family_id]; 413 } 414 if (is_hygon()) { 415 return _family_id_hygon[cpu_family_id]; 416 } 417 418 return "Unknown x86"; 419 } 420 421 int VM_Version_Ext::cpu_type_description(char* const buf, size_t buf_len) { 422 assert(buf != NULL, "buffer is NULL!"); 423 assert(buf_len >= CPU_TYPE_DESC_BUF_SIZE, "buffer len should at least be == CPU_TYPE_DESC_BUF_SIZE!"); 424 425 const char* cpu_type = NULL; 426 const char* x64 = NULL; 427 428 if (is_intel()) { 429 cpu_type = "Intel"; 430 x64 = cpu_is_em64t() ? " Intel64" : ""; 431 } else if (is_amd()) { 432 cpu_type = "AMD"; 433 x64 = cpu_is_em64t() ? " AMD64" : ""; 434 } else if (is_hygon()) { 435 cpu_type = "HYGON"; 436 x64 = cpu_is_em64t() ? " AMD64" : ""; 437 } else { 438 cpu_type = "Unknown x86"; 439 x64 = cpu_is_em64t() ? " x86_64" : ""; 440 } 441 442 jio_snprintf(buf, buf_len, "%s %s%s SSE SSE2%s%s%s%s%s%s%s%s", 443 cpu_type, 444 cpu_family_description(), 445 supports_ht() ? " (HT)" : "", 446 supports_sse3() ? " SSE3" : "", 447 supports_ssse3() ? " SSSE3" : "", 448 supports_sse4_1() ? " SSE4.1" : "", 449 supports_sse4_2() ? " SSE4.2" : "", 450 supports_sse4a() ? " SSE4A" : "", 451 is_netburst() ? " Netburst" : "", 452 is_intel_family_core() ? " Core" : "", 453 x64); 454 455 return OS_OK; 456 } 726 727 const char* const VM_Version_Ext::_family_id_amd[] = { 728 "", 729 "", 730 "", 731 "", 732 "5x86", 733 "K5/K6", 734 "Athlon/AthlonXP", 735 "", 736 "", 737 "", 738 "", 739 "", 740 "", 741 "", 742 "", 743 "Opteron/Athlon64", 744 "Opteron QC/Phenom" // Barcelona et.al. 745 }; 746 const char* const VM_Version_Ext::_family_id_hygon[] = { 747 "", //family 0 748 "", 749 "", 750 "", 751 "", 752 "", 753 "", 754 "", 755 "", 756 "", 757 "", 758 "", 759 "", 760 "", 761 "", 762 "", 763 "", 764 "", 765 "", 766 "", 767 "", 768 "", 769 "", 770 "", 771 "HygonGenuine", //family 24 772 }; 773 774 // Partially from Intel 64 and IA-32 Architecture Software Developer's Manual, 775 // September 2013, Vol 3C Table 35-1 776 const char* const VM_Version_Ext::_model_id_pentium_pro[] = { 777 "", 778 "Pentium Pro", 779 "", 780 "Pentium II model 3", 781 "", 782 "Pentium II model 5/Xeon/Celeron", 783 "Celeron", 784 "Pentium III/Pentium III Xeon", 785 "Pentium III/Pentium III Xeon", 786 "Pentium M model 9", // Yonah 787 "Pentium III, model A", 788 "Pentium III, model B", 789 "", 790 "Pentium M model D", // Dothan 791 "", 792 "Core 2", // 0xf Woodcrest/Conroe/Merom/Kentsfield/Clovertown 793 "", |