diff --git a/Makefile.rule b/Makefile.rule index 12b9e347d..299d19d43 100644 --- a/Makefile.rule +++ b/Makefile.rule @@ -95,7 +95,8 @@ VERSION = 0.1 # DEBUG = 1 ifeq ($(DEBUG), 1) -COMMON_OPT += -g -DDEBUG +COMMON_OPT += -g +# -DDEBUG else COMMON_OPT += -O2 endif diff --git a/cpuid_mips.c b/cpuid_mips.c index 723439815..7d0b5cc62 100644 --- a/cpuid_mips.c +++ b/cpuid_mips.c @@ -99,9 +99,22 @@ int detect(void){ fclose(infile); - if (strstr(p, "Loongson-3A")) return CPU_LOONGSON3A; - else return CPU_SICORTEX; - + if (strstr(p, "Loongson-3A")){ + return CPU_LOONGSON3A; + }else if (strstr(p, "Loongson-3")){ + infile = fopen("/proc/cpuinfo", "r"); + while (fgets(buffer, sizeof(buffer), infile)){ + if (!strncmp("system type", buffer, 11)){ + p = strchr(buffer, ':') + 2; + break; + } + } + fclose(infile); + if (strstr(p, "loongson3a")) + return CPU_LOONGSON3A; + }else{ + return CPU_SICORTEX; + } #endif return CPU_UNKNOWN; }