#if CONFIG_RUNTIME_CPU_DETECT #ifdefined(__mips__) && defined(__linux__)
int mips_cpu_caps(void) {
char cpuinfo_line[512];
int flag = 0x0;
FILE *f = fopen("/proc/cpuinfo", "r");
if (!f) { // Assume nothing if /proc/cpuinfo is unavailable. // This will occur for Chrome sandbox for Pepper or Render process. return0;
} while (fgets(cpuinfo_line, sizeof(cpuinfo_line) - 1, f)) {
if (memcmp(cpuinfo_line, "cpu model", 9) == 0) { // Workaround early kernel without mmi in ASEs line.
if (strstr(cpuinfo_line, "Loongson-3")) {
flag |= HAS_MMI;
} else if (strstr(cpuinfo_line, "Loongson-2K")) {
flag |= HAS_MMI | HAS_MSA;
}
}
if (memcmp(cpuinfo_line, "ASEs implemented", 16) == 0) {
if (strstr(cpuinfo_line, "loongson-mmi") &&
strstr(cpuinfo_line, "loongson-ext")) {
flag |= HAS_MMI;
}
if (strstr(cpuinfo_line, "msa")) {
flag |= HAS_MSA;
} // ASEs is the last line, so we can break here. break;
}
}
fclose(f); return flag;
} #else/* end __mips__ && __linux__ */ #error \ "--enable-runtime-cpu-detect selected, but no CPU detection method " \ "available for your platform. Reconfigure with --disable-runtime-cpu-detect." #endif #else/* end CONFIG_RUNTIME_CPU_DETECT */
int mips_cpu_caps(void) { return0; } #endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.