< 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 * line = NULL;
 626   size_t len = 0;
 627   ssize_t read;
 628   FILE *fp = fopen("/proc/cpuinfo", "r");
 629   if (fp) {
 630     while ((read = getline(&line, &len, fp)) != -1) {
 631       if (len > 10 && strstr(line, "microcode") != NULL) {
 632         char* rev = strchr(line, ':');
 633         if (rev != NULL) sscanf(rev + 1, "%x", &result);
 634         break;
 635       }
 636     }
 637     free(line);
 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 >