2016-07-12 02:30:49 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "machine.h"
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
2016-07-12 16:44:03 -07:00
|
|
|
int ret, det=1;
|
|
|
|
struct cpuid_out res;
|
2016-07-12 02:30:49 +02:00
|
|
|
|
2016-07-12 16:44:03 -07:00
|
|
|
// Logic below from https://github.com/01org/intel-cmt-cat/blob/master/lib/host_cap.c
|
|
|
|
lcpuid(0x7, 0x0, &res);
|
|
|
|
if (!(res.ebx & (1 << 15))) {
|
|
|
|
det = 0;
|
2016-12-09 14:40:45 -08:00
|
|
|
return EXIT_FAILURE;
|
2016-07-12 16:44:03 -07:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
lcpuid(0x10, 0x0, &res);
|
|
|
|
if (!(res.ebx & (1 << 2))) {
|
|
|
|
det = 0;
|
2016-12-09 14:40:45 -08:00
|
|
|
return EXIT_FAILURE;
|
2016-07-12 16:44:03 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (det)
|
2016-12-09 14:40:45 -08:00
|
|
|
return EXIT_SUCCESS;
|
2016-07-12 02:30:49 +02:00
|
|
|
}
|