< 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 * line = NULL;
+  size_t len = 0;
+  ssize_t read;
+  FILE *fp = fopen("/proc/cpuinfo", "r");
+  if (fp) {
+    while ((read = getline(&line, &len, fp)) != -1) {
+      if (len > 10 && strstr(line, "microcode") != NULL) {
+        char* rev = strchr(line, ':');
+        if (rev != NULL) sscanf(rev + 1, "%x", &result);
+        break;
+      }
+    }
+    free(line);
+    fclose(fp);
+  }
+  return result;
+}
+
 bool os::is_allocatable(size_t bytes) {
 #ifdef AMD64
   // unused on amd64?
   return true;
 #else
< prev index next >