8249672: Include microcode revision in features_string on x86

Reviewed-by: kvn, stuefe
This commit is contained in:
Vladimir A Ivanov 2020-07-21 13:06:45 -07:00 committed by Sandhya Viswanathan
parent 006d0bcec1
commit cd98f7d5bf
7 changed files with 54 additions and 2 deletions

View file

@ -620,6 +620,26 @@ bool os::supports_sse() {
#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?