Exemple #1
0
int main(void) {
    NaClCPUFeaturesX86 fv;
    NaClCPUData cpu_data;
    int feature_id;
    NaClCPUDataGet(&cpu_data);

    NaClGetCurrentCPUFeaturesX86((NaClCPUFeatures *) &fv);
    if (NaClArchSupportedX86(&fv)) {
        printf("This is a native client %d-bit %s compatible computer\n",
               NACL_TARGET_SUBARCH, GetCPUIDString(&cpu_data));
    } else {
        if (!NaClGetCPUFeatureX86(&fv, NaClCPUFeatureX86_CPUIDSupported)) {
            printf("Computer doesn't support CPUID\n");
        }
        if (!NaClGetCPUFeatureX86(&fv, NaClCPUFeatureX86_CPUSupported)) {
            printf("Computer id %s is not supported\n", GetCPUIDString(&cpu_data));
        }
    }

    printf("This processor has:\n");
    for (feature_id = 0; feature_id < NaClCPUFeatureX86_Max; ++feature_id) {
        if (NaClGetCPUFeatureX86(&fv, feature_id))
            printf("        %s\n", NaClGetCPUFeatureX86Name(feature_id));
    }
    return 0;
}
Exemple #2
0
int main(int argc, char *argv[]) {
  NaClCPUFeaturesX86 fv;
  NaClCPUData cpu_data;
  int feature_id;
  NaClCPUDataGet(&cpu_data);

  NaClGetCurrentCPUFeatures(&fv);
  if (NaClArchSupported(&fv)) {
    printf("This is a native client %d-bit %s compatible computer\n",
           NACL_TARGET_SUBARCH, GetCPUIDString(&cpu_data));
  } else {
    if (!fv.arch_features.f_cpuid_supported) {
      printf("Computer doesn't support CPUID\n");
    }
    if (!fv.arch_features.f_cpu_supported) {
      printf("Computer id %s is not supported\n", GetCPUIDString(&cpu_data));
    }
  }

  printf("This processor has:\n");
  for (feature_id = 0; feature_id < NaClCPUFeature_Max; ++feature_id) {
    if (NaClGetCPUFeature(&fv, feature_id))
      printf("        %s\n", NaClGetCPUFeatureName(feature_id));
  }
  return 0;
}
int NaCl_ThisCPUIsBlacklisted(void) {
    NaClCPUData data;
    const char* myid;
    NaClCPUDataGet(&data);
    myid = GetCPUIDString(&data);
    return IsCpuInList(myid,
                       kNaClCpuBlacklist,
                       NACL_ARRAY_SIZE(kNaClCpuBlacklist));
}
Exemple #4
0
int main(void) {
  NaClCPUData data;
  NaClCPUDataGet(&data);
  printf("white list ID: %s\n", GetCPUIDString(&data));
  if (NaCl_ThisCPUIsWhitelisted()) {
    printf("this CPU is on the whitelist\n");
  } else {
    printf("this CPU is NOT on the whitelist\n");
  }
  if (NaCl_ThisCPUIsBlacklisted()) {
    printf("this CPU is on the blacklist\n");
  } else {
    printf("this CPU is NOT on the blacklist\n");
  }

  CPUIDWhitelistUnitTests();
  return 0;
}