< prev index next >

src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp

Print this page




 423 #ifndef AV_SPARC_SHA1
 424 #define AV_SPARC_SHA1   0x00400000  /* sha1 instruction supported */
 425 #endif
 426   if (av & AV_SPARC_SHA1)         features |= sha1_instruction_m;
 427 
 428 #ifndef AV_SPARC_SHA256
 429 #define AV_SPARC_SHA256 0x00800000  /* sha256 instruction supported */
 430 #endif
 431   if (av & AV_SPARC_SHA256)       features |= sha256_instruction_m;
 432 
 433 #ifndef AV_SPARC_SHA512
 434 #define AV_SPARC_SHA512 0x01000000  /* sha512 instruction supported */
 435 #endif
 436   if (av & AV_SPARC_SHA512)       features |= sha512_instruction_m;
 437 
 438   // Determine the machine type.
 439   if (Sysinfo(SI_MACHINE).match("sun4v")) {
 440     features |= sun4v_m;
 441   }
 442 
 443   bool use_solaris_12_api = false;
 444   Sysinfo impl(SI_CPUBRAND);
 445   if (impl.valid()) {
 446     // If SI_CPUBRAND works, that means Solaris 12 API to get the cache line sizes
 447     // is available to us as well
 448     use_solaris_12_api = true;
 449     features |= parse_features(impl.value());






 450   } else {
 451     // Otherwise use kstat to determine the machine type.
 452     kstat_ctl_t* kc = kstat_open();

 453     kstat_t* ksp = kstat_lookup(kc, (char*)"cpu_info", -1, NULL);
 454     const char* implementation;
 455     bool has_implementation = false;
 456     if (ksp != NULL) {
 457       if (kstat_read(kc, ksp, NULL) != -1 && ksp->ks_data != NULL) {
 458         kstat_named_t* knm = (kstat_named_t *)ksp->ks_data;
 459         for (int i = 0; i < ksp->ks_ndata; i++) {
 460           if (strcmp((const char*)&(knm[i].name),"implementation") == 0) {
 461             implementation = KSTAT_NAMED_STR_PTR(&knm[i]);
 462             has_implementation = true;
 463             log_info(os, cpu)("cpu_info.implementation: %s", implementation);
 464             features |= parse_features(implementation);
 465             break;
 466           }
 467         } // for(
 468       }
 469     }
 470     assert(has_implementation, "unknown cpu info (changed kstat interface?)");
 471     kstat_close(kc);
 472   }



 473 
 474   bool is_sun4v = (features & sun4v_m) != 0;
 475   if (use_solaris_12_api && is_sun4v) {
 476     // If Solaris 12 API is supported and it's sun4v use sysconf() to get the cache line sizes
 477     Sysconf l1_dcache_line_size(_SC_DCACHE_LINESZ);
 478     if (l1_dcache_line_size.valid()) {
 479       _L1_data_cache_line_size =  l1_dcache_line_size.value();
 480     }
 481 
 482     Sysconf l2_dcache_line_size(_SC_L2CACHE_LINESZ);
 483     if (l2_dcache_line_size.valid()) {
 484       _L2_data_cache_line_size = l2_dcache_line_size.value();
 485     }
 486   } else {
 487     // Otherwise figure out the cache line sizes using PICL
 488     bool is_fujitsu = (features & sparc64_family_m) != 0;
 489     PICL picl(is_fujitsu, is_sun4v);
 490     _L1_data_cache_line_size = picl.L1_data_cache_line_size();
 491     _L2_data_cache_line_size = picl.L2_data_cache_line_size();
 492   }


 423 #ifndef AV_SPARC_SHA1
 424 #define AV_SPARC_SHA1   0x00400000  /* sha1 instruction supported */
 425 #endif
 426   if (av & AV_SPARC_SHA1)         features |= sha1_instruction_m;
 427 
 428 #ifndef AV_SPARC_SHA256
 429 #define AV_SPARC_SHA256 0x00800000  /* sha256 instruction supported */
 430 #endif
 431   if (av & AV_SPARC_SHA256)       features |= sha256_instruction_m;
 432 
 433 #ifndef AV_SPARC_SHA512
 434 #define AV_SPARC_SHA512 0x01000000  /* sha512 instruction supported */
 435 #endif
 436   if (av & AV_SPARC_SHA512)       features |= sha512_instruction_m;
 437 
 438   // Determine the machine type.
 439   if (Sysinfo(SI_MACHINE).match("sun4v")) {
 440     features |= sun4v_m;
 441   }
 442 



 443   // If SI_CPUBRAND works, that means Solaris 12 API to get the cache line sizes
 444   // is available to us as well
 445   Sysinfo cpu_info(SI_CPUBRAND);
 446   bool use_solaris_12_api = cpu_info.valid();
 447   const char* impl;
 448   int impl_m = 0;
 449   if (use_solaris_12_api) {
 450     impl = cpu_info.value();
 451     log_info(os, cpu)("Parsing CPU implementation from %s", impl);
 452     impl_m = parse_features(impl);
 453   } else {
 454     // Otherwise use kstat to determine the machine type.
 455     kstat_ctl_t* kc = kstat_open();
 456     if (kc != NULL) {
 457       kstat_t* ksp = kstat_lookup(kc, (char*)"cpu_info", -1, NULL);


 458       if (ksp != NULL) {
 459         if (kstat_read(kc, ksp, NULL) != -1 && ksp->ks_data != NULL) {
 460           kstat_named_t* knm = (kstat_named_t *)ksp->ks_data;
 461           for (int i = 0; i < ksp->ks_ndata; i++) {
 462             if (strcmp((const char*)&(knm[i].name), "implementation") == 0) {
 463               impl = KSTAT_NAMED_STR_PTR(&knm[i]);
 464               log_info(os, cpu)("Parsing CPU implementation from %s", impl);
 465               impl_m = parse_features(impl);

 466               break;
 467             }

 468           }
 469         }
 470       }
 471       kstat_close(kc);
 472     }
 473   }
 474   assert(impl_m != 0, "Unknown CPU implementation %s", impl);
 475   features |= impl_m;
 476 
 477   bool is_sun4v = (features & sun4v_m) != 0;
 478   if (use_solaris_12_api && is_sun4v) {
 479     // If Solaris 12 API is supported and it's sun4v use sysconf() to get the cache line sizes
 480     Sysconf l1_dcache_line_size(_SC_DCACHE_LINESZ);
 481     if (l1_dcache_line_size.valid()) {
 482       _L1_data_cache_line_size =  l1_dcache_line_size.value();
 483     }
 484 
 485     Sysconf l2_dcache_line_size(_SC_L2CACHE_LINESZ);
 486     if (l2_dcache_line_size.valid()) {
 487       _L2_data_cache_line_size = l2_dcache_line_size.value();
 488     }
 489   } else {
 490     // Otherwise figure out the cache line sizes using PICL
 491     bool is_fujitsu = (features & sparc64_family_m) != 0;
 492     PICL picl(is_fujitsu, is_sun4v);
 493     _L1_data_cache_line_size = picl.L1_data_cache_line_size();
 494     _L2_data_cache_line_size = picl.L2_data_cache_line_size();
 495   }
< prev index next >