< prev index next >

src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp

Print this page

        

@@ -618,10 +618,30 @@
                major,minor, result ? "DOES" : "does NOT");
   return result;
 #endif // AMD64
 }
 
+juint os::cpu_microcode_revision() {
+  juint result = 0;
+  char data[2048] = {0}; // lines should fit in 2K buf
+  size_t len = sizeof(data);
+  FILE *fp = fopen("/proc/cpuinfo", "r");
+  if (fp) {
+    while (!feof(fp)) {
+      if (fgets(data, len, fp)) {
+        if (strstr(data, "microcode") != NULL) {
+          char* rev = strchr(data, ':');
+          if (rev != NULL) sscanf(rev + 1, "%x", &result);
+          break;
+        }
+      }
+    }
+    fclose(fp);
+  }
+  return result;
+}
+
 bool os::is_allocatable(size_t bytes) {
 #ifdef AMD64
   // unused on amd64?
   return true;
 #else
< prev index next >