< 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 #if defined(IA32) || defined(AMD64)
 626   // Other platforms have less repetitive cpuinfo files
 627   char * line = NULL;
 628   size_t len = 0;
 629   ssize_t read;
 630   FILE *fp = fopen("/proc/cpuinfo", "r");
 631   if (fp) {
 632     while ((read = getline(&line, &len, fp)) != -1) {
 633       if (len > 10 && strstr(line, "microcode") != NULL) {
 634         char* rev = strchr(line, ':');
 635         if (rev != NULL) sscanf(rev + 1, "%x", &result);
 636         break;
 637       }
 638     }
 639     free(line);
 640     fclose(fp);
 641   }
 642 #endif // x86 platforms
 643   return result;
 644 }
 645 
 646 bool os::is_allocatable(size_t bytes) {
 647 #ifdef AMD64
 648   // unused on amd64?
 649   return true;
 650 #else
 651 
 652   if (bytes < 2 * G) {
 653     return true;
 654   }
 655 
 656   char* addr = reserve_memory(bytes, NULL);
 657 
 658   if (addr != NULL) {
 659     release_memory(addr, bytes);
 660   }
 661 
 662   return addr != NULL;
 663 #endif // AMD64
 664 }
 665 


< prev index next >