< prev index next >

src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp

Print this page




 603 }
 604 
 605 // Check that the linux kernel version is 2.4 or higher since earlier
 606 // versions do not support SSE without patches.
 607 bool os::supports_sse() {
 608 #ifdef AMD64
 609   return true;
 610 #else
 611   struct utsname uts;
 612   if( uname(&uts) != 0 ) return false; // uname fails?
 613   char *minor_string;
 614   int major = strtol(uts.release,&minor_string,10);
 615   int minor = strtol(minor_string+1,NULL,10);
 616   bool result = (major > 2 || (major==2 && minor >= 4));
 617   log_info(os)("OS version is %d.%d, which %s support SSE/SSE2",
 618                major,minor, result ? "DOES" : "does NOT");
 619   return result;
 620 #endif // AMD64
 621 }
 622 




















 623 bool os::is_allocatable(size_t bytes) {
 624 #ifdef AMD64
 625   // unused on amd64?
 626   return true;
 627 #else
 628 
 629   if (bytes < 2 * G) {
 630     return true;
 631   }
 632 
 633   char* addr = reserve_memory(bytes, NULL);
 634 
 635   if (addr != NULL) {
 636     release_memory(addr, bytes);
 637   }
 638 
 639   return addr != NULL;
 640 #endif // AMD64
 641 }
 642 




 603 }
 604 
 605 // Check that the linux kernel version is 2.4 or higher since earlier
 606 // versions do not support SSE without patches.
 607 bool os::supports_sse() {
 608 #ifdef AMD64
 609   return true;
 610 #else
 611   struct utsname uts;
 612   if( uname(&uts) != 0 ) return false; // uname fails?
 613   char *minor_string;
 614   int major = strtol(uts.release,&minor_string,10);
 615   int minor = strtol(minor_string+1,NULL,10);
 616   bool result = (major > 2 || (major==2 && minor >= 4));
 617   log_info(os)("OS version is %d.%d, which %s support SSE/SSE2",
 618                major,minor, result ? "DOES" : "does NOT");
 619   return result;
 620 #endif // AMD64
 621 }
 622 
 623 juint os::cpu_microcode_revision() {
 624   juint result = 0;
 625   char data[2048] = {0}; // lines should fit in 2K buf
 626   size_t len = sizeof(data);
 627   FILE *fp = fopen("/proc/cpuinfo", "r");
 628   if (fp) {
 629     while (!feof(fp)) {
 630       if (fgets(data, len, fp)) {
 631         if (strstr(data, "microcode") != NULL) {
 632           char* rev = strchr(data, ':');
 633           if (rev != NULL) sscanf(rev + 1, "%x", &result);
 634           break;
 635         }
 636       }
 637     }
 638     fclose(fp);
 639   }
 640   return result;
 641 }
 642 
 643 bool os::is_allocatable(size_t bytes) {
 644 #ifdef AMD64
 645   // unused on amd64?
 646   return true;
 647 #else
 648 
 649   if (bytes < 2 * G) {
 650     return true;
 651   }
 652 
 653   char* addr = reserve_memory(bytes, NULL);
 654 
 655   if (addr != NULL) {
 656     release_memory(addr, bytes);
 657   }
 658 
 659   return addr != NULL;
 660 #endif // AMD64
 661 }
 662 


< prev index next >